generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d1c70d3
commit aed6f05
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/jiux/net/plugin/restful/listener/ProjectOpenCloseListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package jiux.net.plugin.restful.listener; | ||
|
||
import com.intellij.openapi.application.ApplicationManager; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.openapi.project.ProjectManagerListener; | ||
import jiux.net.plugin.restful.navigator.RestServicesNavigator; | ||
import jiux.net.plugin.utils.ToolkitUtil; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class ProjectOpenCloseListener implements ProjectManagerListener { | ||
|
||
@Override | ||
public void projectOpened(@NotNull Project project) { | ||
if (ApplicationManager.getApplication().isUnitTestMode()) { | ||
return; | ||
} | ||
|
||
RestServicesNavigator restServicesNavigator = RestServicesNavigator.getInstance( | ||
project | ||
); | ||
|
||
restServicesNavigator.listenForProjectsChanges(); | ||
|
||
ToolkitUtil.runWhenInitialized( | ||
project, | ||
() -> { | ||
if (project.isDisposed()) { | ||
return; | ||
} | ||
restServicesNavigator.initToolWindow(); | ||
} | ||
); | ||
} | ||
} |