From f58e97656cd5b0bc06e511c63191fb25128ed44a Mon Sep 17 00:00:00 2001 From: Juan C Galvis <8420868+juancgalvis@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:04:38 -0500 Subject: [PATCH] fix(intellij): Update intellij version --- ide_extension/intellij/build.gradle.kts | 10 +++++----- ide_extension/intellij/gradle.properties | 2 +- .../devsecopsenginetools/actions/ScanIacAction.java | 8 ++++++++ .../devsecopsenginetools/actions/ScanImageAction.java | 8 ++++++++ .../devsecopsenginetools/ui/tool/LogPanel.java | 11 ++++++----- .../devsecopsenginetools/ui/tool/LogPanelLogger.java | 8 +++++--- .../utils/docker/DockerLatestImage.java | 7 ++++--- 7 files changed, 37 insertions(+), 17 deletions(-) diff --git a/ide_extension/intellij/build.gradle.kts b/ide_extension/intellij/build.gradle.kts index fe8cadfc..300703bf 100644 --- a/ide_extension/intellij/build.gradle.kts +++ b/ide_extension/intellij/build.gradle.kts @@ -50,13 +50,13 @@ dependencies { implementation("com.squareup.okhttp3:okhttp") implementation("org.jetbrains:annotations:24.1.0") - compileOnly("org.projectlombok:lombok:1.18.32") - annotationProcessor("org.projectlombok:lombok:1.18.32") + compileOnly("org.projectlombok:lombok:1.18.34") + annotationProcessor("org.projectlombok:lombok:1.18.34") - testCompileOnly("org.projectlombok:lombok:1.18.32") - testAnnotationProcessor("org.projectlombok:lombok:1.18.32") + testCompileOnly("org.projectlombok:lombok:1.18.34") + testAnnotationProcessor("org.projectlombok:lombok:1.18.34") - testImplementation("org.mockito:mockito-core:5.12.0") + testImplementation("org.mockito:mockito-core:5.13.0") implementation(platform("com.squareup.okhttp3:okhttp-bom:4.12.0")) } diff --git a/ide_extension/intellij/gradle.properties b/ide_extension/intellij/gradle.properties index 0295aeb2..ff8072e6 100644 --- a/ide_extension/intellij/gradle.properties +++ b/ide_extension/intellij/gradle.properties @@ -12,7 +12,7 @@ pluginSinceBuild=241 pluginUntilBuild=242.* # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension platformType=IC -platformVersion=2024.1.4 +platformVersion=2024.2.1 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP platformPlugins= diff --git a/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/actions/ScanIacAction.java b/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/actions/ScanIacAction.java index 44ac386c..74878f80 100644 --- a/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/actions/ScanIacAction.java +++ b/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/actions/ScanIacAction.java @@ -2,6 +2,7 @@ import co.com.bancolombia.devsecopsenginetools.tasks.ScanIacTask; import co.com.bancolombia.devsecopsenginetools.ui.tool.LogPanelLogger; +import com.intellij.openapi.actionSystem.ActionUpdateThread; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.Presentation; @@ -15,6 +16,8 @@ import javax.swing.*; +import static com.intellij.openapi.actionSystem.ActionUpdateThread.BGT; + public class ScanIacAction extends AnAction { private boolean isTaskRunning = false; @@ -43,6 +46,11 @@ public void actionPerformed(AnActionEvent e) { } } + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return BGT; + } + @Override public void update(@NotNull AnActionEvent e) { Presentation presentation = e.getPresentation(); diff --git a/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/actions/ScanImageAction.java b/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/actions/ScanImageAction.java index 5336db5d..de64955d 100644 --- a/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/actions/ScanImageAction.java +++ b/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/actions/ScanImageAction.java @@ -2,6 +2,7 @@ import co.com.bancolombia.devsecopsenginetools.tasks.ScanImageTask; import co.com.bancolombia.devsecopsenginetools.ui.tool.LogPanelLogger; +import com.intellij.openapi.actionSystem.ActionUpdateThread; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.Presentation; @@ -15,6 +16,8 @@ import javax.swing.*; +import static com.intellij.openapi.actionSystem.ActionUpdateThread.BGT; + public class ScanImageAction extends AnAction { private boolean isTaskRunning = false; @@ -43,6 +46,11 @@ public void actionPerformed(AnActionEvent e) { } } + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return BGT; + } + @Override public void update(@NotNull AnActionEvent e) { Presentation presentation = e.getPresentation(); diff --git a/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/ui/tool/LogPanel.java b/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/ui/tool/LogPanel.java index d6e722ea..53f1edea 100644 --- a/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/ui/tool/LogPanel.java +++ b/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/ui/tool/LogPanel.java @@ -4,7 +4,7 @@ import com.intellij.ui.components.JBPanel; import com.intellij.ui.components.JBScrollPane; import lombok.SneakyThrows; -import lombok.extern.log4j.Log4j2; +import lombok.extern.java.Log; import javax.swing.*; import javax.swing.text.AttributeSet; @@ -19,10 +19,11 @@ import java.net.URI; import java.util.HashMap; import java.util.Map; +import java.util.logging.Level; import java.util.regex.Matcher; import java.util.regex.Pattern; -@Log4j2 +@Log public class LogPanel extends JBPanel { private final transient StyledDocument doc; private final JTextPane textPane; @@ -56,7 +57,7 @@ public void appendText(String message, String color) { try { parseAndAppend("\033[" + color + "m" + message + "\033[0m\n"); } catch (BadLocationException e) { - log.warn("Error appending text", e); + log.log(Level.WARNING, "Error appending text", e); } } @@ -176,7 +177,7 @@ private String getText(Element element) { return textPane.getDocument().getText(element.getStartOffset(), element.getEndOffset() - element.getStartOffset()).trim(); } catch (BadLocationException e) { - log.warn("Error getting text from element", e); + log.log(Level.WARNING, "Error getting text from element", e); return null; } } @@ -185,7 +186,7 @@ private void openLink(String link) { try { Desktop.getDesktop().browse(new URI(link)); } catch (Exception e) { - log.warn("Error opening link: {}", link, e); + log.log(Level.WARNING, "Error opening link: " + link, e); } } diff --git a/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/ui/tool/LogPanelLogger.java b/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/ui/tool/LogPanelLogger.java index 62d8c869..61730cd4 100644 --- a/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/ui/tool/LogPanelLogger.java +++ b/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/ui/tool/LogPanelLogger.java @@ -15,15 +15,16 @@ import com.intellij.ui.content.ContentFactory; import lombok.AccessLevel; import lombok.Setter; -import lombok.extern.log4j.Log4j2; +import lombok.extern.java.Log; import org.jetbrains.annotations.NotNull; import java.awt.*; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; +import java.util.logging.Level; -@Log4j2 +@Log public class LogPanelLogger implements ToolWindowFactory, DumbAware { protected static final String TOOL_WINDOW_ID = "DevSecOps Engine Tools"; @@ -96,7 +97,7 @@ public static void activate(Project project) { toolWindow.activate(() -> { }, true, true); } catch (Exception e) { - log.warn("Error activating tool window", e); + log.log(Level.WARNING, "Error activating tool window", e); } } } @@ -110,6 +111,7 @@ public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindo .createActionToolbar("LogPanelToolbar", actionGroup, false); LogPanel logPanel = new LogPanel(); + actionToolbar.setTargetComponent(logPanel); logPanel.add(actionToolbar.getComponent(), BorderLayout.WEST); ContentFactory contentFactory = ContentFactory.getInstance(); Content content = contentFactory.createContent(logPanel, "Scan Output", false); diff --git a/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/utils/docker/DockerLatestImage.java b/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/utils/docker/DockerLatestImage.java index 02300ab3..f61db102 100644 --- a/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/utils/docker/DockerLatestImage.java +++ b/ide_extension/intellij/src/main/java/co/com/bancolombia/devsecopsenginetools/utils/docker/DockerLatestImage.java @@ -5,11 +5,12 @@ import co.com.bancolombia.devsecopsenginetools.utils.FileUtils; import co.com.bancolombia.devsecopsenginetools.utils.http.HttpClient; import lombok.RequiredArgsConstructor; -import lombok.extern.log4j.Log4j2; +import lombok.extern.java.Log; import java.util.Optional; +import java.util.logging.Level; -@Log4j2 +@Log @RequiredArgsConstructor public class DockerLatestImage { private final GlobalSettings settings; @@ -39,7 +40,7 @@ private Optional getLatestTag() { return Optional.of(tags.getResults().get(0).getName()); } } catch (Exception ex) { - log.info("Error getting latest image tag: ", ex); + log.log(Level.ALL, "Error getting latest image tag: ", ex); LogPanelLogger.warn("Error getting latest image, current will be used", ex); } return Optional.empty();