From 234b828b4d2d05d77bbac6791ea27851c15f4841 Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 11 Aug 2022 15:12:41 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-76049=E3=80=90=E8=BF=AD=E4=BB=A3?= =?UTF-8?q?=E3=80=91=E3=80=90=E8=B5=B7=E5=A7=8B=E9=A1=B5=E3=80=91=E4=BA=91?= =?UTF-8?q?=E7=AB=AF=E8=BF=90=E7=BB=B4=E6=8F=92=E4=BB=B6=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=EF=BC=8C=E9=A2=84=E7=83=AD=E8=BF=87=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 2 +- .../start/common/DesignerStartupExecutor.java | 10 -------- .../com/fr/startup/ui/StartupPageModel.java | 15 +++++++++++ .../optimized/DesignUpdateActivator.java | 25 +++++++++++++++++++ 4 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 designer-realize/src/main/java/com/fr/start/module/optimized/DesignUpdateActivator.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index ec6a982485..dfd2a20cd0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -696,7 +696,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta username = connection == null ? StringUtils.EMPTY : connection.getUserName(); } defaultTitleSB.append(username).append("@").append(envName).append("[").append(workspace.getDescription()).append("]"); - if (editingTemplate != null) { + if (JTemplate.isValid(editingTemplate)) { String path = editingTemplate.getPath(); if (!editingTemplate.getEditingFILE().exists()) { path = FILEFactory.MEM_PREFIX + path; diff --git a/designer-base/src/main/java/com/fr/start/common/DesignerStartupExecutor.java b/designer-base/src/main/java/com/fr/start/common/DesignerStartupExecutor.java index 1a033e8cd2..b4358f047b 100644 --- a/designer-base/src/main/java/com/fr/start/common/DesignerStartupExecutor.java +++ b/designer-base/src/main/java/com/fr/start/common/DesignerStartupExecutor.java @@ -1,15 +1,10 @@ package com.fr.start.common; -import java.util.ArrayList; -import java.util.List; - /** * created by Harrison on 2022/07/03 **/ public class DesignerStartupExecutor { - private List warmupTasks = new ArrayList<>(); - public void execute(Runnable runnable) { if (!DesignerStartupContext.getInstance().onWarmup()) { @@ -17,11 +12,6 @@ public class DesignerStartupExecutor { } } - public void reset() { - - warmupTasks.clear(); - } - public static DesignerStartupExecutor getInstance() { return DesignerStartupExecutorHolder.INSTANCE; } diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageModel.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageModel.java index 4b82545a01..0f71e4932b 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageModel.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageModel.java @@ -3,10 +3,12 @@ package com.fr.startup.ui; import com.fr.design.DesignerEnvManager; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; +import com.fr.stable.StringUtils; import com.fr.third.guava.collect.Lists; import com.fr.workspace.connect.WorkspaceConnectionInfo; import java.util.ArrayList; +import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -33,6 +35,7 @@ public class StartupPageModel { public static StartupPageModel create() { DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); + String curEnvName = envManager.getCurEnvName(); Iterator envNameIterator = envManager.getEnvNameIterator(); List infos = Lists.newArrayList(envNameIterator) .stream() @@ -45,6 +48,18 @@ public class StartupPageModel { return new StartupWorkspaceBean(e, workspaceInfo.getPath(), workspaceInfo.getType()); } }) + .sorted(new Comparator() { + @Override + public int compare(StartupWorkspaceBean o1, StartupWorkspaceBean o2) { + if (StringUtils.equals(curEnvName, o1.getName())) { + return -1; + } + if (StringUtils.equals(curEnvName, o2.getName())) { + return 1; + } + return 0; + } + }) .collect(Collectors.toList()); Map> recentFileMap = new HashMap<>(); for (StartupWorkspaceBean info : infos) { diff --git a/designer-realize/src/main/java/com/fr/start/module/optimized/DesignUpdateActivator.java b/designer-realize/src/main/java/com/fr/start/module/optimized/DesignUpdateActivator.java new file mode 100644 index 0000000000..b6ad5ce2a6 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/start/module/optimized/DesignUpdateActivator.java @@ -0,0 +1,25 @@ +package com.fr.start.module.optimized; + +import com.fr.start.common.DesignerStartupContext; +import com.fr.update.activator.BasicUpdateActivator; +import com.fr.update.base.FineUpdateUnit; + +/** + * created by Harrison on 2022/08/11 + **/ +public class DesignUpdateActivator extends BasicUpdateActivator { + + @Override + public void start() { + + if (DesignerStartupContext.getInstance().onWarmup()) { + try { + prepare4Start(); + FineUpdateUnit.makeNew(); + } catch (Throwable ignore) { + } + } else { + super.start(); + } + } +}