Browse Source

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

1-支持mac
2-修复 path 路径的传递问题
feature/x
Harrison 2 years ago
parent
commit
f6de87bfda
  1. 15
      designer-base/src/main/java/com/fr/design/deeplink/DeepLinkCore.java
  2. 15
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  3. 16
      designer-base/src/main/java/com/fr/start/common/DesignerStartupContext.java
  4. 3
      designer-base/src/main/java/com/fr/start/common/DesignerStartupUtil.java

15
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() {

15
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);

16
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. 判断当前的工作目录数量

3
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) -> {

Loading…
Cancel
Save