From c168d96b998c26ad1e86dc2fd625c43e3eefd599 Mon Sep 17 00:00:00 2001 From: Denis Lisenkov Date: Mon, 20 Mar 2023 16:38:40 +0300 Subject: [PATCH 1/5] IJMP-997: updated to build 231 --- build.gradle.kts | 8 ++++---- .../analytics/AnalyticsStartupActivity.kt | 6 +++--- .../editor/status/MfEncodingPanel.kt | 5 +++-- .../status/MfEncodingPanelWidgetFactory.kt | 16 +++++++++++----- .../editor/status/MfLineSeparatorPanel.kt | 5 +++-- .../status/MfLineSeparatorWidgetFactory.kt | 16 +++++++++++----- .../ibagroup/formainframe/utils/openapiUtils.kt | 12 ++++++------ src/main/resources/META-INF/plugin.xml | 4 ++-- 8 files changed, 43 insertions(+), 29 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c15224a82..d41115ca0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,7 +21,7 @@ apply(plugin = "kotlin") apply(plugin = "org.jetbrains.intellij") group = "eu.ibagroup" -version = "1.0.1" +version = "1.0.1-231" val remoteRobotVersion = "0.11.16" repositories { @@ -73,7 +73,7 @@ dependencies { } intellij { - version.set("2022.3") + version.set("LATEST-EAP-SNAPSHOT") } tasks { @@ -85,8 +85,8 @@ tasks { } patchPluginXml { - sinceBuild.set("223.7571") - untilBuild.set("223.*") + sinceBuild.set("231.8109") + untilBuild.set("231.*") changeNotes.set( """ WARNING: version 1.0 introduces breaking change. You won't be able to use the plugin with IntelliJ version less than 2022.3 diff --git a/src/main/kotlin/eu/ibagroup/formainframe/analytics/AnalyticsStartupActivity.kt b/src/main/kotlin/eu/ibagroup/formainframe/analytics/AnalyticsStartupActivity.kt index bb6e42dc9..3a2ff49fc 100644 --- a/src/main/kotlin/eu/ibagroup/formainframe/analytics/AnalyticsStartupActivity.kt +++ b/src/main/kotlin/eu/ibagroup/formainframe/analytics/AnalyticsStartupActivity.kt @@ -12,7 +12,7 @@ package eu.ibagroup.formainframe.analytics 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 /** @@ -20,10 +20,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/editor/status/MfEncodingPanel.kt b/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfEncodingPanel.kt index 6b303e937..c481704ea 100644 --- a/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfEncodingPanel.kt +++ b/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfEncodingPanel.kt @@ -16,13 +16,14 @@ import com.intellij.openapi.wm.StatusBar import com.intellij.openapi.wm.StatusBarWidget import com.intellij.openapi.wm.impl.status.EncodingPanel import eu.ibagroup.formainframe.vfs.MFVirtualFile +import kotlinx.coroutines.CoroutineScope const val MF_ENCODING_PANEL_WIDGET = "MF" + StatusBar.StandardWidgets.ENCODING_PANEL /** * 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) { /** * Returns the state of the widget for correct display in the status bar. @@ -38,7 +39,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. */ 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 f2d5b2679..21941a850 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.vfs.MFVirtualFile +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) } /** Enabled only for MF file opened in editor. */ @@ -34,4 +40,4 @@ class MfEncodingPanelWidgetFactory: EncodingPanelWidgetFactory() { val file = getFileEditor(statusBar)?.file return file is MFVirtualFile } -} \ 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 852ce61c6..5fc389b9d 100644 --- a/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfLineSeparatorPanel.kt +++ b/src/main/kotlin/eu/ibagroup/formainframe/editor/status/MfLineSeparatorPanel.kt @@ -19,13 +19,14 @@ import com.intellij.openapi.wm.impl.status.LineSeparatorPanel import eu.ibagroup.formainframe.dataops.DataOpsManager import eu.ibagroup.formainframe.dataops.attributes.RemoteUssAttributes import eu.ibagroup.formainframe.vfs.MFVirtualFile +import kotlinx.coroutines.CoroutineScope const val MF_LINE_SEPARATOR_PANEL_WIDGET = "MF" + StatusBar.StandardWidgets.LINE_SEPARATOR_PANEL /** * 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) { /** * Returns the state of the widget for correct display in the status bar. @@ -41,7 +42,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. */ 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 84af39a31..563de6939 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.vfs.MFVirtualFile +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) } /** Enabled only for MF file opened in editor. */ @@ -34,4 +40,4 @@ class MfLineSeparatorWidgetFactory: LineSeparatorWidgetFactory() { val file = getFileEditor(statusBar)?.file return file is MFVirtualFile } -} \ 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 8dc2d570b..fb5c6ef6b 100755 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -352,11 +352,11 @@ Example of how to see the output:
+ order="after Position"/> + order="after eu.ibagroup.formainframe.editor.status.MfLineSeparatorWidgetFactory, before PowerSaveMode"/> From f89311ee2ad17651e75c2c32df8ede998a3d16a8 Mon Sep 17 00:00:00 2001 From: Uladzislau Date: Mon, 3 Apr 2023 18:18:38 +0200 Subject: [PATCH 2/5] IJMP-1047 Changed IntelliJ build version --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index d41115ca0..f480aa66e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -73,7 +73,7 @@ dependencies { } intellij { - version.set("LATEST-EAP-SNAPSHOT") + version.set("2023.1") } tasks { From 1a224e3d06cb101d1102ee5aa7d3e4e64ffce7fe Mon Sep 17 00:00:00 2001 From: Arseni Tsikhamirau Date: Wed, 24 May 2023 11:56:39 +0200 Subject: [PATCH 3/5] IJMP-1140-Fix-ExplorerPasteProvider-tests-231 1) fixed tests + added support for IDEA version 231 --- .../ui/ExplorerPasteProviderTestSpec.kt | 26 ++++++++++++++++--- .../formainframe/explorer/ui/dummyClasses.kt | 8 ++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/ExplorerPasteProviderTestSpec.kt b/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/ExplorerPasteProviderTestSpec.kt index f6ccb257d..127c52cd3 100644 --- a/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/ExplorerPasteProviderTestSpec.kt +++ b/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/ExplorerPasteProviderTestSpec.kt @@ -99,11 +99,11 @@ class ExplorerPasteProviderTestSpec : ShouldSpec({ every { mockedCopyPasterProvider.getSourceFilesFromClipboard() } returns mockedClipboardBuffer every { mockedFileExplorerView.isCut } returns AtomicBoolean(true) - every { mockedFileExplorerView.ignoreVFileDeleteEvents } returns AtomicBoolean(false) + every { mockedFileExplorerView.ignoreVFSChangeEvents } returns AtomicBoolean(false) every { mockedFileExplorerView.copyPasteSupport } returns mockedCopyPasterProvider mockkObject(FileExplorerContentProvider) - mockkObject(FileExplorerContentProvider::getInstance) + //mockkObject(FileExplorerContentProvider::getInstance) every { FileExplorerContentProvider.getInstance().getExplorerView(any() as Project) } returns mockedFileExplorerView var isPastePerformed : Boolean @@ -538,6 +538,7 @@ class ExplorerPasteProviderTestSpec : ShouldSpec({ ) } returns mutableListOf(Pair(mockedSourceFile, mockedSourceFile)) + every { mockedSourceFile.findChild(any() as String) } returns null mockedExplorerPasteProvider.performPaste(mockedDataContext) assertSoftly { @@ -728,6 +729,7 @@ class ExplorerPasteProviderTestSpec : ShouldSpec({ val mockedSourceFile1 = mockk() val mockedSourceAttributes1 = mockk() every { mockedSourceFile1.name } returns "test1" + every { mockedSourceFile1.isDirectory } returns false every { mockedSourceAttributes1.isPastePossible } returns false every { mockedSourceAttributes1.isDirectory } returns false every { mockedSourceNodeData1.node } returns mockedSourceNode1 @@ -740,6 +742,7 @@ class ExplorerPasteProviderTestSpec : ShouldSpec({ val mockedSourceFile2 = mockk() val mockedSourceAttributes2 = mockk() every { mockedSourceFile2.name } returns "test2" + every { mockedSourceFile2.isDirectory } returns true every { mockedSourceAttributes2.isPastePossible } returns false every { mockedSourceAttributes2.isDirectory } returns false every { mockedSourceNodeData2.node } returns mockedSourceNode2 @@ -752,6 +755,7 @@ class ExplorerPasteProviderTestSpec : ShouldSpec({ val mockedSourceFile3 = mockk() val mockedSourceAttributes3 = mockk() every { mockedSourceFile3.name } returns "test1" + every { mockedSourceFile3.isDirectory } returns false every { mockedSourceAttributes3.isPastePossible } returns false every { mockedSourceAttributes3.isDirectory } returns false every { mockedSourceNodeData3.node } returns mockedSourceNode3 @@ -788,8 +792,9 @@ class ExplorerPasteProviderTestSpec : ShouldSpec({ val mockedSourceFile6 = mockk() val mockedSourceAttributes6 = mockk() every { mockedSourceFile6.name } returns "test1" + every { mockedSourceFile6.isDirectory } returns true every { mockedSourceAttributes6.isPastePossible } returns false - every { mockedSourceAttributes6.isDirectory } returns false + every { mockedSourceAttributes6.isDirectory } returns true every { mockedSourceNodeData6.node } returns mockedSourceNode6 every { mockedSourceNodeData6.file } returns mockedSourceFile6 every { mockedSourceNodeData6.attributes } returns mockedSourceAttributes6 @@ -797,18 +802,25 @@ class ExplorerPasteProviderTestSpec : ShouldSpec({ // children of target val childDestinationVirtualFile1 = mockk() every { childDestinationVirtualFile1.name } returns "test1" + every { childDestinationVirtualFile1.isDirectory } returns true val childDestinationVirtualFile2 = mockk() every { childDestinationVirtualFile2.name } returns "test_mf_file" val childDestMFFile2Attr = mockk() + val childDestinationVirtualFile3 = mockk() + every { childDestinationVirtualFile3.name } returns "test2" + every { childDestinationVirtualFile3.isDirectory } returns false // target to paste val mockedTargetFile1 = mockk() val mockedTargetFile2 = mockk() + val mockedTargetFile3 = mockk() val mockedTargetFile2Attributes = mockk() val mockedStructureTreeModelNodeTarget = mockk() val mockedNodeTarget = mockk() every { mockedTargetFile1.name } returns "test_folder" every { mockedTargetFile1.children } returns arrayOf(childDestinationVirtualFile1) + every { mockedTargetFile3.name } returns "test_folder2" + every { mockedTargetFile3.children } returns arrayOf(childDestinationVirtualFile3) every { mockedTargetFile2.name } returns "test_mf_folder" every { mockedTargetFile2.children } returns arrayOf(childDestinationVirtualFile2) every { mockedStructureTreeModelNodeTarget.userObject } returns mockedNodeTarget @@ -856,11 +868,16 @@ class ExplorerPasteProviderTestSpec : ShouldSpec({ } returns mutableListOf(Pair(mockedTargetFile1, mockedSourceFile1), Pair(mockedTargetFile1, mockedSourceFile2), Pair(mockedTargetFile1, mockedSourceFile3), Pair(mockedTargetFile1, mockedSourceFile4), Pair(mockedTargetFile1, mockedSourceFile5), Pair(mockedTargetFile1, mockedSourceFile6), - Pair(mockedTargetFile2, mockedSourceFile1), Pair(mockedTargetFile2, mockedSourceFile2), Pair(mockedTargetFile2, mockedSourceFile3) + Pair(mockedTargetFile2, mockedSourceFile1), Pair(mockedTargetFile2, mockedSourceFile2), Pair(mockedTargetFile2, mockedSourceFile3), + Pair(mockedTargetFile3, mockedSourceFile2) ) + every { mockedTargetFile1.findChild(any() as String) } returns childDestinationVirtualFile1 + every { mockedTargetFile3.findChild(any() as String) } returns childDestinationVirtualFile3 + every { dataOpsManagerService.testInstance.tryToGetAttributes(childDestinationVirtualFile1) } returns null every { dataOpsManagerService.testInstance.tryToGetAttributes(childDestinationVirtualFile2) } returns childDestMFFile2Attr + every { dataOpsManagerService.testInstance.tryToGetAttributes(childDestinationVirtualFile3) } returns null every { dataOpsManagerService.testInstance.tryToGetAttributes(mockedSourceFile1) } returns mockedSourceAttributes1 every { dataOpsManagerService.testInstance.tryToGetAttributes(mockedSourceFile2) } returns mockedSourceAttributes2 every { dataOpsManagerService.testInstance.tryToGetAttributes(mockedSourceFile3) } returns mockedSourceAttributes3 @@ -869,6 +886,7 @@ class ExplorerPasteProviderTestSpec : ShouldSpec({ every { dataOpsManagerService.testInstance.tryToGetAttributes(mockedSourceFile6) } returns mockedSourceAttributes6 every { dataOpsManagerService.testInstance.tryToGetAttributes(mockedTargetFile1) } returns null every { dataOpsManagerService.testInstance.tryToGetAttributes(mockedTargetFile2) } returns mockedTargetFile2Attributes + every { dataOpsManagerService.testInstance.tryToGetAttributes(mockedTargetFile3) } returns null every { mockedDataContext.getData(IS_DRAG_AND_DROP_KEY) } returns true every { mockedDataContext.getData(CommonDataKeys.PROJECT) } returns mockedProject diff --git a/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/dummyClasses.kt b/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/dummyClasses.kt index b5f2a0598..9d68c856f 100644 --- a/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/dummyClasses.kt +++ b/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/dummyClasses.kt @@ -38,6 +38,10 @@ open class TestFileEditorManager : FileEditorManager() { TODO("Not yet implemented") } + override fun openFile(file: VirtualFile): MutableList { + TODO("Not yet implemented") + } + override fun closeFile(file: VirtualFile) { TODO("Not yet implemented") } @@ -58,6 +62,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") } From a6d331da1dcbcda7409c107a0c5ff09c1a8c627d Mon Sep 17 00:00:00 2001 From: Dzianis Lisiankou Date: Wed, 14 Jun 2023 17:40:49 +0300 Subject: [PATCH 4/5] Fixes after 'Merge branch release/v1.1.0-223 into release/v1.1.0-231' --- .../config/ConfigStartupActivity.kt | 6 ++--- .../editor/ProjectStartupActivity.kt | 8 +++--- .../ui/ChangeEncodingDialogTestSpec.kt | 25 +++++++------------ 3 files changed, 16 insertions(+), 23 deletions(-) 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/test/kotlin/eu/ibagroup/formainframe/explorer/ui/ChangeEncodingDialogTestSpec.kt b/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/ChangeEncodingDialogTestSpec.kt index e0306b323..ed8b00c0d 100644 --- a/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/ChangeEncodingDialogTestSpec.kt +++ b/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/ChangeEncodingDialogTestSpec.kt @@ -10,6 +10,7 @@ package eu.ibagroup.formainframe.explorer.ui +import com.intellij.collaboration.ui.util.getName import com.intellij.icons.AllIcons import com.intellij.ide.IdeBundle import com.intellij.openapi.application.ApplicationManager @@ -204,8 +205,7 @@ class ChangeEncodingDialogTestSpec : ShouldSpec({ every { reloadIn(any(), virtualFileMock, charsetMock) } returns Unit val actions = createActionsRef.invoke(changeEncodingDialog).castOrNull>() - // TODO: change it.getValue(Action.NAME) to it.getName() in v1.*.*-231 and greater - val reloadAction = actions?.first { it.getValue(Action.NAME) == IdeBundle.message("button.reload") } + val reloadAction = actions?.first { it.getName() == IdeBundle.message("button.reload") } reloadAction?.actionPerformed(actionEventMock) assertSoftly { expectedExitCode shouldBe ChangeEncodingDialog.RELOAD_EXIT_CODE } @@ -215,8 +215,7 @@ class ChangeEncodingDialogTestSpec : ShouldSpec({ every { reloadIn(any(), virtualFileMock, charsetMock) } returns Unit val actions = createActionsRef.invoke(changeEncodingDialog).castOrNull>() - // TODO: change it.getValue(Action.NAME) to it.getName() in v1.*.*-231 and greater - val reloadAction = actions?.first { it.getValue(Action.NAME) == IdeBundle.message("button.reload") } + val reloadAction = actions?.first { it.getName() == IdeBundle.message("button.reload") } reloadAction?.actionPerformed(actionEventMock) assertSoftly { expectedExitCode shouldBe ChangeEncodingDialog.RELOAD_EXIT_CODE } @@ -247,8 +246,7 @@ class ChangeEncodingDialogTestSpec : ShouldSpec({ } val actions = createActionsRef.invoke(changeEncodingDialog).castOrNull>() - // TODO: change it.getValue(Action.NAME) to it.getName() in v1.*.*-231 and greater - val reloadAction = actions?.first { it.getValue(Action.NAME) == IdeBundle.message("button.reload") } + val reloadAction = actions?.first { it.getName() == IdeBundle.message("button.reload") } reloadAction?.actionPerformed(actionEventMock) assertSoftly { expectedExitCode shouldBe ChangeEncodingDialog.RELOAD_EXIT_CODE } @@ -279,8 +277,7 @@ class ChangeEncodingDialogTestSpec : ShouldSpec({ } val actions = createActionsRef.invoke(changeEncodingDialog).castOrNull>() - // TODO: change it.getValue(Action.NAME) to it.getName() in v1.*.*-231 and greater - val reloadAction = actions?.first { it.getValue(Action.NAME) == IdeBundle.message("button.reload") } + val reloadAction = actions?.first { it.getName() == IdeBundle.message("button.reload") } reloadAction?.actionPerformed(actionEventMock) assertSoftly { expectedExitCode shouldBe ChangeEncodingDialog.RELOAD_EXIT_CODE } @@ -304,8 +301,7 @@ class ChangeEncodingDialogTestSpec : ShouldSpec({ } val actions = createActionsRef.invoke(changeEncodingDialog).castOrNull>() - // TODO: change it.getValue(Action.NAME) to it.getName() in v1.*.*-231 and greater - val reloadAction = actions?.first { it.getValue(Action.NAME) == IdeBundle.message("button.reload") } + val reloadAction = actions?.first { it.getName() == IdeBundle.message("button.reload") } reloadAction?.actionPerformed(actionEventMock) assertSoftly { expectedExitCode shouldBe DialogWrapper.CANCEL_EXIT_CODE } @@ -316,8 +312,7 @@ class ChangeEncodingDialogTestSpec : ShouldSpec({ every { saveIn(any(), virtualFileMock, charsetMock) } returns Unit val actions = createActionsRef.invoke(changeEncodingDialog).castOrNull>() - // TODO: change it.getValue(Action.NAME) to it.getName() in v1.*.*-231 and greater - val convertAction = actions?.first { it.getValue(Action.NAME) == IdeBundle.message("button.convert") } + val convertAction = actions?.first { it.getName() == IdeBundle.message("button.convert") } convertAction?.actionPerformed(actionEventMock) assertSoftly { expectedExitCode shouldBe ChangeEncodingDialog.CONVERT_EXIT_CODE } @@ -348,8 +343,7 @@ class ChangeEncodingDialogTestSpec : ShouldSpec({ } val actions = createActionsRef.invoke(changeEncodingDialog).castOrNull>() - // TODO: change it.getValue(Action.NAME) to it.getName() in v1.*.*-231 and greater - val convertAction = actions?.first { it.getValue(Action.NAME) == IdeBundle.message("button.convert") } + val convertAction = actions?.first { it.getName() == IdeBundle.message("button.convert") } convertAction?.actionPerformed(actionEventMock) assertSoftly { expectedExitCode shouldBe ChangeEncodingDialog.CONVERT_EXIT_CODE } @@ -373,8 +367,7 @@ class ChangeEncodingDialogTestSpec : ShouldSpec({ } val actions = createActionsRef.invoke(changeEncodingDialog).castOrNull>() - // TODO: change it.getValue(Action.NAME) to it.getName() in v1.*.*-231 and greater - val convertAction = actions?.first { it.getValue(Action.NAME) == IdeBundle.message("button.convert") } + val convertAction = actions?.first { it.getName() == IdeBundle.message("button.convert") } convertAction?.actionPerformed(actionEventMock) assertSoftly { expectedExitCode shouldBe DialogWrapper.CANCEL_EXIT_CODE } From 99b514f0c7b48d05e18905fd2c18a846eeb9c040 Mon Sep 17 00:00:00 2001 From: Uladzislau Date: Fri, 11 Aug 2023 11:38:03 +0200 Subject: [PATCH 5/5] IntelliJ IDEA supported versions bump --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 6d2cd4bfe..5155ef0c6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -88,7 +88,7 @@ tasks { patchPluginXml { sinceBuild.set("231.8109") - untilBuild.set("231.*") + untilBuild.set("232.*") changeNotes.set( """ New features: