in max_opened_projects/src/main/kotlin/org/intellij/sdk/maxOpenProjects/ProjectOpenStartupActivity.kt [14:28]
override suspend fun execute(project: Project) {
val application = ApplicationManager.getApplication()
val projectCountingService = application.getService(ProjectCountingService::class.java)
projectCountingService.increaseOpenProjectCount()
if (projectCountingService.isOpenProjectsLimitExceeded) {
application.invokeLater {
Messages.showMessageDialog(
project,
"The number of open projects exceeded the limit while opening the '${project.name}' project.",
"Open Projects Limit Exceeded",
Messages.getInformationIcon()
)
}
}
}