Browse Source

REPORT-9619

master
Mata.Li 6 years ago
parent
commit
a8356767ab
  1. 20
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java
  2. 17
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

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

@ -1,14 +1,16 @@
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;
import com.fr.start.Designer; import com.fr.start.Designer;
import com.fr.start.EnvSwitcher; import com.fr.start.ServerStarter;
import com.fr.start.SplashContext; import com.fr.start.SplashContext;
import com.fr.startup.activators.BasicActivator; import com.fr.startup.activators.BasicActivator;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -32,13 +34,19 @@ public class DesignerStartup extends Activator {
final String[] args = getModule().upFindSingleton(StartupArgs.class).get(); final String[] args = getModule().upFindSingleton(StartupArgs.class).get();
final Designer designer = new Designer(args); final Designer designer = new Designer(args);
EnvSwitcher switcher = new EnvSwitcher(); startSub(DesignerWorkspaceProvider.class);
//设置好环境即可,具体跟环境有关的模块会自动调用
switcher.switch2LastEnv();
getRoot().setSingleton(EnvSwitcher.class, switcher);
//启动env //启动env
startSub(EnvBasedModule.class); startSub(EnvBasedModule.class);
startSub(DesignerWorkspaceProvider.class);
if (args != null) {
for (String arg : args) {
if (ComparatorUtils.equals(arg, "demo")) {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
ServerStarter.browserDemoURL();
break;
}
}
}
ExecutorService service = Executors.newSingleThreadExecutor(); ExecutorService service = Executors.newSingleThreadExecutor();
registerEnvListener(); registerEnvListener();
service.submit(new Runnable() { service.submit(new Runnable() {

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

@ -1,10 +1,9 @@
package com.fr.start.module; package com.fr.start.module;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.general.ComparatorUtils;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.start.EnvSwitcher; import com.fr.start.EnvSwitcher;
import com.fr.start.ServerStarter;
/** /**
* Created by juhaoyu on 2018/1/8. * Created by juhaoyu on 2018/1/8.
@ -17,16 +16,10 @@ public class DesignerWorkspaceProvider extends Activator {
//检查环境 //检查环境
DesignerEnvManager.checkNameEnvMap(); DesignerEnvManager.checkNameEnvMap();
String[] args = getModule().upFindSingleton(StartupArgs.class).get(); EnvSwitcher switcher = new EnvSwitcher();
if (args != null) { //设置好环境即可,具体跟环境有关的模块会自动调用
for (String arg : args) { switcher.switch2LastEnv();
if (ComparatorUtils.equals(arg, "demo")) { getRoot().setSingleton(EnvSwitcher.class, switcher);
DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
ServerStarter.browserDemoURL();
break;
}
}
}
} }

Loading…
Cancel
Save