Get active project from new project wizard

I need to get the active project during execution of the new project wizard because I want to send output to a console / tool window running in it as part of the project creation.

Is there any way access the NewProjectEvent to get the active project, or is there an alternative way to get the active project in IJ15?

I have read this thread here

https://devnet.jetbrains.com/message/5190368#5190368

but as detailed in the last post the method discussed is deprecated so is not a good idea going forward.

Any help greatly appreciated!

Thanks, Andy



1
1 comment

It's disappointing that there has been no response to this question, luckily I have come up with my own solution (or hack) as there is a lack of this functionality in the API.

For anyone else who might be reading this and wondering how to achieve something similar, this is what I have done.

I created an ApplicationComponent that implements AnActionListener and has s static Project variable. In the init method of the component I add it as a listener to the ActionManager and filter the action for NewProject in the beforeActionPerformed and get the project from the action event, setting it into the static variable.

In my module builder I then retrieve the project from the application component and can then use it to print my output to the console as I need to.

0

Please sign in to leave a comment.