Browse Source

1、插件检查更新

2、新窗口打开详情
master
vito 9 years ago
parent
commit
b790662462
  1. 12
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  2. 16
      designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java
  3. 50
      designer_base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java

12
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -127,6 +127,14 @@ public class PluginWebBridge {
new Thread(task).start(); new Thread(task).start();
} }
/**
* 已安装插件检查更新
*/
public void readUpdateOnline(final JSObject callback) {
Task<Void> 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);
}
/** /**
* 从硬盘升级 * 从硬盘升级
* *

16
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.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.extra.After; import com.fr.design.extra.After;
import com.fr.design.extra.PluginHelper; import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.PluginVerifyException; import com.fr.plugin.PluginVerifyException;
@ -64,7 +64,19 @@ public class InstallOnlineExecutor implements Executor {
PluginHelper.installPluginFromDisk(PluginHelper.getDownloadTempFile(), new After() { PluginHelper.installPluginFromDisk(PluginHelper.getDownloadTempFile(), new After() {
@Override @Override
public void done() { 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) { } catch (PluginVerifyException e) {

50
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<String> 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());
}
}
}
};
}
}
Loading…
Cancel
Save