From cbdbc9d5d06f4bcc31f8679eba2d8854f17096d5 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 10 Dec 2021 11:25:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?KERNEL-9860=20=E6=8F=92=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9xml=E4=B8=ADactive=E6=A0=87=E7=AD=BE=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E9=87=8D=E6=9E=84=20=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0=E3=80=91rt=20=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D?= =?UTF-8?q?=E8=B7=AF=E3=80=91=E8=AF=A6=E8=A7=81https://kms.fineres.com/pag?= =?UTF-8?q?es/viewpage.action=3FpageId=3D289590798=20=E3=80=90review?= =?UTF-8?q?=E5=BB=BA=E8=AE=AE=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/extra/PluginInstalledPane.java | 29 ++++++++++++++----- .../fr/design/extra/PluginOperateUtils.java | 12 ++++---- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginInstalledPane.java b/designer-base/src/main/java/com/fr/design/extra/PluginInstalledPane.java index 2fa1ea1102..1923a22876 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginInstalledPane.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginInstalledPane.java @@ -60,11 +60,14 @@ public class PluginInstalledPane extends PluginAbstractViewPane { public void actionPerformed(ActionEvent e) { PluginView plugin = controlPane.getSelectedPlugin(); if (plugin != null) { - boolean isActive = plugin.isActive(); - PluginMarker pluginMarker = PluginMarker.create(plugin.getID(), plugin.getVersion()); - final String modifyMessage = isActive ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Actived") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled"); - if (isActive) { - PluginManager.getController().forbid(pluginMarker, new PluginTaskCallback() { + PluginContext pluginContext = getPluginContextByView(plugin); + if (pluginContext == null) { + return; + } + boolean running = pluginContext.isRunning(); + final String modifyMessage = running ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Actived") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled"); + if (running) { + PluginManager.getController().forbidPersistently(pluginContext.getMarker(), new PluginTaskCallback() { @Override public void done(PluginTaskResult result) { if (result.isSuccess()) { @@ -75,7 +78,7 @@ public class PluginInstalledPane extends PluginAbstractViewPane { } }); } else { - PluginManager.getController().enable(pluginMarker, new PluginTaskCallback() { + PluginManager.getController().enablePersistently(pluginContext.getMarker(), new PluginTaskCallback() { @Override public void done(PluginTaskResult result) { if (result.isSuccess()) { @@ -145,13 +148,25 @@ public class PluginInstalledPane extends PluginAbstractViewPane { } private void changeTextForButton(PluginView plugin) { - if (plugin.isActive()) { + PluginContext pluginContext = getPluginContextByView(plugin); + if (pluginContext == null) { + return; + } + if (pluginContext.isRunning()) { disableButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Disable")); } else { disableButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Active")); } } + private PluginContext getPluginContextByView(PluginView pluginView) { + if (pluginView != null) { + PluginMarker pluginMarker = PluginMarker.create(pluginView.getID(), pluginView.getVersion()); + return PluginManager.getContext(pluginMarker); + } + return null; + } + @Override protected String title4PopupWindow() { return "Installed"; 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 7dd2097dc7..379daab28e 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 @@ -99,9 +99,9 @@ public class PluginOperateUtils { 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) { + boolean isRunning = plugin.isRunning(); + PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(isRunning, jsCallback); + if (isRunning) { PluginXmlElement forbidReminder = plugin.getXml().getElement(PluginElementName.ForbidReminder); if (forbidReminder != null && forbidReminder.getContent() != null) { // 禁用前提示 @@ -113,14 +113,14 @@ public class PluginOperateUtils { JOptionPane.WARNING_MESSAGE ); if (rv == JOptionPane.OK_OPTION) { - PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); + PluginManager.getController().forbidPersistently(pluginMarker, modifyStatusCallback); } } else { // 正常禁用 - PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); + PluginManager.getController().forbidPersistently(pluginMarker, modifyStatusCallback); } } else { - PluginManager.getController().enable(pluginMarker, modifyStatusCallback); + PluginManager.getController().enablePersistently(pluginMarker, modifyStatusCallback); } } }); From b6d38f7f2eab0689ddcca04ad722bfc40841574c Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 10 Dec 2021 16:05:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?KERNEL-9860=20=E6=8F=92=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9xml=E4=B8=ADactive=E6=A0=87=E7=AD=BE=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E9=87=8D=E6=9E=84=20=E8=B7=9Fvito=E8=AE=A8=E8=AE=BA=E4=BA=86?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E5=86=B3=E5=AE=9A=E6=A8=A1=E6=9D=BF=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E7=9A=84=E4=B8=80=E9=94=AE=E5=A4=84=E7=90=86=E8=BF=99?= =?UTF-8?q?=E5=84=BF=EF=BC=8C=E4=B9=9F=E6=98=AF=E9=9C=80=E8=A6=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9xml=E7=9A=84=EF=BC=8C=E5=9B=A0=E4=B8=BA=E4=B9=9F?= =?UTF-8?q?=E6=98=AF=E7=94=A8=E6=88=B7=E8=87=AA=E5=B7=B1=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/app/DesignerAppUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java index 218ee4728a..0075ae0765 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java @@ -220,7 +220,7 @@ public class DesignerAppUtils { Multimap stringPluginMarkerAdapterMultimap = popPluginInfoMap(key); Collection disablePlugins = stringPluginMarkerAdapterMultimap.get(TemplateIOErrorContextHolder.DISABLE_PLUGIN); for (PluginMarkerAdapter disablePlugin : disablePlugins) { - PluginManager.getController().enable(disablePlugin, new ModifyStatusCallback(false)); + PluginManager.getController().enablePersistently(disablePlugin, new ModifyStatusCallback(false)); } Collection uninstallPlugins = stringPluginMarkerAdapterMultimap.get(TemplateIOErrorContextHolder.NOT_INSTALLED_PLUGIN);