Skip to content

Commit f5683c7

Browse files
committed
fix(mps-model-server-plugin): use startupActivity instead of AppLifecycleListener
AppLifecycleListener.appStarting doesn't exist in MPS 2020.3 and .appStarting is internal API. It's anyway recommended to use a startupActivity instead. See https://plugins.jetbrains.com/docs/intellij/plugin-components.html#project-open
1 parent a721600 commit f5683c7

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

mps-model-server-plugin/src/main/kotlin/org/modelix/model/server/mps/MPSModelServer.kt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
*/
1414
package org.modelix.model.server.mps
1515

16-
import com.intellij.ide.AppLifecycleListener
1716
import com.intellij.ide.plugins.DynamicPluginListener
1817
import com.intellij.ide.plugins.IdeaPluginDescriptor
1918
import com.intellij.openapi.Disposable
2019
import com.intellij.openapi.components.Service
2120
import com.intellij.openapi.components.service
2221
import com.intellij.openapi.project.DumbService
2322
import com.intellij.openapi.project.Project
23+
import com.intellij.openapi.startup.StartupActivity
2424
import jetbrains.mps.ide.project.ProjectHelper
2525
import jetbrains.mps.project.ProjectBase
2626
import jetbrains.mps.project.ProjectManager
@@ -127,12 +127,8 @@ class MPSModelServerDynamicPluginListener : DynamicPluginListener {
127127
}
128128
}
129129

130-
class MPSModelServerAppLifecycleListener : AppLifecycleListener {
131-
override fun appStarting(projectFromCommandLine: Project?) {
132-
service<MPSModelServer>().ensureStarted()
133-
}
134-
135-
override fun appStarted() {
130+
class MPSModelServerStartupActivity : StartupActivity {
131+
override fun runActivity(project: Project) {
136132
service<MPSModelServer>().ensureStarted()
137133
}
138134
}

mps-model-server-plugin/src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,11 @@
2525
<listener
2626
class="org.modelix.model.server.mps.MPSModelServerDynamicPluginListener"
2727
topic="com.intellij.ide.plugins.DynamicPluginListener"/>
28-
<listener
29-
class="org.modelix.model.server.mps.MPSModelServerAppLifecycleListener"
30-
topic="com.intellij.ide.AppLifecycleListener"/>
3128
</applicationListeners>
3229

3330
<!-- Extension points defined by the plugin.
3431
Read more: https://plugins.jetbrains.com/docs/intellij/plugin-extension-points.html -->
3532
<extensions defaultExtensionNs="com.intellij">
36-
33+
<postStartupActivity implementation="org.modelix.model.server.mps.MPSModelServerStartupActivity" />
3734
</extensions>
3835
</idea-plugin>

0 commit comments

Comments
 (0)