From ec3b3eea4c1648c018c14bfd5d88ab97fd88d4bc Mon Sep 17 00:00:00 2001 From: ju Date: Mon, 6 Aug 2018 00:47:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=E9=A2=84?= =?UTF-8?q?=E8=A7=88demo=E6=9C=89=E9=97=AE=E9=A2=98=20=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=92=8C=E9=A2=84=E8=A7=88demo=E5=88=86?= =?UTF-8?q?=E5=BC=80=EF=BC=8C=E9=A2=84=E8=A7=88demo=E4=B8=8D=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E7=AC=AC=E4=BA=8C=E6=AC=A1=E5=88=87=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/start/EnvSwitcher.java | 29 --------------- .../com/fr/start/module/DesignerStartup.java | 37 ++++++++++++------- .../module/DesignerWorkspaceProvider.java | 37 ++++++++++++++----- 3 files changed, 51 insertions(+), 52 deletions(-) delete mode 100644 designer-realize/src/main/java/com/fr/start/EnvSwitcher.java diff --git a/designer-realize/src/main/java/com/fr/start/EnvSwitcher.java b/designer-realize/src/main/java/com/fr/start/EnvSwitcher.java deleted file mode 100644 index 301c38f2de..0000000000 --- a/designer-realize/src/main/java/com/fr/start/EnvSwitcher.java +++ /dev/null @@ -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(); - } - } -} diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index 4698b760db..c131573b83 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -1,7 +1,6 @@ package com.fr.start.module; -import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.DesignerContext; import com.fr.event.Event; import com.fr.event.Listener; @@ -28,30 +27,25 @@ public class DesignerStartup extends Activator { @Override @Metrics public void start() { + startSub(PreStartActivator.class); //启动基础部分 startSub(BasicActivator.class); final String[] args = getModule().upFindSingleton(StartupArgs.class).get(); final Designer designer = new Designer(args); - + startSub(DesignerWorkspaceProvider.class); registerEnvListener(); //启动env startSub(EnvBasedModule.class); - - if (args != null) { - for (String arg : args) { - if (ComparatorUtils.equals(arg, "demo")) { - DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); - ServerStarter.browserDemoURL(); - break; - } - } - } + //designer模块启动好后,查看demo + browserDemo(); ExecutorService service = Executors.newSingleThreadExecutor(); service.submit(new Runnable() { + @Override public void run() { + designer.show(args); DesignerContext.getDesignerFrame().getProgressDialog().dispose(); } @@ -60,11 +54,26 @@ public class DesignerStartup extends Activator { DesignerContext.getDesignerFrame().setVisible(true); //启动画面结束 SplashContext.getInstance().hide(); - + DesignerContext.getDesignerFrame().getProgressDialog().setVisible(true); startSub(StartFinishActivator.class); + } - + + private void browserDemo() { + + final String[] args = getModule().upFindSingleton(StartupArgs.class).get(); + + if (args != null) { + for (String arg : args) { + if (ComparatorUtils.equals(arg, "demo")) { + ServerStarter.browserDemoURL(); + break; + } + } + } + } + /** * 切换环境时,重新启动所有相关模块 */ diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index bd8159c6de..8397a21c72 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -1,9 +1,12 @@ package com.fr.start.module; 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.start.EnvSwitcher; +import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; /** * Created by juhaoyu on 2018/1/8. @@ -15,18 +18,34 @@ public class DesignerWorkspaceProvider extends Activator { public void start() { //检查环境 DesignerEnvManager.checkNameEnvMap(); - - EnvSwitcher switcher = new EnvSwitcher(); - //设置好环境即可,具体跟环境有关的模块会自动调用 - switcher.switch2LastEnv(); - getRoot().setSingleton(EnvSwitcher.class, switcher); + + final String[] args = getModule().upFindSingleton(StartupArgs.class).get(); + + if (args != null) { + for (String arg : args) { + if (ComparatorUtils.equals(arg, "demo")) { + DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); + break; + } + } + } else { + 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 public void stop() { - //清空模块 - getRoot().removeSingleton(EnvSwitcher.class); }