Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~wim.zhai/design into release/10.0

research/10.0
Wim.Zhai 6 years ago
parent
commit
7c27474e26
  1. 29
      designer-realize/src/main/java/com/fr/start/EnvSwitcher.java
  2. 25
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java
  3. 29
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java
  4. 17
      designer-realize/src/main/java/com/fr/start/module/StartupArgs.java

29
designer-realize/src/main/java/com/fr/start/EnvSwitcher.java

@ -1,29 +0,0 @@
package com.fr.start;
import com.fr.design.DesignerEnvManager;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.mainframe.TemplatePane;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
/**
* Created by juhaoyu on 2018/1/31.
* 环境切换器
*/
public class EnvSwitcher {
public void switch2LastEnv() {
try {
String current = DesignerEnvManager.getEnvManager().getCurEnvName();
Workspace workspace = DesignerWorkspaceGenerator.generate(DesignerEnvManager.getEnvManager().getWorkspaceInfo(current));
if (workspace == null) {
TemplatePane.getInstance().dealEvnExceptionWhenStartDesigner();
} else {
WorkContext.switchTo(workspace);
}
} catch (Throwable e) {
TemplatePane.getInstance().dealEvnExceptionWhenStartDesigner();
}
}
}

25
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -1,11 +1,9 @@
package com.fr.start.module; package com.fr.start.module;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.general.ComparatorUtils;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.EnableMetrics;
import com.fr.record.analyzer.Metrics; import com.fr.record.analyzer.Metrics;
@ -28,6 +26,7 @@ public class DesignerStartup extends Activator {
@Override @Override
@Metrics @Metrics
public void start() { public void start() {
startSub(PreStartActivator.class); startSub(PreStartActivator.class);
//启动基础部分 //启动基础部分
startSub(BasicActivator.class); startSub(BasicActivator.class);
@ -38,20 +37,14 @@ public class DesignerStartup extends Activator {
registerEnvListener(); registerEnvListener();
//启动env //启动env
startSub(EnvBasedModule.class); startSub(EnvBasedModule.class);
//designer模块启动好后,查看demo
if (args != null) { browserDemo();
for (String arg : args) {
if (ComparatorUtils.equals(arg, "demo")) {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
ServerStarter.browserDemoURL();
break;
}
}
}
ExecutorService service = Executors.newSingleThreadExecutor(); ExecutorService service = Executors.newSingleThreadExecutor();
service.submit(new Runnable() { service.submit(new Runnable() {
@Override @Override
public void run() { public void run() {
designer.show(args); designer.show(args);
DesignerContext.getDesignerFrame().getProgressDialog().dispose(); DesignerContext.getDesignerFrame().getProgressDialog().dispose();
} }
@ -63,6 +56,14 @@ public class DesignerStartup extends Activator {
DesignerContext.getDesignerFrame().getProgressDialog().setVisible(true); DesignerContext.getDesignerFrame().getProgressDialog().setVisible(true);
startSub(StartFinishActivator.class); startSub(StartFinishActivator.class);
}
private void browserDemo() {
if (getModule().leftFindSingleton(StartupArgs.class) != null && getModule().leftFindSingleton(StartupArgs.class).isDemo()) {
ServerStarter.browserDemoURL();
}
} }
/** /**

29
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

@ -1,9 +1,12 @@
package com.fr.start.module; package com.fr.start.module;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.mainframe.TemplatePane;
import com.fr.general.ComparatorUtils;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.start.EnvSwitcher; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
/** /**
* Created by juhaoyu on 2018/1/8. * Created by juhaoyu on 2018/1/8.
@ -16,17 +19,27 @@ public class DesignerWorkspaceProvider extends Activator {
//检查环境 //检查环境
DesignerEnvManager.checkNameEnvMap(); DesignerEnvManager.checkNameEnvMap();
EnvSwitcher switcher = new EnvSwitcher(); if (getModule().leftFindSingleton(StartupArgs.class) != null && getModule().leftFindSingleton(StartupArgs.class).isDemo()) {
//设置好环境即可,具体跟环境有关的模块会自动调用 DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
switcher.switch2LastEnv(); } else {
getRoot().setSingleton(EnvSwitcher.class, switcher); try {
String current = DesignerEnvManager.getEnvManager().getCurEnvName();
Workspace workspace = DesignerWorkspaceGenerator.generate(DesignerEnvManager.getEnvManager().getWorkspaceInfo(current));
if (workspace == null) {
TemplatePane.getInstance().dealEvnExceptionWhenStartDesigner();
} else {
WorkContext.switchTo(workspace);
}
} catch (Throwable e) {
TemplatePane.getInstance().dealEvnExceptionWhenStartDesigner();
}
}
} }
@Override @Override
public void stop() { public void stop() {
//清空模块
getRoot().removeSingleton(EnvSwitcher.class);
} }

17
designer-realize/src/main/java/com/fr/start/module/StartupArgs.java

@ -1,5 +1,7 @@
package com.fr.start.module; package com.fr.start.module;
import com.fr.general.ComparatorUtils;
/** /**
* Created by juhaoyu on 2018/1/8. * Created by juhaoyu on 2018/1/8.
* 封装启动参数 * 封装启动参数
@ -17,5 +19,20 @@ public class StartupArgs {
return args; return args;
} }
/**
* 是否是产品演示
*/
public boolean isDemo() {
if (args != null) {
for (String arg : args) {
if (ComparatorUtils.equals(arg, "demo")) {
return true;
}
}
}
return false;
}
} }

Loading…
Cancel
Save