-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require at 2023.1 version to be able to use new IDEA API (ProjectActi…
…vity) to avoid deadlock on IDEA start in 2024.1
- Loading branch information
Showing
3 changed files
with
42 additions
and
18 deletions.
There are no files selected for viewing
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
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
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,32 @@ | ||
package org.turbanov.actions | ||
|
||
import com.intellij.openapi.application.ApplicationManager | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.project.ProjectManager | ||
import com.intellij.openapi.project.ProjectManagerListener | ||
import com.intellij.openapi.startup.ProjectActivity | ||
import java.util.* | ||
|
||
/** | ||
* @author Andrey Turbanov | ||
* @since 08.04.2024 | ||
*/ | ||
class BootstrapActivity() : ProjectActivity { | ||
private val bootstraps = Collections.synchronizedMap(IdentityHashMap<Project, Bootstrap>()) | ||
|
||
init { | ||
val connect = ApplicationManager.getApplication().getMessageBus().connect() | ||
connect.subscribe(ProjectManager.TOPIC, object : ProjectManagerListener { | ||
override fun projectClosing(project: Project) { | ||
val bootstrap = bootstraps.remove(project) | ||
bootstrap?.projectClosed() | ||
} | ||
}) | ||
} | ||
|
||
override suspend fun execute(project: Project) { | ||
val bootstrap = Bootstrap(project) | ||
bootstraps.put(project, bootstrap) | ||
bootstrap.projectOpened() | ||
} | ||
} |