Browse Source

REPORT-76061【迭代】【起始页】起始页已打开,系统文件夹直接打开模板

1-文件名变更为全文件名
2-支持 mac
feature/x
Harrison 2 years ago
parent
commit
85a3ac5642
  1. 16
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  2. 29
      designer-base/src/main/java/com/fr/start/common/DesignerStartupUtil.java

16
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.stable.os.OperatingSystem;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import com.fr.start.common.DesignerStartupContext; 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.value.NotNullLazyValue;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -48,7 +48,6 @@ import java.net.URI;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Locale; import java.util.Locale;
import java.util.Optional;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -216,18 +215,9 @@ public class DesignUtils {
@Override @Override
public void run() { public void run() {
DesignerStartupContext context = DesignerStartupContext.getInstance(); DesignerStartupContext context = DesignerStartupContext.getInstance();
// 如果在启动页展示中 // 如果在启动页展示中
if (context.isOnWaiting()) { if (DesignerStartupUtil.openTemplateIfOnWaiting(f)) {
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();
});
return; return;
} }
// 如果是在启动中 // 如果是在启动中

29
designer-base/src/main/java/com/fr/start/common/DesignerStartupUtil.java

@ -6,15 +6,44 @@ import com.fr.file.FILE;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.startup.ui.StartupPageModel;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.io.File; import java.io.File;
import java.util.Optional;
/** /**
* created by Harrison on 2022/07/09 * created by Harrison on 2022/07/09
**/ **/
public class DesignerStartupUtil { public class DesignerStartupUtil {
/**
* 如果是在启动页中
*
* @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 @Nullable
public static FILE convertArgs2FILE(String[] args) { public static FILE convertArgs2FILE(String[] args) {

Loading…
Cancel
Save