From 3d22c0d8f2f63c1fe32d8076a6cd094c42d447e9 Mon Sep 17 00:00:00 2001 From: Demyan Kimitsa Date: Fri, 9 Feb 2024 00:43:20 +0200 Subject: [PATCH] * idea plugin: maintenance - 2024.1 eap support (#769) * * idea plugin: maintenance - 2024.1 eap support - commons-compress version updated as Idea bundles recent one with API not compatible - removed dropped api (`startInTransaction`); - handled `getActionUpdateThread` api as currently requested for actions that utilizes `update` call - min supported version is updated to 2022.3 * * idea: corrected gradle file as well --------- Co-authored-by: Tomski (cherry picked from commit 3ede0a72d2797bc915ed45d1b9699f4d13d690c6) --- plugins/idea/build.gradle | 3 ++- .../idea/src/main/java/org/robovm/idea/RoboVmPlugin.java | 4 ++-- .../java/org/robovm/idea/actions/ASNewProjectAction.java | 5 ----- .../org/robovm/idea/actions/CleanBuildFoldersAction.java | 6 ++++++ .../org/robovm/idea/actions/CleanRoboVmCacheAction.java | 6 ++++++ .../org/robovm/idea/actions/GenerateXCodeProjectAction.java | 6 ++++++ plugins/idea/src/main/resources/META-INF/plugin.xml | 2 +- pom.xml | 2 +- 8 files changed, 24 insertions(+), 10 deletions(-) diff --git a/plugins/idea/build.gradle b/plugins/idea/build.gradle index 369a70658..b8574d320 100644 --- a/plugins/idea/build.gradle +++ b/plugins/idea/build.gradle @@ -37,10 +37,11 @@ dependencies { exclude group: 'com.robovmx', module: 'robovm-templates-console' } robovm_dist "com.robovmx:robovm-dist:${roboVMVersion}:nocompiler@tar.gz" + implementation 'org.apache.commons:commons-compress:1.25.0' } intellij { - version = '2021.1' // we are compiles against this API version + version = '2022.3' // we are compiles against this API version plugins = ['java', 'maven', 'gradle'] updateSinceUntilBuild = false } diff --git a/plugins/idea/src/main/java/org/robovm/idea/RoboVmPlugin.java b/plugins/idea/src/main/java/org/robovm/idea/RoboVmPlugin.java index ae6b3cd61..585d9cf15 100755 --- a/plugins/idea/src/main/java/org/robovm/idea/RoboVmPlugin.java +++ b/plugins/idea/src/main/java/org/robovm/idea/RoboVmPlugin.java @@ -42,7 +42,7 @@ import com.intellij.ui.content.Content; import com.intellij.util.PlatformUtils; import com.intellij.util.ui.UIUtil; -import org.apache.commons.compress.archivers.ArchiveEntry; +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; @@ -317,7 +317,7 @@ private static void extractArchive(String archive, File dest) { archive = "/" + archive; try (TarArchiveInputStream in = new TarArchiveInputStream(new GZIPInputStream(RoboVmPlugin.class.getResourceAsStream(archive)))) { boolean filesWereUpdated = false; - ArchiveEntry entry; + TarArchiveEntry entry; while ((entry = in.getNextEntry()) != null) { File f = new File(dest, entry.getName()); if (entry.isDirectory()) { diff --git a/plugins/idea/src/main/java/org/robovm/idea/actions/ASNewProjectAction.java b/plugins/idea/src/main/java/org/robovm/idea/actions/ASNewProjectAction.java index 4dcdf4de3..43dce5b1b 100644 --- a/plugins/idea/src/main/java/org/robovm/idea/actions/ASNewProjectAction.java +++ b/plugins/idea/src/main/java/org/robovm/idea/actions/ASNewProjectAction.java @@ -29,11 +29,6 @@ public class ASNewProjectAction extends AnAction { public ASNewProjectAction() { } - @Override - public boolean startInTransaction() { - return true; - } - @Override public void actionPerformed(@NotNull AnActionEvent e) { NewProjectWizard wizard = new NewProjectWizard(null, ModulesProvider.EMPTY_MODULES_PROVIDER, null); diff --git a/plugins/idea/src/main/java/org/robovm/idea/actions/CleanBuildFoldersAction.java b/plugins/idea/src/main/java/org/robovm/idea/actions/CleanBuildFoldersAction.java index f76764957..55bd54e3b 100644 --- a/plugins/idea/src/main/java/org/robovm/idea/actions/CleanBuildFoldersAction.java +++ b/plugins/idea/src/main/java/org/robovm/idea/actions/CleanBuildFoldersAction.java @@ -18,6 +18,7 @@ import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; +import com.intellij.openapi.actionSystem.ActionUpdateThread; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.module.Module; @@ -48,6 +49,11 @@ public void actionPerformed(@NotNull AnActionEvent e) { } } + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.EDT; + } + @Override public void update(AnActionEvent e) { e.getPresentation().setEnabled(!busy.get()); diff --git a/plugins/idea/src/main/java/org/robovm/idea/actions/CleanRoboVmCacheAction.java b/plugins/idea/src/main/java/org/robovm/idea/actions/CleanRoboVmCacheAction.java index ce39b630d..cd37c28ec 100644 --- a/plugins/idea/src/main/java/org/robovm/idea/actions/CleanRoboVmCacheAction.java +++ b/plugins/idea/src/main/java/org/robovm/idea/actions/CleanRoboVmCacheAction.java @@ -18,6 +18,7 @@ import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; +import com.intellij.openapi.actionSystem.ActionUpdateThread; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.progress.ProgressIndicator; @@ -42,6 +43,11 @@ public void actionPerformed(AnActionEvent anActionEvent) { ProgressManager.getInstance().run(new CleanTask()); } + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.EDT; + } + @Override public void update(AnActionEvent e) { e.getPresentation().setEnabled(!busy.get()); diff --git a/plugins/idea/src/main/java/org/robovm/idea/actions/GenerateXCodeProjectAction.java b/plugins/idea/src/main/java/org/robovm/idea/actions/GenerateXCodeProjectAction.java index 6f61d26be..77a2ea7ad 100644 --- a/plugins/idea/src/main/java/org/robovm/idea/actions/GenerateXCodeProjectAction.java +++ b/plugins/idea/src/main/java/org/robovm/idea/actions/GenerateXCodeProjectAction.java @@ -15,6 +15,7 @@ */ package org.robovm.idea.actions; +import com.intellij.openapi.actionSystem.ActionUpdateThread; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.LangDataKeys; @@ -56,6 +57,11 @@ private Module workaroundModuleGroupingIssue(Module module) { return module; } + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.BGT; + } + @Override public void update(AnActionEvent e) { e.getPresentation().setEnabled(!RoboVmIbXcodeProjectTask.isBusy() && isValidModuleEvent(e)); diff --git a/plugins/idea/src/main/resources/META-INF/plugin.xml b/plugins/idea/src/main/resources/META-INF/plugin.xml index bf0389883..fa84e6f49 100755 --- a/plugins/idea/src/main/resources/META-INF/plugin.xml +++ b/plugins/idea/src/main/resources/META-INF/plugin.xml @@ -6,7 +6,7 @@ org.jetbrains.idea.maven org.jetbrains.plugins.gradle com.intellij.modules.java - + MobiVM diff --git a/pom.xml b/pom.xml index e475489c8..ace15b57d 100644 --- a/pom.xml +++ b/pom.xml @@ -146,7 +146,7 @@ org.apache.commons commons-compress - 1.21 + 1.25.0 com.googlecode.plist