From 24f4a68ecaf4b7be2fef995f690f31eeb2a9e004 Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 9 Jun 2021 19:12:28 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-53651=20=E8=BF=9C=E7=A8=8B=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E6=A3=80=E6=B5=8B=E5=8F=8A=E5=90=8C=E6=AD=A5-?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=90=8C=E6=AD=A5=E6=88=90=E5=8A=9F=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=B2=A1=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=87=8D=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../update/actions/SyncFileProcess.java | 17 ++++++++------ .../versioncheck/VersionCheckUtils.java | 5 +++-- .../java/com/fr/env/CheckServiceDialog.java | 8 +++---- .../com/fr/env/SyncFailedPluginsDialog.java | 22 +++++++++++++------ 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/update/actions/SyncFileProcess.java b/designer-base/src/main/java/com/fr/design/update/actions/SyncFileProcess.java index ea2db1398..b4a1b4907 100644 --- a/designer-base/src/main/java/com/fr/design/update/actions/SyncFileProcess.java +++ b/designer-base/src/main/java/com/fr/design/update/actions/SyncFileProcess.java @@ -5,6 +5,7 @@ import com.fr.decision.update.info.UpdateCallBack; import com.fr.decision.update.info.UpdateProgressCallBack; import com.fr.design.i18n.Toolkit; import com.fr.design.versioncheck.VersionCheckUtils; +import com.fr.json.JSONArray; import com.fr.log.FineLoggerFactory; import java.util.concurrent.ExecutionException; import javax.swing.JProgressBar; @@ -13,6 +14,7 @@ import javax.swing.SwingWorker; public abstract class SyncFileProcess extends SwingWorker { private String buildNo; private JProgressBar bar; + private JSONArray syncFailedPlugins; public SyncFileProcess(JProgressBar bar, String buildNo) { this.bar = bar; @@ -22,13 +24,10 @@ public abstract class SyncFileProcess extends SwingWorker { @Override protected Boolean doInBackground() throws Exception { UpdateCallBack callBack = new UpdateProgressCallBack(bar); - boolean result = SyncExecutor.getInstance().execute(callBack, buildNo); - if (result) { - bar.setValue(0); - bar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins")); - VersionCheckUtils.syncPlugins(VersionCheckUtils.checkLocalAndRemotePlugin()); - } - return result; + bar.setValue(0); + bar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins")); + syncFailedPlugins = VersionCheckUtils.syncPlugins(VersionCheckUtils.checkLocalAndRemotePlugin()); + return SyncExecutor.getInstance().execute(callBack, buildNo); } @Override @@ -49,6 +48,10 @@ public abstract class SyncFileProcess extends SwingWorker { } } + public JSONArray getSyncFailedPlugins(){ + return syncFailedPlugins; + } + /** * 下载成功 */ diff --git a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java index 11780409a..46622c44d 100644 --- a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java @@ -243,10 +243,11 @@ public class VersionCheckUtils { return differentPlugins; } - public static void syncPlugins(JSONArray differentPlugins) { + public static JSONArray syncPlugins(JSONArray differentPlugins) { Set uninstallFailed = uninstallPlugins(differentPlugins); List plugins = getSyncPlugins(differentPlugins, uninstallFailed); installPlugins(plugins); + return getPluginsSyncFailed(differentPlugins); } private static List getSyncPlugins(JSONArray differentPlugins, Set uninstallFailed) { @@ -302,7 +303,7 @@ public class VersionCheckUtils { return uninstallFailedID; } - public static JSONArray getPluginsSyncFailed(JSONArray differentPlugins){ + private static JSONArray getPluginsSyncFailed(JSONArray differentPlugins){ JSONArray pluginsNeedSync = JSONArray.create(); List localPlugins = PluginManager.getContexts(); Map localPluginsInfo = new HashMap<>(); diff --git a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java index 7e9e74ebc..222a9a2a5 100644 --- a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java +++ b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java @@ -322,14 +322,15 @@ public class CheckServiceDialog extends JDialog implements ActionListener { final JFrame frame = DesignerContext.getDesignerFrame(); final RestartHelper helper = new RestartHelper(); FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); + SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(DesignerContext.getDesignerFrame(),JSONArray.create()); new SyncFileProcess(progressBar, remoteBuildNo) { @Override public void onDownloadSuccess() { deleteForDesignerUpdate(installLib); progressBar.setVisible(false); - JSONArray syncFailedPlugins = VersionCheckUtils.getPluginsSyncFailed(differentPlugins); + JSONArray syncFailedPlugins = getSyncFailedPlugins(); if (syncFailedPlugins.size() > 0) { - SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(DesignerContext.getDesignerFrame(), syncFailedPlugins); + syncFailedPluginsDialog.showSyncFailedPluginsInfo(syncFailedPlugins); syncFailedPluginsDialog.setVisible(true); } helper.restartForUpdate(frame); @@ -352,8 +353,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener { protected JSONArray doInBackground() { progressBar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins")); progressBar.setValue(0); - VersionCheckUtils.syncPlugins(differentPlugins); - return VersionCheckUtils.getPluginsSyncFailed(differentPlugins); + return VersionCheckUtils.syncPlugins(differentPlugins); } @Override diff --git a/designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java b/designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java index 9bf63460d..0a9faab55 100644 --- a/designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java +++ b/designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java @@ -38,6 +38,7 @@ import javax.swing.UIManager; public class SyncFailedPluginsDialog extends JDialog { private UILabel detailsLabel; private JScrollPane scrollPane; + private UITextArea detailsTextArea; public SyncFailedPluginsDialog(Frame parent, JSONArray syncFailedPlugins) { super(parent, true); JPanel body = FRGUIPaneFactory.createBorderLayout_L_Pane(); @@ -70,14 +71,9 @@ public class SyncFailedPluginsDialog extends JDialog { detailsTitlePanel.add(detailsLabel); detailsTitlePanel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); - UITextArea detailsTextArea = new UITextArea(); - StringBuilder detailsText = new StringBuilder(StringUtils.EMPTY); - for (int i = 0; i < syncFailedPlugins.size(); i++) { - JSONObject plugin = syncFailedPlugins.getJSONObject(i); - detailsText.append(plugin.getString("name")).append(",").append(Toolkit.i18nText("Fine-Design_Basic_Sync_Server_Version")).append(plugin.getString("version")).append("\n"); - } - detailsTextArea.setText(detailsText.toString()); + detailsTextArea = new UITextArea(); detailsTextArea.setEditable(false); + showSyncFailedPluginsInfo(syncFailedPlugins); scrollPane = new JScrollPane(detailsTextArea); centerPanel.add(detailsTitlePanel,BorderLayout.NORTH); centerPanel.add(scrollPane,BorderLayout.CENTER); @@ -98,6 +94,18 @@ public class SyncFailedPluginsDialog extends JDialog { GUICoreUtils.centerWindow(this); } + public void showSyncFailedPluginsInfo(JSONArray syncFailedPlugins){ + if(null == syncFailedPlugins){ + return; + } + StringBuilder detailsText = new StringBuilder(StringUtils.EMPTY); + for (int i = 0; i < syncFailedPlugins.size(); i++) { + JSONObject plugin = syncFailedPlugins.getJSONObject(i); + detailsText.append(plugin.getString("name")).append(",").append(Toolkit.i18nText("Fine-Design_Basic_Sync_Server_Version")).append(plugin.getString("version")).append("\n"); + } + detailsTextArea.setText(detailsText.toString()); + } + private MouseListener detailsLabelClickListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) {