From 85a3ac5642a0f4ae31230c5d4fb021dc5cef4b13 Mon Sep 17 00:00:00 2001 From: Harrison Date: Wed, 17 Aug 2022 17:23:33 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-76061=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=E8=B5=B7?= =?UTF-8?q?=E5=A7=8B=E9=A1=B5=E5=B7=B2=E6=89=93=E5=BC=80=EF=BC=8C=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E6=96=87=E4=BB=B6=E5=A4=B9=E7=9B=B4=E6=8E=A5=E6=89=93?= =?UTF-8?q?=E5=BC=80=E6=A8=A1=E6=9D=BF=201-=E6=96=87=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E4=B8=BA=E5=85=A8=E6=96=87=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=202-=E6=94=AF=E6=8C=81=20mac?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/utils/DesignUtils.java | 16 ++-------- .../fr/start/common/DesignerStartupUtil.java | 31 ++++++++++++++++++- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index 67fb918666..47690bba9b 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -25,7 +25,7 @@ import com.fr.stable.StringUtils; import com.fr.stable.os.OperatingSystem; import com.fr.start.ServerStarter; import com.fr.start.common.DesignerStartupContext; -import com.fr.startup.ui.StartupPageModel; +import com.fr.start.common.DesignerStartupUtil; import com.fr.value.NotNullLazyValue; import com.fr.workspace.WorkContext; import org.jetbrains.annotations.NotNull; @@ -48,7 +48,6 @@ import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.Enumeration; import java.util.Locale; -import java.util.Optional; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -216,18 +215,9 @@ public class DesignUtils { @Override public void run() { DesignerStartupContext context = DesignerStartupContext.getInstance(); + // 如果在启动页展示中 - if (context.isOnWaiting()) { - FileFILE fileFILE = new FileFILE(f); - // 设置上一次启动模板为 - DesignerEnvManager.getEnvManager().setLastOpenFile(fileFILE.getPath()); - StartupPageModel model = context.getStartupPageModel(); - Optional.ofNullable(model) - .ifPresent((e) -> { - // 执行上一次模板的启动 - Runnable openLastTemplateRunnable = e.getOpenLastTemplateRunnable(); - openLastTemplateRunnable.run(); - }); + if (DesignerStartupUtil.openTemplateIfOnWaiting(f)) { return; } // 如果是在启动中 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 5bc55e80c5..bc1d349474 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 @@ -6,16 +6,45 @@ import com.fr.file.FILE; import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; +import com.fr.startup.ui.StartupPageModel; import org.jetbrains.annotations.Nullable; import java.io.File; +import java.util.Optional; /** * created by Harrison on 2022/07/09 **/ public class DesignerStartupUtil { - @Nullable + /** + * 如果是在启动页中 + * + * @param file 文件 + * @return 成功/失败 + */ + public static boolean openTemplateIfOnWaiting(File file) { + + DesignerStartupContext context = DesignerStartupContext.getInstance(); + // 如果在启动页展示中 + if (context.isOnWaiting()) { + FileFILE fileFILE = new FileFILE(file); + // 设置上一次启动模板为当前模板 + // 注意这里需要设置为 envFullName + DesignerEnvManager.getEnvManager().setLastOpenFile(fileFILE.getEnvFullName()); + StartupPageModel model = context.getStartupPageModel(); + Optional.ofNullable(model) + .ifPresent((e) -> { + // 执行上一次模板的启动 + Runnable openLastTemplateRunnable = e.getOpenLastTemplateRunnable(); + openLastTemplateRunnable.run(); + }); + return true; + } + return false; + } + + @Nullable public static FILE convertArgs2FILE(String[] args) { // p:需要打开这个报表文件,这个代码不能删除.