From 7184d0c4ca3cac821c0276c024acdbeb9cd74bf6 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 23 Jun 2017 17:20:19 +0800 Subject: [PATCH 1/6] =?UTF-8?q?PFC-607=20=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=88=A0=E9=99=A4=E6=9B=B4=E6=96=B0=E4=B8=8D=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E6=94=AF=E6=8C=81=20=E6=B7=BB=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E8=BE=83=E7=AE=80=E9=99=8B=E7=9A=84=E6=B2=99=E7=9B=92?= =?UTF-8?q?=E5=AE=B9=E5=99=A8=EF=BC=8C=E8=87=AA=E5=8A=A8=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=9A=84=E7=83=AD=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/exe/callback/JSCallback.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java b/designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java index a46f73b30e..c246ebfa8f 100644 --- a/designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java +++ b/designer_base/src/com/fr/design/extra/exe/callback/JSCallback.java @@ -22,7 +22,7 @@ public class JSCallback { public void init(final WebEngine webEngine, final JSObject callback){ executeScript = new JSExecutor() { @Override - public void executor(String newValue) { + public void executor(final String newValue) { Platform.runLater(new Runnable() { @Override public void run() { From 95ad5839bea3cea6b942e77adfe620f943c3ece0 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Mon, 26 Jun 2017 12:01:18 +0800 Subject: [PATCH 2/6] =?UTF-8?q?PFC-607=20=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=88=A0=E9=99=A4=E6=9B=B4=E6=96=B0=E4=B8=8D=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E6=94=AF=E6=8C=81=20=E4=BF=AE=E5=A4=8D=E4=B8=BB?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E5=BC=B9=E7=AA=97=E6=AD=BB=E9=94=81=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/extra/PluginOperateUtils.java | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java index 48b3d4b28c..00e5791a28 100644 --- a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java +++ b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java @@ -24,12 +24,16 @@ import com.fr.stable.StringUtils; import javax.swing.*; import java.io.File; import java.util.List; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; /** * Created by ibm on 2017/5/26. */ public class PluginOperateUtils { + + private static final Executor EXECUTOR = Executors.newSingleThreadExecutor(); public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) { //下载插件 @@ -88,19 +92,28 @@ public class PluginOperateUtils { PluginManager.getController().enable(pluginMarker, modifyStatusCallback); } } - - public static void uninstallPlugin(final String pluginInfo, final boolean isForce, JSCallback jsCallback) { - int rv = JOptionPane.showConfirmDialog( - null, - Inter.getLocText("FR-Designer-Plugin_Delete_Confirmed"), - Inter.getLocText("FR-Designer-Plugin_Warning"), - JOptionPane.OK_CANCEL_OPTION, - JOptionPane.INFORMATION_MESSAGE - ); - if (rv == JOptionPane.OK_OPTION) { - PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); - PluginManager.getController().uninstall(pluginMarker, isForce, new UninstallPluginCallback(pluginMarker, jsCallback)); - } + + public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) { + + EXECUTOR.execute(new Runnable() { + + @Override + public void run() { + + int rv = JOptionPane.showConfirmDialog( + null, + Inter.getLocText("FR-Designer-Plugin_Delete_Confirmed"), + Inter.getLocText("FR-Designer-Plugin_Warning"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.INFORMATION_MESSAGE + ); + if (rv == JOptionPane.OK_OPTION) { + PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); + PluginManager.getController().uninstall(pluginMarker, isForce, new UninstallPluginCallback(pluginMarker, jsCallback)); + } + } + }); + } public static void readUpdateOnline(final JSCallback jsCallback) { From 1f6ea93988e8a8a9c0585b8f31749642144a538e Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Mon, 26 Jun 2017 12:23:39 +0800 Subject: [PATCH 3/6] =?UTF-8?q?PFC-607=20=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=88=A0=E9=99=A4=E6=9B=B4=E6=96=B0=E4=B8=8D=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E6=94=AF=E6=8C=81=20=E4=BF=AE=E5=A4=8D=E4=B8=BB?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E5=BC=B9=E7=AA=97=E6=AD=BB=E9=94=81=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/extra/PluginOperateUtils.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java index 00e5791a28..434b75ff45 100644 --- a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java +++ b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java @@ -118,7 +118,7 @@ public class PluginOperateUtils { public static void readUpdateOnline(final JSCallback jsCallback) { - new Thread(new Runnable() { + EXECUTOR.execute(new Runnable() { @Override public void run() { try { @@ -135,13 +135,13 @@ public class PluginOperateUtils { FRLogger.getLogger().error(e.getMessage()); } } - }).start(); + }); } public static void searchPlugin(final String keyword, final JSCallback jsCallback) { - new Thread(new Runnable() { + EXECUTOR.execute(new Runnable() { @Override public void run() { try { @@ -159,12 +159,12 @@ public class PluginOperateUtils { FRLogger.getLogger().error(e.getMessage()); } } - }).start(); + }); } public static void getPluginFromStore(final String category, final String seller, final String fee, final JSCallback jsCallback) { - new Thread(new Runnable() { + EXECUTOR.execute(new Runnable() { @Override public void run() { String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?"; @@ -194,7 +194,7 @@ public class PluginOperateUtils { } } - }).start(); + }); } @@ -243,7 +243,7 @@ public class PluginOperateUtils { } public static void getPluginCategories(final JSCallback jsCallback) { - new Thread(new Runnable() { + EXECUTOR.execute(new Runnable() { @Override public void run() { String result; @@ -256,17 +256,17 @@ public class PluginOperateUtils { } jsCallback.execute(result); } - }).start(); + }); } public static void getPluginPrefix(final JSCallback jsCallback) { - new Thread(new Runnable() { + EXECUTOR.execute(new Runnable() { @Override public void run() { String result = SiteCenter.getInstance().acquireUrlByKind("plugin.url.prefix"); jsCallback.execute(result); } - }).start(); + }); } public static void getLoginInfo(JSCallback jsCallback) { From 266511537a06dc5b32557f9aacc9e591c7b0f2d9 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Mon, 26 Jun 2017 12:25:02 +0800 Subject: [PATCH 4/6] =?UTF-8?q?PFC-607=20=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=88=A0=E9=99=A4=E6=9B=B4=E6=96=B0=E4=B8=8D=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E6=94=AF=E6=8C=81=20=E4=BF=AE=E5=A4=8D=E4=B8=BB?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E5=BC=B9=E7=AA=97=E6=AD=BB=E9=94=81=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/extra/PluginOperateUtils.java | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java index 434b75ff45..84eb817b60 100644 --- a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java +++ b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java @@ -24,16 +24,12 @@ import com.fr.stable.StringUtils; import javax.swing.*; import java.io.File; import java.util.List; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; /** * Created by ibm on 2017/5/26. */ public class PluginOperateUtils { - - private static final Executor EXECUTOR = Executors.newSingleThreadExecutor(); public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) { //下载插件 @@ -92,14 +88,13 @@ public class PluginOperateUtils { PluginManager.getController().enable(pluginMarker, modifyStatusCallback); } } - + public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) { - - EXECUTOR.execute(new Runnable() { - + + new Thread(new Runnable() { + @Override public void run() { - int rv = JOptionPane.showConfirmDialog( null, Inter.getLocText("FR-Designer-Plugin_Delete_Confirmed"), @@ -112,13 +107,12 @@ public class PluginOperateUtils { PluginManager.getController().uninstall(pluginMarker, isForce, new UninstallPluginCallback(pluginMarker, jsCallback)); } } - }); - + }).start(); } public static void readUpdateOnline(final JSCallback jsCallback) { - - EXECUTOR.execute(new Runnable() { + + new Thread(new Runnable() { @Override public void run() { try { @@ -135,13 +129,14 @@ public class PluginOperateUtils { FRLogger.getLogger().error(e.getMessage()); } } - }); + }).start(); } public static void searchPlugin(final String keyword, final JSCallback jsCallback) { - EXECUTOR.execute(new Runnable() { + + new Thread(new Runnable() { @Override public void run() { try { @@ -159,12 +154,13 @@ public class PluginOperateUtils { FRLogger.getLogger().error(e.getMessage()); } } - }); + }).start(); } public static void getPluginFromStore(final String category, final String seller, final String fee, final JSCallback jsCallback) { - EXECUTOR.execute(new Runnable() { + + new Thread(new Runnable() { @Override public void run() { String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?"; @@ -193,8 +189,8 @@ public class PluginOperateUtils { jsCallback.execute(result); } } - - }); + + }).start(); } @@ -243,7 +239,8 @@ public class PluginOperateUtils { } public static void getPluginCategories(final JSCallback jsCallback) { - EXECUTOR.execute(new Runnable() { + + new Thread(new Runnable() { @Override public void run() { String result; @@ -256,17 +253,18 @@ public class PluginOperateUtils { } jsCallback.execute(result); } - }); + }).start(); } public static void getPluginPrefix(final JSCallback jsCallback) { - EXECUTOR.execute(new Runnable() { + + new Thread(new Runnable() { @Override public void run() { String result = SiteCenter.getInstance().acquireUrlByKind("plugin.url.prefix"); jsCallback.execute(result); } - }); + }).start(); } public static void getLoginInfo(JSCallback jsCallback) { From 6a6953fe9f2402bc488314630e5d6928d1e2f02c Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Mon, 26 Jun 2017 14:11:21 +0800 Subject: [PATCH 5/6] =?UTF-8?q?PFC-607=20=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=88=A0=E9=99=A4=E6=9B=B4=E6=96=B0=E4=B8=8D=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E6=94=AF=E6=8C=81=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/extra/PluginOperateUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java index 84eb817b60..5e73b45b2f 100644 --- a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java +++ b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java @@ -91,7 +91,7 @@ public class PluginOperateUtils { public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) { - new Thread(new Runnable() { + SwingUtilities.invokeLater(new Runnable() { @Override public void run() { @@ -107,7 +107,7 @@ public class PluginOperateUtils { PluginManager.getController().uninstall(pluginMarker, isForce, new UninstallPluginCallback(pluginMarker, jsCallback)); } } - }).start(); + }); } public static void readUpdateOnline(final JSCallback jsCallback) { From 8a10b3f7ceaac99d3907c39ed50e9f8d968aa2ce Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Mon, 26 Jun 2017 15:45:41 +0800 Subject: [PATCH 6/6] =?UTF-8?q?PFC-607=20=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=88=A0=E9=99=A4=E6=9B=B4=E6=96=B0=E4=B8=8D=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E6=94=AF=E6=8C=81=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/PluginOperateUtils.java | 6 ++++-- designer_base/src/com/fr/design/extra/PluginUtils.java | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java index 5e73b45b2f..9b661543b1 100644 --- a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java +++ b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java @@ -63,8 +63,10 @@ public class PluginOperateUtils { JSONObject latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarker.getPluginID()); String latestPluginVersion = (String) latestPluginInfo.get("version"); PluginMarker toPluginMarker = PluginMarker.create(pluginMarker.getPluginID(), latestPluginVersion); - PluginTask pluginTask = PluginTask.updateTask(pluginMarker, toPluginMarker); - PluginControllerHelper.updateOnline(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginTask, jsCallback)); + //当前已经安装的相同ID插件marker + PluginMarker currentMarker = PluginUtils.getInstalledPluginMarkerByID(pluginMarker.getPluginID()); + PluginTask pluginTask = PluginTask.updateTask(currentMarker, toPluginMarker); + PluginControllerHelper.updateOnline(currentMarker, toPluginMarker, new UpdateOnlineCallback(pluginTask, jsCallback)); } catch (Exception e) { FRContext.getLogger().error(e.getMessage(), e); } diff --git a/designer_base/src/com/fr/design/extra/PluginUtils.java b/designer_base/src/com/fr/design/extra/PluginUtils.java index 9f2c79c096..0e6ae15a15 100644 --- a/designer_base/src/com/fr/design/extra/PluginUtils.java +++ b/designer_base/src/com/fr/design/extra/PluginUtils.java @@ -11,6 +11,7 @@ import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginMarker; import com.fr.plugin.error.PluginErrorCode; +import com.fr.plugin.manage.PluginManager; import com.fr.plugin.view.PluginView; import com.fr.stable.EncodeConstants; import com.fr.stable.StableUtils; @@ -173,4 +174,13 @@ public class PluginUtils { return ERROR_CODE_I18N_PREFIX + errorCode.getDescription(); } + + public static PluginMarker getInstalledPluginMarkerByID(String pluginID) { + + PluginContext context = PluginManager.getContext(pluginID); + if (context != null) { + return context.getMarker(); + } + return null; + } }