Browse Source

Merge pull request #43 in BA/design from ~VITO/design:dev to dev

* commit 'b79066246268df749f89fc2f2d255c671be165f7':
  1、插件检查更新 2、新窗口打开详情
master
richie 9 years ago
parent
commit
4201d6dd38
  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();
}
/**
* 已安装插件检查更新
*/
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.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) {

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