From 8634f6fa56fdab04ca176d222117ead7470fcfbd Mon Sep 17 00:00:00 2001 From: richie Date: Fri, 17 May 2019 17:20:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=B8=80=E4=B8=8BAPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/upm/UpmBridge.java | 9 +++++++-- .../src/main/resources/com/fr/design/upm/warn.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java index cff58ffc0..c17d0033f 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java @@ -62,6 +62,11 @@ public class UpmBridge { this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); } + /** + * 下载并安装插件管理中心的资源文件 + * @param callback 安装完成后的回调函数 + */ + @JSBridge public void startDownload(final JSFunction callback) { new SwingWorker(){ @@ -77,10 +82,10 @@ public class UpmBridge { protected void done() { try { get(); - callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); + callback.invoke(window, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); EventDispatcher.fire(DownloadEvent.SUCCESS, "success"); } catch (Exception e) { - callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); + callback.invoke(window, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); FineLoggerFactory.getLogger().error(e.getMessage(), e); EventDispatcher.fire(DownloadEvent.ERROR, "error"); } diff --git a/designer-base/src/main/resources/com/fr/design/upm/warn.js b/designer-base/src/main/resources/com/fr/design/upm/warn.js index 1eb5fb640..be4b06909 100644 --- a/designer-base/src/main/resources/com/fr/design/upm/warn.js +++ b/designer-base/src/main/resources/com/fr/design/upm/warn.js @@ -4,7 +4,7 @@ window.onload = function () { text: PluginHelper.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Resource_Warn"), height: 30 }); - let callback = function(text) { + let callback = function(status, text) { download.setValue(text); }; let buttonOK = BI.createWidget({