How to get project open in the IDEA ?

Hi,

I have multiple IDEA instances open. When I switch between them, I want to know which project is open in the frame that is being activated.
I have implemented the FrameStateListener to get the events when IDEA frame changes.
I tired using DataManager to get the project, but it gives me the old project object and not the new one which is being activated.

Can someone tell me how can I achieve this?

~Priya

2 comments
Comment actions Permalink

Maybe com.intellij.openapi.wm.WindowManager.suggestParentWindow(Project) helps...

0
Comment actions Permalink

To use WindowManager.suggestParentWindow(Project) I need handle to the project. But I need the project itself, so how can I pass it to this API.

FrameListener is behaving weirdly. Suppose I have project A and project B opened in two different IDEA instances. Currently my frame for project A is open, I selected frame with project B to open, frame activated event is fired, but the project that I get using Data Manager is B and not A. I need handle to A.

Is there any other way to get the handle to the project in the frame that is getting activated.

0

Please sign in to leave a comment.