Please consider editing your post and mark it as obsolete instead. Do you want to delete post?
Project events
Permanently deleted user
Created
Hello,
I would like to know how to perform an action when closing a project And also, how to perform an action when a person moves from an open project to another open project
Register a ProjectManagerListener and/or ProjectLifecycleListener. Note that it is possible to configure IDEA to have multiple projects open simultaneously, so "moving from one project to another" may require you to watch for focus events using a WindowFocusListener subclass.
OK.. Instead of using the AWT focus listener, take a look at FocusChangeListener(Editor editor). editor.getProject() will give you the project associated with the editor. You will have to register the listener with EditorEventMulticaster.addFocusChangeListener(), which you get from EditorFactory.getEventMulticaster().
Register a ProjectManagerListener and/or ProjectLifecycleListener. Note that it is possible to configure IDEA to have multiple projects open simultaneously, so "moving from one project to another" may require you to watch for focus events using a WindowFocusListener subclass.
Hello,
Thanks for your help, however, I don't know how to verify that the open window is that of an open project, do you have any idea how to proceed?
Thank you
OK.. Instead of using the AWT focus listener, take a look at FocusChangeListener(Editor editor). editor.getProject() will give you the project associated with the editor. You will have to register the listener with EditorEventMulticaster.addFocusChangeListener(), which you get from EditorFactory.getEventMulticaster().
Hello,
I can't find the addFocusChangeListener() method in the EditorEventMulticaster interface (see https://github.com/JetBrains/intellij-community/blob/master/platform/editor-ui-api/src/com/intellij/openapi/editor/event/EditorEventMulticaster.java), was I wrong somewhere?
Thanks
Sorry, EditorEventMulticasterEx:
Hello,
Thanks for your help!
Sincerely