diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6516fea..8b6d547 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,11 @@
## [Unreleased]
-## 1.1.9
+## 1.2.0
### Added
### Changed
-- 修复插件新版 IDEA 崩溃的问题
+- 更新插件版本至1.2.0
+- 适配IDE2024.1
+- 修复可能导致崩溃的问题- 优化线程策略以提高性能
### Deprecated
diff --git a/gradle.properties b/gradle.properties
index cc5e763..14617b7 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -5,16 +5,13 @@ org.gradle.configuration-cache=true
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching=true
# ????
-pluginGroup = com.liuzhihang.toolkit
-pluginName = Toolkit
-pluginVersion = 1.1.9
-
-pluginSinceBuild = 203.0
-pluginUntilBuild =
-pluginDescription = parts/description.html
-
-platformType = IC
-platformVersion = 2023.2
-
+pluginGroup=com.liuzhihang.toolkit
+pluginName=Toolkit
+pluginVersion=1.2.0
+pluginSinceBuild=241
+pluginUntilBuild=
+pluginDescription=parts/description.html
+platformType=IC
+platformVersion=2024.1
# ,-Dide.browser.jcef.log.level=verbose,-Duser.language=en-US
-runIdeJvmArgs = -Dfile.encoding=utf-8
\ No newline at end of file
+runIdeJvmArgs=-Dfile.encoding=utf-8
\ No newline at end of file
diff --git a/src/main/java/com/liuzhihang/toolkit/action/CopyAsJsonAction.java b/src/main/java/com/liuzhihang/toolkit/action/CopyAsJsonAction.java
index adb8e62..9d8b28b 100644
--- a/src/main/java/com/liuzhihang/toolkit/action/CopyAsJsonAction.java
+++ b/src/main/java/com/liuzhihang/toolkit/action/CopyAsJsonAction.java
@@ -98,6 +98,13 @@ public void update(@NotNull AnActionEvent e) {
}
}
-
-
+ /**
+ * 线程类型
+ *
+ * @return ActionUpdateThread
+ */
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
}
diff --git a/src/main/java/com/liuzhihang/toolkit/action/ToolkitAction.java b/src/main/java/com/liuzhihang/toolkit/action/ToolkitAction.java
index 8b5bec0..64a0456 100644
--- a/src/main/java/com/liuzhihang/toolkit/action/ToolkitAction.java
+++ b/src/main/java/com/liuzhihang/toolkit/action/ToolkitAction.java
@@ -1,17 +1,11 @@
package com.liuzhihang.toolkit.action;
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
+import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.PsiFile;
import com.liuzhihang.toolkit.ui.ToolkitForm;
-import com.liuzhihang.toolkit.utils.CustomPsiUtils;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
/**
* 唤起操作面板
@@ -33,11 +27,17 @@ public void actionPerformed(AnActionEvent e) {
// VirtualFile actionFolder = event.getData(LangDataKeys.VIRTUAL_FILE);
- if (project == null ) {
+ if (project == null) {
return;
}
ToolkitForm.getInstance(project, editor, psiFile).popup();
}
+
+
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
}
diff --git a/src/main/java/com/liuzhihang/toolkit/ui/Base64Form.java b/src/main/java/com/liuzhihang/toolkit/ui/Base64Form.java
index 4513485..0f804a5 100644
--- a/src/main/java/com/liuzhihang/toolkit/ui/Base64Form.java
+++ b/src/main/java/com/liuzhihang/toolkit/ui/Base64Form.java
@@ -101,6 +101,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
WriteCommandAction.runWriteCommandAction(project, () -> outputDocument.setText(writer));
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
rightGroup.add(new AnAction("Decoder", "Decoder", AllIcons.Actions.ShowCode) {
@@ -109,10 +113,20 @@ public void actionPerformed(@NotNull AnActionEvent e) {
String text = inputDocument.getText().trim();
- byte[] decode = Base64.getDecoder().decode(text);
- String writer = new String(decode, StandardCharsets.UTF_8);
+ String writer;
+ try {
+ byte[] decode = Base64.getDecoder().decode(text);
+ writer = new String(decode, StandardCharsets.UTF_8);
+ } catch (Exception ex) {
+ writer = "数据错误,异常:" + ex.getMessage();
+ }
- WriteCommandAction.runWriteCommandAction(project, () -> outputDocument.setText(writer));
+ String finalWriter = writer;
+ WriteCommandAction.runWriteCommandAction(project, () -> outputDocument.setText(finalWriter));
+ }
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
}
});
@@ -128,6 +142,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
popup.cancel();
NotificationUtils.infoNotify(ToolkitBundle.message("notify.copy.success"), project);
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
rightGroup.add(new AnAction("Close", "Generate entity", AllIcons.General.InspectionsOK) {
@@ -135,6 +153,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
public void actionPerformed(@NotNull AnActionEvent e) {
popup.cancel();
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
// init toolbar
@@ -143,7 +165,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
toolbar.setTargetComponent(tailToolbarPanel);
toolbar.setForceMinimumSize(true);
- toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
+ // toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
Utils.setSmallerFontForChildren(toolbar);
tailToolbarPanel.add(toolbar.getComponent(), BorderLayout.EAST);
diff --git a/src/main/java/com/liuzhihang/toolkit/ui/CronForm.java b/src/main/java/com/liuzhihang/toolkit/ui/CronForm.java
index dd81bc8..d6100ba 100644
--- a/src/main/java/com/liuzhihang/toolkit/ui/CronForm.java
+++ b/src/main/java/com/liuzhihang/toolkit/ui/CronForm.java
@@ -152,6 +152,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
}
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
@@ -161,7 +165,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
toolbar.setTargetComponent(tailToolbarPanel);
toolbar.setForceMinimumSize(true);
- toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
+ // toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
Utils.setSmallerFontForChildren(toolbar);
tailToolbarPanel.add(toolbar.getComponent(), BorderLayout.EAST);
diff --git a/src/main/java/com/liuzhihang/toolkit/ui/EntityJsonForm.java b/src/main/java/com/liuzhihang/toolkit/ui/EntityJsonForm.java
index 7d07da6..c0e33ab 100644
--- a/src/main/java/com/liuzhihang/toolkit/ui/EntityJsonForm.java
+++ b/src/main/java/com/liuzhihang/toolkit/ui/EntityJsonForm.java
@@ -99,6 +99,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
popup.cancel();
NotificationUtils.infoNotify(ToolkitBundle.message("notify.copy.success"), project);
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
// init toolbar
@@ -107,7 +111,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
toolbar.setTargetComponent(tailToolbarPanel);
toolbar.setForceMinimumSize(true);
- toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
+ // toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
Utils.setSmallerFontForChildren(toolbar);
tailToolbarPanel.add(toolbar.getComponent(), BorderLayout.EAST);
diff --git a/src/main/java/com/liuzhihang/toolkit/ui/JsonFormatForm.java b/src/main/java/com/liuzhihang/toolkit/ui/JsonFormatForm.java
index dde4840..c7cb8a5 100644
--- a/src/main/java/com/liuzhihang/toolkit/ui/JsonFormatForm.java
+++ b/src/main/java/com/liuzhihang/toolkit/ui/JsonFormatForm.java
@@ -108,6 +108,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
WriteCommandAction.runWriteCommandAction(project, () -> jsonDocument.setText(resultText));
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
rightGroup.add(new AnAction(message("json.format.compress.text"), "", AllIcons.Actions.Collapseall) {
@@ -115,6 +119,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
public void actionPerformed(@NotNull AnActionEvent e) {
compressAction();
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
rightGroup.add(new AnAction(message("json.format.format.text"), "", AllIcons.Json.Object) {
@@ -122,6 +130,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
public void actionPerformed(@NotNull AnActionEvent e) {
formatAction();
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
rightGroup.addSeparator();
@@ -136,6 +148,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
popup.cancel();
NotificationUtils.infoNotify(message("notify.copy.success"), project);
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
rightGroup.add(new AnAction(message("json.format.next.text"), "", AllIcons.Actions.Rerun) {
@@ -144,6 +160,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
preview();
popup.cancel();
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
// init toolbar
@@ -152,7 +172,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
toolbar.setTargetComponent(tailToolbarPanel);
toolbar.setForceMinimumSize(true);
- toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
+ // toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
Utils.setSmallerFontForChildren(toolbar);
tailToolbarPanel.add(toolbar.getComponent(), BorderLayout.EAST);
diff --git a/src/main/java/com/liuzhihang/toolkit/ui/ParamPreviewForm.java b/src/main/java/com/liuzhihang/toolkit/ui/ParamPreviewForm.java
index ab50006..76ff016 100644
--- a/src/main/java/com/liuzhihang/toolkit/ui/ParamPreviewForm.java
+++ b/src/main/java/com/liuzhihang/toolkit/ui/ParamPreviewForm.java
@@ -109,6 +109,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
myIsPinned.set(true);
SettingsForm.getInstance(project).popup();
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
group.addSeparator();
@@ -129,6 +133,10 @@ public boolean isSelected(@NotNull AnActionEvent e) {
public void setSelected(@NotNull AnActionEvent e, boolean state) {
myIsPinned.set(state);
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
ActionToolbarImpl toolbar = (ActionToolbarImpl) ActionManager.getInstance()
@@ -136,7 +144,6 @@ public void setSelected(@NotNull AnActionEvent e, boolean state) {
toolbar.setTargetComponent(headToolbarPanel);
toolbar.setForceMinimumSize(true);
- toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
Utils.setSmallerFontForChildren(toolbar);
headToolbarPanel.add(toolbar.getComponent(), BorderLayout.EAST);
@@ -214,6 +221,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
popup.cancel();
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
// init toolbar
@@ -222,7 +233,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
toolbar.setTargetComponent(tailToolbarPanel);
toolbar.setForceMinimumSize(true);
- toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
+ // toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
Utils.setSmallerFontForChildren(toolbar);
tailToolbarPanel.add(toolbar.getComponent(), BorderLayout.EAST);
diff --git a/src/main/java/com/liuzhihang/toolkit/ui/SettingsForm.java b/src/main/java/com/liuzhihang/toolkit/ui/SettingsForm.java
index 2ae8bc4..c0601be 100644
--- a/src/main/java/com/liuzhihang/toolkit/ui/SettingsForm.java
+++ b/src/main/java/com/liuzhihang/toolkit/ui/SettingsForm.java
@@ -175,6 +175,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
// 关闭
popup.cancel();
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
rightGroup.add(new AnAction(message("common.confirm"), "", AllIcons.Actions.Commit) {
@@ -184,6 +188,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
apply();
popup.cancel();
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
// init toolbar
@@ -192,7 +200,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
toolbar.setTargetComponent(tailToolbarPanel);
toolbar.setForceMinimumSize(true);
- toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
+// toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
Utils.setSmallerFontForChildren(toolbar);
tailToolbarPanel.add(toolbar.getComponent(), BorderLayout.EAST);
diff --git a/src/main/java/com/liuzhihang/toolkit/ui/ToolkitForm.java b/src/main/java/com/liuzhihang/toolkit/ui/ToolkitForm.java
index 6423b03..653d229 100644
--- a/src/main/java/com/liuzhihang/toolkit/ui/ToolkitForm.java
+++ b/src/main/java/com/liuzhihang/toolkit/ui/ToolkitForm.java
@@ -130,6 +130,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
myIsPinned.set(true);
SettingsForm.getInstance(project).popup();
}
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
group.addSeparator();
@@ -150,6 +154,11 @@ public boolean isSelected(@NotNull AnActionEvent e) {
public void setSelected(@NotNull AnActionEvent e, boolean state) {
myIsPinned.set(state);
}
+
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
ActionToolbarImpl toolbar = (ActionToolbarImpl) ActionManager.getInstance()
@@ -157,7 +166,7 @@ public void setSelected(@NotNull AnActionEvent e, boolean state) {
toolbar.setTargetComponent(headToolbarPanel);
toolbar.setForceMinimumSize(true);
- toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
+ // toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
Utils.setSmallerFontForChildren(toolbar);
headToolbarPanel.add(toolbar.getComponent(), BorderLayout.EAST);
diff --git a/src/main/java/com/liuzhihang/toolkit/ui/UrlForm.java b/src/main/java/com/liuzhihang/toolkit/ui/UrlForm.java
index 91a0ad8..0c586c5 100644
--- a/src/main/java/com/liuzhihang/toolkit/ui/UrlForm.java
+++ b/src/main/java/com/liuzhihang/toolkit/ui/UrlForm.java
@@ -126,6 +126,11 @@ public void actionPerformed(@NotNull AnActionEvent e) {
popup.cancel();
NotificationUtils.infoNotify(ToolkitBundle.message("notify.copy.success"), project);
}
+
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
rightGroup.add(new AnAction("Close", "Generate entity", AllIcons.General.InspectionsOK) {
@@ -133,6 +138,11 @@ public void actionPerformed(@NotNull AnActionEvent e) {
public void actionPerformed(@NotNull AnActionEvent e) {
popup.cancel();
}
+
+ @Override
+ public @NotNull ActionUpdateThread getActionUpdateThread() {
+ return ActionUpdateThread.BGT;
+ }
});
// init toolbar
@@ -141,7 +151,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
toolbar.setTargetComponent(tailToolbarPanel);
toolbar.setForceMinimumSize(true);
- toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
+// toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
Utils.setSmallerFontForChildren(toolbar);
tailToolbarPanel.add(toolbar.getComponent(), BorderLayout.EAST);
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
index 3dcf7e2..6ee5318 100644
--- a/src/main/resources/META-INF/plugin.xml
+++ b/src/main/resources/META-INF/plugin.xml
@@ -9,9 +9,6 @@
on how to target different products -->
com.intellij.modules.java
-
-
-