Skip to content

Commit

Permalink
Merge pull request #270 from Checkmarx/fix/benalvo/error-starting-ide
Browse files Browse the repository at this point in the history
Change deprecated ActionUpdateThread func (AST-65497)
  • Loading branch information
OrShamirCM authored Sep 2, 2024
2 parents 77f0f28 + 49f4f27 commit 4027fc0
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.intellij.ide.ActivityTracker;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.notification.NotificationType;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.diagnostic.Logger;
Expand Down Expand Up @@ -62,8 +63,12 @@ public void update(@NotNull AnActionEvent e) {
e.getPresentation().setEnabled(isScanRunning);
}
catch (Exception ex) {
ex.printStackTrace();
e.getPresentation().setEnabled(false);
}
}
@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.checkmarx.intellij.Bundle;
import com.checkmarx.intellij.Resource;
import com.checkmarx.intellij.tool.window.CxToolWindowPanel;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import org.jetbrains.annotations.NotNull;
Expand All @@ -28,4 +29,10 @@ public CollapseAllAction() {
public void actionPerformed(@NotNull AnActionEvent e) {
Optional.ofNullable(getCxToolWindowPanel(e)).ifPresent(CxToolWindowPanel::collapseAll);
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.checkmarx.intellij.Bundle;
import com.checkmarx.intellij.Resource;
import com.checkmarx.intellij.settings.global.GlobalSettingsConfigurable;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.options.ShowSettingsUtil;
Expand All @@ -27,4 +28,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
ShowSettingsUtil.getInstance()
.showSettingsDialog(e.getProject(), GlobalSettingsConfigurable.class);
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.intellij.ide.ActivityTracker;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.notification.*;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.diagnostic.Logger;
Expand Down Expand Up @@ -289,7 +290,6 @@ public void update(@NotNull AnActionEvent e) {
e.getPresentation().setEnabled(!isScanRunning && !isPollingScan && !scanTriggered && projectAndBranchSelected);
}
catch (Exception ex) {
LOGGER.error(ex);
e.getPresentation().setEnabled(false);
}
}
Expand All @@ -311,4 +311,10 @@ public static void cancelRunningScan() {
private static String msg(Resource resource, Object... params) {
return Bundle.message(resource, params);
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.checkmarx.intellij.Resource;
import com.checkmarx.intellij.tool.window.actions.CxToolWindowAction;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import lombok.Getter;
Expand Down Expand Up @@ -45,4 +46,9 @@ public void actionPerformed(@NotNull AnActionEvent e) {
cxToolWindowPanel.resetPanel();
});
}
@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

}

0 comments on commit 4027fc0

Please sign in to comment.