diff --git a/build.gradle.kts b/build.gradle.kts index 83f18f446..e2bf137f2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,7 +22,7 @@ apply(plugin = "kotlin") apply(plugin = "org.jetbrains.intellij") group = "eu.ibagroup" -version = "1.1.1-223" +version = "1.1.1-231" val remoteRobotVersion = "0.11.19" val okHttp3Version = "4.10.0" val kotestVersion = "5.6.2" @@ -75,7 +75,7 @@ dependencies { } intellij { - version.set("2022.3") + version.set("2023.1") } tasks { @@ -87,8 +87,8 @@ tasks { } patchPluginXml { - sinceBuild.set("223.7571") - untilBuild.set("223.*") + sinceBuild.set("231.8109") + untilBuild.set("232.*") changeNotes.set( """ New features: diff --git a/src/main/kotlin/eu/ibagroup/formainframe/analytics/AnalyticsStartupActivity.kt b/src/main/kotlin/eu/ibagroup/formainframe/analytics/AnalyticsStartupActivity.kt index 748f251b9..3ad1da837 100644 --- a/src/main/kotlin/eu/ibagroup/formainframe/analytics/AnalyticsStartupActivity.kt +++ b/src/main/kotlin/eu/ibagroup/formainframe/analytics/AnalyticsStartupActivity.kt @@ -13,7 +13,7 @@ package eu.ibagroup.formainframe.analytics import com.intellij.openapi.application.invokeLater import com.intellij.openapi.components.service import com.intellij.openapi.project.Project -import com.intellij.openapi.startup.StartupActivity +import com.intellij.openapi.startup.ProjectActivity import eu.ibagroup.formainframe.analytics.ui.AnalyticsPolicyDialog /** @@ -21,10 +21,10 @@ import eu.ibagroup.formainframe.analytics.ui.AnalyticsPolicyDialog * It shows the analytics policy dialog before starting events tracking. * @author Valiantsin Krus. */ -class AnalyticsStartupActivity : StartupActivity { +class AnalyticsStartupActivity : ProjectActivity { /** Shows analytics policy dialog if user was not aware of it. */ - override fun runActivity(project: Project) { + override suspend fun execute(project: Project) { val analyticsService = service() val policyProvider = service() if (!analyticsService.isUserAcknowledged) { diff --git a/src/main/kotlin/eu/ibagroup/formainframe/config/ConfigStartupActivity.kt b/src/main/kotlin/eu/ibagroup/formainframe/config/ConfigStartupActivity.kt index 978287721..ffd425799 100644 --- a/src/main/kotlin/eu/ibagroup/formainframe/config/ConfigStartupActivity.kt +++ b/src/main/kotlin/eu/ibagroup/formainframe/config/ConfigStartupActivity.kt @@ -12,16 +12,16 @@ package eu.ibagroup.formainframe.config import com.intellij.openapi.components.service import com.intellij.openapi.project.Project -import com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager.PostStartupActivity +import com.intellij.openapi.startup.ProjectActivity /** * Activity to prepare configs. * @author Valiantsin Krus. */ -class ConfigStartupActivity: PostStartupActivity() { +class ConfigStartupActivity: ProjectActivity { /** Registers all config classes and migrate configs to state v2. */ - override fun runActivity(project: Project) { + override suspend fun execute(project: Project) { service().apply { registerAllConfigClasses() service().state?.let { oldState -> diff --git a/src/main/kotlin/eu/ibagroup/formainframe/editor/ProjectStartupActivity.kt b/src/main/kotlin/eu/ibagroup/formainframe/editor/ProjectStartupActivity.kt index 4be004c41..0d190a66d 100644 --- a/src/main/kotlin/eu/ibagroup/formainframe/editor/ProjectStartupActivity.kt +++ b/src/main/kotlin/eu/ibagroup/formainframe/editor/ProjectStartupActivity.kt @@ -11,20 +11,20 @@ package eu.ibagroup.formainframe.editor import com.intellij.openapi.project.Project -import com.intellij.openapi.startup.StartupActivity +import com.intellij.openapi.startup.ProjectActivity import com.intellij.openapi.wm.StatusBar import com.intellij.openapi.wm.StatusBarWidgetFactory /** * Project post startup activity. */ -class ProjectStartupActivity: StartupActivity.DumbAware { +class ProjectStartupActivity: ProjectActivity { /** - * Implementation of [StartupActivity.runActivity]. + * Implementation of [ProjectActivity.execute]. * Unregisters widget factories that provide status bar widgets that are overridden in the plugin. */ - override fun runActivity(project: Project) { + override suspend fun execute(project: Project) { val extensionPoint = StatusBarWidgetFactory.EP_NAME.point extensionPoint.extensionList.filter { it.id == StatusBar.StandardWidgets.ENCODING_PANEL || it.id == StatusBar.StandardWidgets.LINE_SEPARATOR_PANEL diff --git a/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfEncodingPanel.kt b/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfEncodingPanel.kt index 101717922..943f8b88b 100644 --- a/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfEncodingPanel.kt +++ b/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfEncodingPanel.kt @@ -15,6 +15,7 @@ import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.wm.StatusBar import com.intellij.openapi.wm.StatusBarWidget import com.intellij.openapi.wm.impl.status.EncodingPanel +import kotlinx.coroutines.CoroutineScope import eu.ibagroup.formainframe.editor.isMfVirtualFile import eu.ibagroup.formainframe.editor.zoweExplorerInstalled @@ -25,7 +26,7 @@ const val MF_ENCODING_PANEL_WIDGET = "MF" + StatusBar.StandardWidgets.ENCODING_P /** * Encoding panel in status bar with correctly display for MF files. */ -class MfEncodingPanel(project: Project): EncodingPanel(project) { +class MfEncodingPanel(project: Project, scope: CoroutineScope): EncodingPanel(project, scope) { // This code should not be present in Zowe repo /** @@ -42,7 +43,7 @@ class MfEncodingPanel(project: Project): EncodingPanel(project) { } override fun createInstance(project: Project): StatusBarWidget { - return MfEncodingPanel(project) + return MfEncodingPanel(project, scope) } /** Widget is not enabled for MF files. */ @@ -56,4 +57,4 @@ class MfEncodingPanel(project: Project): EncodingPanel(project) { override fun ID(): String { return MF_ENCODING_PANEL_WIDGET } -} \ No newline at end of file +} diff --git a/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfEncodingPanelWidgetFactory.kt b/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfEncodingPanelWidgetFactory.kt index f9a84df90..a52ef0858 100644 --- a/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfEncodingPanelWidgetFactory.kt +++ b/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfEncodingPanelWidgetFactory.kt @@ -13,20 +13,26 @@ package eu.ibagroup.formainframe.editor.status import com.intellij.openapi.project.Project import com.intellij.openapi.wm.StatusBar import com.intellij.openapi.wm.StatusBarWidget -import com.intellij.openapi.wm.impl.status.EncodingPanelWidgetFactory +import com.intellij.ui.UIBundle +import com.intellij.openapi.wm.impl.status.widget.StatusBarEditorBasedWidgetFactory import eu.ibagroup.formainframe.editor.zoweExplorerInstalled +import kotlinx.coroutines.CoroutineScope /** * Status bar widget factory for [MfEncodingPanel]. */ -class MfEncodingPanelWidgetFactory: EncodingPanelWidgetFactory() { +class MfEncodingPanelWidgetFactory: StatusBarEditorBasedWidgetFactory() { override fun getId(): String { return MF_ENCODING_PANEL_WIDGET } - override fun createWidget(project: Project): StatusBarWidget { - return MfEncodingPanel(project) + override fun getDisplayName(): String { + return UIBundle.message("status.bar.encoding.widget.name") + } + + override fun createWidget(project: Project, scope: CoroutineScope): StatusBarWidget { + return MfEncodingPanel(project, scope) } // This code should not be present in Zowe repo @@ -37,4 +43,4 @@ class MfEncodingPanelWidgetFactory: EncodingPanelWidgetFactory() { } return super.canBeEnabledOn(statusBar) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfLineSeparatorPanel.kt b/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfLineSeparatorPanel.kt index e5d6bf793..527e3cd37 100644 --- a/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfLineSeparatorPanel.kt +++ b/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfLineSeparatorPanel.kt @@ -18,6 +18,7 @@ import com.intellij.openapi.wm.impl.status.LineSeparatorPanel import eu.ibagroup.formainframe.editor.isMfVirtualFile import eu.ibagroup.formainframe.editor.isUssVirtualFile import eu.ibagroup.formainframe.editor.zoweExplorerInstalled +import kotlinx.coroutines.CoroutineScope // This code should not be as described below in Zowe repo // Change MF to ZoweMF @@ -26,7 +27,7 @@ const val MF_LINE_SEPARATOR_PANEL_WIDGET = "MF" + StatusBar.StandardWidgets.LINE /** * Line separator panel in status bar with correctly display for MF files. */ -class MfLineSeparatorPanel(project: Project): LineSeparatorPanel(project) { +class MfLineSeparatorPanel(project: Project, scope: CoroutineScope): LineSeparatorPanel(project, scope) { // This code should not be present in Zowe repo /** @@ -43,7 +44,7 @@ class MfLineSeparatorPanel(project: Project): LineSeparatorPanel(project) { } override fun createInstance(project: Project): StatusBarWidget { - return MfLineSeparatorPanel(project) + return MfLineSeparatorPanel(project, scope) } /** Widget is not enabled for all MF files except USS files. */ @@ -57,4 +58,4 @@ class MfLineSeparatorPanel(project: Project): LineSeparatorPanel(project) { override fun ID(): String { return MF_LINE_SEPARATOR_PANEL_WIDGET } -} \ No newline at end of file +} diff --git a/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfLineSeparatorWidgetFactory.kt b/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfLineSeparatorWidgetFactory.kt index 500d77955..e124a4c80 100644 --- a/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfLineSeparatorWidgetFactory.kt +++ b/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfLineSeparatorWidgetFactory.kt @@ -13,20 +13,26 @@ package eu.ibagroup.formainframe.editor.status import com.intellij.openapi.project.Project import com.intellij.openapi.wm.StatusBar import com.intellij.openapi.wm.StatusBarWidget -import com.intellij.openapi.wm.impl.status.LineSeparatorWidgetFactory +import com.intellij.openapi.wm.impl.status.widget.StatusBarEditorBasedWidgetFactory +import com.intellij.ui.UIBundle import eu.ibagroup.formainframe.editor.zoweExplorerInstalled +import kotlinx.coroutines.CoroutineScope /** * Status bar widget factory for [MfLineSeparatorPanel]. */ -class MfLineSeparatorWidgetFactory: LineSeparatorWidgetFactory() { +class MfLineSeparatorWidgetFactory: StatusBarEditorBasedWidgetFactory() { override fun getId(): String { return MF_LINE_SEPARATOR_PANEL_WIDGET } - override fun createWidget(project: Project): StatusBarWidget { - return MfLineSeparatorPanel(project) + override fun getDisplayName(): String { + return UIBundle.message("status.bar.line.separator.widget.name") + } + + override fun createWidget(project: Project, scope: CoroutineScope): StatusBarWidget { + return MfLineSeparatorPanel(project, scope) } // This code should not be present in Zowe repo @@ -37,4 +43,4 @@ class MfLineSeparatorWidgetFactory: LineSeparatorWidgetFactory() { } return super.canBeEnabledOn(statusBar) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/eu/ibagroup/formainframe/utils/openapiUtils.kt b/src/main/kotlin/eu/ibagroup/formainframe/utils/openapiUtils.kt index 74a0bcae9..51731cc6b 100644 --- a/src/main/kotlin/eu/ibagroup/formainframe/utils/openapiUtils.kt +++ b/src/main/kotlin/eu/ibagroup/formainframe/utils/openapiUtils.kt @@ -44,7 +44,7 @@ val cachesDir by lazy { * @param topic the topic to get sync publisher for * @param componentManager the component manager to get the topic sync publisher */ -fun sendTopic( +fun sendTopic( topic: Topic, componentManager: ComponentManager = ApplicationManager.getApplication() ): L { @@ -117,9 +117,9 @@ fun submitOnWriteThread(block: () -> T): T { } @Suppress("UnstableApiUsage") -inline fun runWriteActionOnWriteThread(crossinline block: () -> T): T { +fun runWriteActionOnWriteThread(block: () -> T): T { val app = ApplicationManager.getApplication() - return if (app.isWriteThread) { + return if (app.isWriteIntentLockAcquired) { if (app.isWriteAccessAllowed) { block() } else { @@ -131,7 +131,7 @@ inline fun runWriteActionOnWriteThread(crossinline block: () -> T): T { } } -inline fun runReadActionInEdtAndWait(crossinline block: () -> T): T { +fun runReadActionInEdtAndWait(block: () -> T): T { return invokeAndWaitIfNeeded { runReadAction(block) } } @@ -194,13 +194,13 @@ inline fun runTask( }) } -inline fun runWriteActionInEdt(crossinline block: () -> Unit) { +fun runWriteActionInEdt(block: () -> Unit) { runInEdt { runWriteAction(block) } } -inline fun runWriteActionInEdtAndWait(crossinline block: () -> Unit) { +fun runWriteActionInEdtAndWait(block: () -> Unit) { invokeAndWaitIfNeeded { runWriteAction(block) } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 4d4455240..9855f3b5b 100755 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -376,11 +376,11 @@ Example of how to see the output:
+ order="after Position"/> + order="after eu.ibagroup.formainframe.editor.status.MfLineSeparatorWidgetFactory, before PowerSaveMode"/> { + TODO("Not yet implemented") + } + override fun closeFile(file: VirtualFile) { TODO("Not yet implemented") } @@ -52,6 +56,10 @@ open class TestFileEditorManager : FileEditorManager() { TODO("Not yet implemented") } + override fun getOpenFilesWithRemotes(): MutableList { + TODO("Not yet implemented") + } + override fun getSelectedFiles(): Array { TODO("Not yet implemented") }