Accessing "PropertiesComponent" from ApplicationInitializedListener

Regarding this:

How could we leverage something close to:
PropertiesComponent.getInstance(ProjectManager.getInstance().openProjects[0]).getValue("a.property.we.want.to.lookup.at.that.moment")

  1. AIListener is internal API and must not be used in plugins
  2. You cannot assume that a project is open when the application starts
  3. If you need to obtain Project-related properties that are valid only inside the currently opened project, use methods listed Components (Deprecated) | IntelliJ Platform Plugin SDK

ApplicationInitializedListener is quite delicate API. Are you sure you need it for your task?

  1. How do I store information at a place where the Application-level PropertiesComponent could read it at the moment?
  2. Is there a different Listener that you would recommend us using instead? We want to log when the IDE is opened and closed, essentially.

We usually use com.intellij.openapi.startup.ProjectActivity for such tasks. It lives from the project opening and can subscribe to project close event.

But that requires a Project to be opened.
So someone opening the Application and landing on the “select a Project” to open would not end up having emitted the “Application opened” event to our telemetry, right?

Perhaps you are looking for AppLifecycleListener?

1 Like

AppLifecycleListener.welcomeScreenDisplayed should be an additional entry point.

BTW is also very suspicious that the plugin needs such application-wide telemetry.

Is AppLifecycleListener now supported on Gateway ?
We maintain our plugins for both local and remote experience.