Feature Request: transmitted project instance parameter with ProjectComponent interface methods
已回答
I don’t understand why the projectOpened and projectClosed methods do not have the "Project" argument passed?
I want to know whether the project was open or closed, I think it is bad, the fact that these methods are without arguments.
My plugin starts to perform some actions when opening a project, but the project itself I can’t normally get, I use
val project = ProjectManager.getInstance().OpenProjects[0]
which works poorly if several projects are running!
The remaining methods simply do not work, the name of the project all the time returned as null.
I am using the latest version of IDEA EAP.
JDK 1.8, tested in WebStorm, Intellij IDEA.
请先登录再写评论。
If you need the Project instance, you can pass it in constructor of your ProjectComponent implementation and store it in a field.
If you just need to run your code on _opening_ the project, please use com.intellij.openapi.startup.StartupActivity instead.