From 60881a6bc5414cfca5df2f9b5a8f03208d1c205b Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 21 Jul 2021 14:08:49 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-55509=20&=20REPORT-54844=20=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E7=81=B0=E5=8C=96=E5=92=8C=E5=BC=B9=E6=A1=86=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../versioncheck/VersionCheckUtils.java | 30 ++++++++++++------- .../java/com/fr/env/CheckServiceDialog.java | 26 +++++++++++----- 2 files changed, 39 insertions(+), 17 deletions(-) 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 c8fe8e8ad..24431cd95 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 @@ -26,6 +26,8 @@ import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.ProgressCallback; import com.fr.report.ReportHelper; +import com.fr.rpc.ExceptionHandler; +import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.rpc.Result; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; @@ -35,6 +37,7 @@ import com.fr.workspace.engine.base.FineObjectPool; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import com.fr.workspace.engine.exception.WorkspaceConnectionException; import com.fr.workspace.engine.rpc.WorkspaceProxyPool; +import com.fr.workspace.server.check.VersionInfoOperator; import java.lang.reflect.Method; import java.text.ParsePosition; import java.text.SimpleDateFormat; @@ -160,15 +163,22 @@ public class VersionCheckUtils { } public static String getRemoteBranch(DesignerWorkspaceInfo selectedEnv) { - String remoteBranch = StringUtils.EMPTY; - WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection(); - try { - remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch(); - } catch (WorkspaceConnectionException e) { - remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(GeneralUtils.readFullBuildNO()); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + String remoteBranch; + remoteBranch = WorkContext.getCurrent().get(VersionInfoOperator.class, new ExceptionHandler() { + @Override + public String callHandler(RPCInvokerExceptionInfo exceptionInfo) { + WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection(); + String remoteBranch = StringUtils.EMPTY; + try { + remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch(); + } catch (WorkspaceConnectionException e) { + remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(GeneralUtils.readFullBuildNO()); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return remoteBranch; + } + }).getFullBuildNO(); return remoteBranch; } @@ -252,7 +262,7 @@ public class VersionCheckUtils { Map pluginsNameMap = ReportHelper.getPluginNameMap(); for (int i = 0; i < remotePlugins.size(); i++) { remotePlugin = remotePlugins.getJSONObject(i); - if (ComparatorUtils.equals(remotePlugin.getString("running"), "false")) { + if (ComparatorUtils.equals(remotePlugin.getString("running"), "false") || (remotePlugin.containsKey("sync") && !remotePlugin.getBoolean("sync"))) { continue; } String remotePluginID = remotePlugin.getString(ID); 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 26cd7da73..a921a0322 100644 --- a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java +++ b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java @@ -36,6 +36,8 @@ import java.awt.Component; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.io.File; import java.util.List; import javax.swing.BorderFactory; @@ -172,7 +174,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener { ignoreButton.addActionListener(this); syncButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_To_Local")); syncButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Sync_To_Local_Tip")); - syncButton.addMouseListener(syncButtonClickListener); + syncButton.addActionListener(syncButtonActionListener); if(jarConsistency && differentPlugins.isEmpty()){ syncButton.setEnabled(false); } @@ -186,8 +188,10 @@ public class CheckServiceDialog extends JDialog implements ActionListener { buttonPanel.add(progressBar, BorderLayout.CENTER); buttonPanel.add(syncButton, BorderLayout.EAST); } else { - UILabel adviceLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Sync_Suggestion")); - centerPanel.add(adviceLabel, BorderLayout.SOUTH); + if (!(jarConsistency && differentPlugins.isEmpty())) { + UILabel adviceLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Sync_Suggestion")); + centerPanel.add(adviceLabel, BorderLayout.SOUTH); + } UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Button_Confirm")); okButton.addActionListener(this); buttonPanel.add(okButton, BorderLayout.EAST); @@ -198,6 +202,12 @@ public class CheckServiceDialog extends JDialog implements ActionListener { this.add(centerPanel, BorderLayout.CENTER); this.add(buttonPanel, BorderLayout.SOUTH); this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US) ? 750 : 600, 500)); + this.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + close(); + } + }); GUICoreUtils.centerWindow(this); } @@ -308,10 +318,10 @@ public class CheckServiceDialog extends JDialog implements ActionListener { } }; - private MouseListener syncButtonClickListener = new MouseAdapter() { + private ActionListener syncButtonActionListener = new ActionListener() { @Override - public void mouseClicked(MouseEvent e) { - sync(); + public void actionPerformed(ActionEvent e) { + sync(); } }; @@ -352,6 +362,9 @@ public class CheckServiceDialog extends JDialog implements ActionListener { helper.restartForUpdate(frame); } }.execute(); + } else { + ignoreButton.setEnabled(true); + syncButton.setEnabled(true); } } else { //到这边说明主jar是一致的,就只尝试同步插件 @@ -389,7 +402,6 @@ public class CheckServiceDialog extends JDialog implements ActionListener { } } - private boolean deletePreviousPropertyFile() { File moveFile = new File(RestartHelper.MOVE_FILE); File delFile = new File(RestartHelper.RECORD_FILE);