From 83682006199e16011c3531ce63b4ba25ee87e7e2 Mon Sep 17 00:00:00 2001 From: yvan Date: Thu, 18 Nov 2021 20:09:58 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-62680=20=E6=8F=92=E4=BB=B6-=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E7=AE=A1=E7=90=86-=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E9=87=8C=E6=B2=A1=E6=9C=89=E9=80=82=E9=85=8D=E7=A6=81=E7=94=A8?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=20=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=87=8C=E6=B2=A1?= =?UTF-8?q?=E9=80=82=E9=85=8D=20=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D?= =?UTF-8?q?=E8=B7=AF=E3=80=911.=20=E9=80=82=E9=85=8D=E4=B8=8B=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E6=8F=90=E7=A4=BA=EF=BC=9B2.=20=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E6=8A=8Aforbid-reminder=E6=94=BE=E5=88=B0PluginView=E9=87=8C?= =?UTF-8?q?=E8=BF=98=E6=98=AF=E4=B8=8D=E5=90=88=E9=80=82=EF=BC=8C=E6=8D=A2?= =?UTF-8?q?=E6=88=90=E9=80=9A=E8=BF=87xml=E8=8E=B7=E5=8F=96=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=20=E3=80=90review=E5=BB=BA=E8=AE=AE=E3=80=91?= =?UTF-8?q?=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/extra/PluginOperateUtils.java | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java index d7260f84ee..7f68cd8bf2 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java @@ -25,6 +25,7 @@ import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.view.PluginView; +import com.fr.plugin.xml.PluginElementName; import com.fr.stable.StringUtils; import javax.swing.JOptionPane; @@ -91,15 +92,31 @@ public class PluginOperateUtils { public static void setPluginActive(String pluginInfo, JSCallback jsCallback) { - PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); - PluginContext plugin = PluginManager.getContext(pluginMarker); - boolean active = plugin.isActive(); - PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); - if (active) { - PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); - } else { - PluginManager.getController().enable(pluginMarker, modifyStatusCallback); - } + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); + PluginContext plugin = PluginManager.getContext(pluginMarker); + boolean active = plugin.isActive(); + PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); + if (active) { + // 禁用前提示 + int rv = FineJOptionPane.showConfirmDialog( + null, + plugin.getXml().getElement(PluginElementName.ForbidReminder).getContent(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE + ); + if (rv == JOptionPane.OK_OPTION) { + PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); + } + } else { + PluginManager.getController().enable(pluginMarker, modifyStatusCallback); + } + } + }); } public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) {