diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java index 297feaa253..c20f623f8c 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java +++ b/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 borderColorRef = new AtomicReference<>(null); @@ -497,6 +497,7 @@ public class StartupPageWorkspacePanel extends JPanel { } @Override public void mousePressed(MouseEvent e) { + pageModel.setSelectWorkspaceInfo(workspaceInfo); createNewTemplateRunnable.run(); } }); diff --git a/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java b/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java index 12e1e1f7c0..98ff33466d 100644 --- a/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java +++ b/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();