diff --git a/designer-base/src/main/java/com/fr/design/deeplink/DeepLinkCore.java b/designer-base/src/main/java/com/fr/design/deeplink/DeepLinkCore.java index 55a45709bf..8fed6e80dd 100644 --- a/designer-base/src/main/java/com/fr/design/deeplink/DeepLinkCore.java +++ b/designer-base/src/main/java/com/fr/design/deeplink/DeepLinkCore.java @@ -10,6 +10,7 @@ import com.fr.event.Null; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.stable.os.OperatingSystem; +import com.fr.start.common.DesignerStartupContext; import com.fr.third.org.apache.http.NameValuePair; import com.fr.web.URLUtils; @@ -131,7 +132,19 @@ public class DeepLinkCore { } private boolean canConsumePendingURL() { - return StringUtils.isNotEmpty(this.pendingURL) && isDesignerStartupCompleted; + return StringUtils.isNotEmpty(this.pendingURL) && isAvailableConsumingTime(); + } + + /** + * 是否是可用的消耗时机 + * 满足任一即可 + * 1-设计器已经启动 + * 2-出在设计器启动页页面 + * + * @return 是/否 + */ + private boolean isAvailableConsumingTime() { + return isDesignerStartupCompleted || DesignerStartupContext.getInstance().isOnWaiting(); } private void consumePendingURL() { diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 68cb616e17..7dadc636f1 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -35,6 +35,7 @@ import com.fr.start.common.DesignerStartupContext; import com.fr.start.common.DesignerStartupUtil; import com.fr.start.event.LazyStartupEvent; import com.fr.workspace.base.WorkspaceStatus; +import org.jetbrains.annotations.Nullable; import java.awt.Window; import java.lang.reflect.Method; @@ -126,7 +127,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { if (args != null && args.length > 0) { file = DesignerStartupUtil.convertArgs2FILE(args); } else { - file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX + DesignerEnvManager.getEnvManager().getLastOpenFile()); + file = getLastOpenFile(); } DesignerFrame df = DesignerContext.getDesignerFrame(); isException = openFile(df, isException, file); @@ -141,7 +142,17 @@ public abstract class BaseDesigner extends ToolBarMenuDock { } } } - + + @Nullable + private FILE getLastOpenFile() { + + FILE file = DesignerStartupContext.getInstance().getStartingTemplateFile(); + if (file == null) { + file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX + DesignerEnvManager.getEnvManager().getLastOpenFile()); + } + return file; + } + private boolean openFile(final DesignerFrame df, boolean isException, FILE file) { AtomicBoolean isExWrapper = new AtomicBoolean(isException); diff --git a/designer-base/src/main/java/com/fr/start/common/DesignerStartupContext.java b/designer-base/src/main/java/com/fr/start/common/DesignerStartupContext.java index a59711e28b..c78469b450 100644 --- a/designer-base/src/main/java/com/fr/start/common/DesignerStartupContext.java +++ b/designer-base/src/main/java/com/fr/start/common/DesignerStartupContext.java @@ -3,6 +3,7 @@ package com.fr.start.common; import com.fr.design.DesignerEnvManager; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; +import com.fr.file.FileFILE; import com.fr.start.module.StartupArgs; import com.fr.startup.metric.DesignerMetrics; import com.fr.startup.ui.StartupPageModel; @@ -64,6 +65,11 @@ public class DesignerStartupContext { */ private boolean createNew; + /** + * 启动的模板 + */ + private FileFILE startingTemplateFile; + /** * 时间记录 */ @@ -72,7 +78,7 @@ public class DesignerStartupContext { public static DesignerStartupContext getInstance() { return StartupContextHolder.INSTANCE; } - + private static class StartupContextHolder { private static final DesignerStartupContext INSTANCE = new DesignerStartupContext(); } @@ -87,6 +93,14 @@ public class DesignerStartupContext { /* 启动模式 */ + public FileFILE getStartingTemplateFile() { + return startingTemplateFile; + } + + public void setStartingTemplateFile(FileFILE startingTemplateFile) { + this.startingTemplateFile = startingTemplateFile; + } + /** * 展示启动页 * 1. 判断当前的工作目录数量 diff --git a/designer-base/src/main/java/com/fr/start/common/DesignerStartupUtil.java b/designer-base/src/main/java/com/fr/start/common/DesignerStartupUtil.java index bc1d349474..1bcf8be95a 100644 --- a/designer-base/src/main/java/com/fr/start/common/DesignerStartupUtil.java +++ b/designer-base/src/main/java/com/fr/start/common/DesignerStartupUtil.java @@ -30,8 +30,7 @@ public class DesignerStartupUtil { if (context.isOnWaiting()) { FileFILE fileFILE = new FileFILE(file); // 设置上一次启动模板为当前模板 - // 注意这里需要设置为 envFullName - DesignerEnvManager.getEnvManager().setLastOpenFile(fileFILE.getEnvFullName()); + DesignerStartupContext.getInstance().setStartingTemplateFile(fileFILE); StartupPageModel model = context.getStartupPageModel(); Optional.ofNullable(model) .ifPresent((e) -> {