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 2fa1ea110..1923a2287 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 7dd2097dc..379daab28 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); } } }); 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 218ee4728..0075ae076 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); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java index dcd4173e6..2f8690776 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java @@ -15,6 +15,8 @@ import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnectionInfo; import io.socket.client.IO; +import io.socket.engineio.client.transports.Polling; +import io.socket.engineio.client.transports.WebSocket; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -45,6 +47,7 @@ public abstract class AbstractSocketConfig { public IO.Options createOptions() { IO.Options options = new IO.Options(); options.path = WebSocketConfig.getInstance().getSocketContext(); + options.transports = new String[]{WebSocket.NAME, Polling.NAME};; try { if (ComparatorUtils.equals(currentProtocol, HTTPS)) { options.sslContext = getSSLContext(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/ContainerSocketConfig.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/ContainerSocketConfig.java index c36ecee5e..8f7c62666 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/ContainerSocketConfig.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/ContainerSocketConfig.java @@ -29,7 +29,6 @@ public class ContainerSocketConfig extends AbstractSocketConfig { @Override public IO.Options createOptions() { IO.Options options = super.createOptions(); - options.transports = new String[]{WebSocket.NAME, Polling.NAME}; options.path = String.format("/%s%s", FRContext.getCommonOperator().getAppName(), WebSocketConstants.WEBSOCKET_PATH); return options; }