Browse Source

REPORT-76049【迭代】【起始页】云端运维插件没有自动更新

设计器,预热过程中,不自动更新。
feature/x
Harrison 2 years ago
parent
commit
234b828b4d
  1. 2
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  2. 10
      designer-base/src/main/java/com/fr/start/common/DesignerStartupExecutor.java
  3. 15
      designer-base/src/main/java/com/fr/startup/ui/StartupPageModel.java
  4. 25
      designer-realize/src/main/java/com/fr/start/module/optimized/DesignUpdateActivator.java

2
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;

10
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<Runnable> 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;
}

15
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<String> envNameIterator = envManager.getEnvNameIterator();
List<StartupWorkspaceBean> infos = Lists.newArrayList(envNameIterator)
.stream()
@ -45,6 +48,18 @@ public class StartupPageModel {
return new StartupWorkspaceBean(e, workspaceInfo.getPath(), workspaceInfo.getType());
}
})
.sorted(new Comparator<StartupWorkspaceBean>() {
@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<String, List<String>> recentFileMap = new HashMap<>();
for (StartupWorkspaceBean info : infos) {

25
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();
}
}
}
Loading…
Cancel
Save