diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index 65ef0c56d..90fcd2af0 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java @@ -127,6 +127,14 @@ public class PluginWebBridge { new Thread(task).start(); } + /** + * 已安装插件检查更新 + */ + public void readUpdateOnline(final JSObject callback) { + Task task = new PluginTask<>(webEngine, callback, new ReadUpdateOnlineExecutor()); + new Thread(task).start(); + } + /** * 选择文件对话框 * @@ -281,6 +289,10 @@ public class PluginWebBridge { } } + public void openUrlAtLocalWebBrowser(String url) { + openUrlAtLocalWebBrowser(webEngine, url); + } + /** * 从硬盘升级 * diff --git a/designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java b/designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java index bd3711bd6..d343ec590 100644 --- a/designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java +++ b/designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java @@ -2,9 +2,9 @@ package com.fr.design.extra.exe; import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; +import com.fr.design.RestartHelper; import com.fr.design.extra.After; import com.fr.design.extra.PluginHelper; -import com.fr.design.extra.PluginWebBridge; import com.fr.design.extra.Process; import com.fr.general.Inter; import com.fr.plugin.PluginVerifyException; @@ -64,7 +64,19 @@ public class InstallOnlineExecutor implements Executor { PluginHelper.installPluginFromDisk(PluginHelper.getDownloadTempFile(), new After() { @Override public void done() { - PluginWebBridge.getHelper().showRestartMessage(Inter.getLocText("FR-Designer-Plugin_Update_Successful")); + int rv = JOptionPane.showOptionDialog( + null, + Inter.getLocText("FR-Designer-Plugin_Install_Successful"), + Inter.getLocText("FR-Designer-Plugin_Warning"), + JOptionPane.YES_NO_OPTION, + JOptionPane.INFORMATION_MESSAGE, + null, + new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")}, + null + ); + if (rv == JOptionPane.OK_OPTION) { + RestartHelper.restart(); + } } }); } catch (PluginVerifyException e) { diff --git a/designer_base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java b/designer_base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java new file mode 100644 index 000000000..8120049e1 --- /dev/null +++ b/designer_base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java @@ -0,0 +1,50 @@ +package com.fr.design.extra.exe; + +import com.fr.design.extra.PluginsReaderFromStore; +import com.fr.design.extra.Process; +import com.fr.general.FRLogger; +import com.fr.plugin.Plugin; +import com.fr.stable.StringUtils; + +/** + * Created by vito on 16/4/19. + */ +public class ReadUpdateOnlineExecutor implements Executor { + private Plugin[] plugins; + private String result; + + @Override + public String getTaskFinishMessage() { + return result; + } + + @Override + public Command[] getCommands() { + return new Command[]{ + new Command() { + @Override + public String getExecuteMessage() { + return StringUtils.EMPTY; + } + + @Override + public void run(Process process) { + try { + plugins = PluginsReaderFromStore.readPluginsForUpdate(); + StringBuilder sb = new StringBuilder(); + if (plugins != null) { + sb.append("["); + for (Plugin plugin : plugins) { + sb.append("{pluginid:'").append(plugin.getId()).append("'}"); + } + sb.append("]"); + } + result = sb.toString(); + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage()); + } + } + } + }; + } +}