diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index c71dc34716..c5a4a7dd2e 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -97,10 +97,7 @@ public class EnvChangeEntrance { */ public void switch2Env(final String envName) { switch2Env(envName, PopTipStrategy.LATER); - if(!VersionCheckUtils.versionCheck(envName)){ - VersionCheckMessageDialog versionCheckMessageDialog = new VersionCheckMessageDialog(DesignerContext.getDesignerFrame(),Toolkit.i18nText("Fine-Design_Basic_Sync_Check_Brief_Info"),envName); - versionCheckMessageDialog.setVisible(true); - } + VersionCheckUtils.showVersionCheckDialog(envName); } /** diff --git a/designer-base/src/main/java/com/fr/design/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/VersionCheckUtils.java index 754b8a8b18..70b95c2dc7 100644 --- a/designer-base/src/main/java/com/fr/design/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/VersionCheckUtils.java @@ -9,6 +9,8 @@ import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.RemoteWorkspace; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.env.VersionCheckMessageDialog; import com.fr.general.CloudCenter; import com.fr.general.CommonIOUtils; import com.fr.general.ComparatorUtils; @@ -45,7 +47,10 @@ import java.io.InputStream; import java.lang.reflect.Method; import java.net.ProtocolException; import java.net.URI; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -78,6 +83,13 @@ public class VersionCheckUtils { return checkLocalAndRemoteJartime(selectedEnv) && checkLocalAndRemotePlugin().size() == 0; } + public static void showVersionCheckDialog(String envName){ + if(!VersionCheckUtils.versionCheck(envName)){ + VersionCheckMessageDialog versionCheckMessageDialog = new VersionCheckMessageDialog(DesignerContext.getDesignerFrame(),Toolkit.i18nText("Fine-Design_Basic_Sync_Check_Brief_Info"),envName); + versionCheckMessageDialog.setVisible(true); + } + } + public static boolean checkLocalAndRemoteJartime(String envName) { DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName); @@ -197,14 +209,13 @@ public class VersionCheckUtils { /** * 格式化分支版本号 * - * @param branch 初始的分支版本号 + * @param buildNO 初始的分支版本号 * @return 格式化后的版本号 */ - private static String formatBranch(String branch) { - if (branch.contains("#")) { - return branch.substring(branch.lastIndexOf("-") + 1, branch.length() - 13); - } - return branch; + private static String formatBranch(String buildNO) { + Date jarDate = (new SimpleDateFormat("yyyy.MM.dd")).parse(buildNO, new ParsePosition(buildNO.indexOf("-") + 1)); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + return df.format(jarDate); } private static boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv) { @@ -361,12 +372,8 @@ public class VersionCheckUtils { bean.setDownloadLength(totalBytesRead); callBack.updateProgress(bean); } - } catch (ProtocolException e) { - UpdateException exception = new UpdateException(e.getMessage() + " downloadPluginZip Exception in network"); - FineLoggerFactory.getLogger().error(exception.getErrorMessage(), e); } catch (IOException e) { - UpdateException exception = new UpdateException(e.getMessage() + " downloadPluginZip Exception in download"); - FineLoggerFactory.getLogger().error(exception.getErrorMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } } finally { diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index 0068c6b47a..4c759822bd 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -10,9 +10,7 @@ import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.i18n.Toolkit; -import com.fr.design.mainframe.DesignerContext; import com.fr.env.TestConnectionResult; -import com.fr.env.VersionCheckMessageDialog; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; @@ -72,10 +70,7 @@ public class DesignerWorkspaceProvider extends Activator { @Override public void on(Event event, Null aNull) { try { - if(!VersionCheckUtils.versionCheck(selectEnv)){ - VersionCheckMessageDialog versionCheckMessageDialog = new VersionCheckMessageDialog(DesignerContext.getDesignerFrame(),Toolkit.i18nText("Fine-Design_Basic_Sync_Check_Brief_Info"),selectEnv.getName()); - versionCheckMessageDialog.setVisible(true); - } + VersionCheckUtils.showVersionCheckDialog(selectEnv.getName()); } catch (Exception e) { FineLoggerFactory.getLogger().warn("Check Service Failed"); }