Browse Source

REPORT-76057【迭代】【起始页】进入的一直都是默认工作目录

进入工作目录前,先将环境准备好
feature/x
Harrison 2 years ago
parent
commit
85e779da5e
  1. 7
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java
  2. 12
      designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java

7
designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java

@ -223,7 +223,7 @@ public class StartupPageWorkspacePanel extends JPanel {
layoutSelectWorkspacePanel(workspaceInfo, workspaceItemDesc);
layoutSelectAndCreatePanel(workspaceItemDesc);
layoutSelectAndCreatePanel(workspaceInfo, workspaceItemDesc);
partitionPanel.add(workspaceItemDesc);
@ -378,7 +378,7 @@ public class StartupPageWorkspacePanel extends JPanel {
public void mousePressed(MouseEvent e) {
int clickCount = e.getClickCount();
if (clickCount == BORDER_THIN) {
if (clickCount == 2) {
pageModel.setSelectWorkspaceInfo(workspaceInfo);
openEmptyTemplateRunnable.run();
return;
@ -426,7 +426,7 @@ public class StartupPageWorkspacePanel extends JPanel {
workspaceItemDesc.add(selectWorkspacePanel, BorderLayout.WEST);
}
private void layoutSelectAndCreatePanel(JPanel workspaceItemDesc) {
private void layoutSelectAndCreatePanel(StartupWorkspaceBean workspaceInfo, JPanel workspaceItemDesc) {
// 选择并新建
AtomicReference<Color> borderColorRef = new AtomicReference<>(null);
@ -497,6 +497,7 @@ public class StartupPageWorkspacePanel extends JPanel {
}
@Override
public void mousePressed(MouseEvent e) {
pageModel.setSelectWorkspaceInfo(workspaceInfo);
createNewTemplateRunnable.run();
}
});

12
designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java

@ -1,5 +1,6 @@
package com.fr.start.module.optimized;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ui.util.UIUtil;
import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator;
@ -10,6 +11,7 @@ import com.fr.start.util.DesignerStartupPageUtil;
import com.fr.start.warmup.DesignerPreWarmTask;
import com.fr.startup.ui.StartupPageModel;
import com.fr.startup.ui.StartupPageWindow;
import com.fr.startup.ui.StartupWorkspaceBean;
import com.fr.third.org.apache.commons.lang3.time.StopWatch;
import com.fr.value.NotNullLazyValue;
import org.jetbrains.annotations.NotNull;
@ -66,18 +68,21 @@ public class DesignerStartupPageActivator extends Activator {
// selectAndOpenLast
model.setOpenLastTemplateRunnable(() -> {
context.setOpenLastFile(true);
handleModel(model);
launchAfterWarmup(warmTask);
});
// selectAndOpenEmpty
model.setOpenEmptyTemplateRunnable(() -> {
context.setOpenEmpty(true);
handleModel(model);
launchAfterWarmup(warmTask);
});
// selectAndCreateNew
model.setCreateNewTemplateRunnable(() -> {
context.setCreateNew(true);
handleModel(model);
launchAfterWarmup(warmTask);
});
@ -87,6 +92,13 @@ public class DesignerStartupPageActivator extends Activator {
});
}
private void handleModel(StartupPageModel model) {
// 将选中的环境设置为当前环境
StartupWorkspaceBean selectWorkspaceInfo = model.getSelectWorkspaceInfo();
DesignerEnvManager.getEnvManager().setCurEnvName(selectWorkspaceInfo.getName());
}
private void launchAfterWarmup(DesignerPreWarmTask warmTask) {
StopWatch stopWatch = StopWatch.createStarted();

Loading…
Cancel
Save