From 5e7f9afa0021272231d6e3b2de8809e9fc2d964e Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 11 Oct 2017 10:08:29 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-4985=20=E6=96=87=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E5=88=87=E6=8D=A2=E5=B7=A5=E4=BD=9C=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=20=E4=B8=AD=E5=87=BA=E7=8E=B0=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E2=80=9C=E9=BB=98=E8=AE=A4=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/DesignerEnvManager.java | 27 +++++++++++++------ .../src/com/fr/start/BaseDesigner.java | 3 ++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/designer_base/src/com/fr/design/DesignerEnvManager.java b/designer_base/src/com/fr/design/DesignerEnvManager.java index 568deb96d8..0e76122141 100644 --- a/designer_base/src/com/fr/design/DesignerEnvManager.java +++ b/designer_base/src/com/fr/design/DesignerEnvManager.java @@ -153,6 +153,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * DesignerEnvManager. */ public static DesignerEnvManager getEnvManager() { + return getEnvManager(true); + } + + public static DesignerEnvManager getEnvManager(boolean needCheckEnv) { if (designerEnvManager == null) { designerEnvManager = new DesignerEnvManager(); try { @@ -162,14 +166,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } // james:如果没有env定义,要设置一个默认的 - if (designerEnvManager.nameEnvMap.size() <= 0) { - String installHome = StableUtils.getInstallHome(); - if (installHome != null) { - String name = Inter.getLocText("FR-Engine_DEFAULT"); - String envPath = StableUtils.pathJoin(new String[]{installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME}); - designerEnvManager.putEnv(name, LocalEnv.createEnv(envPath)); - designerEnvManager.setCurEnvName(name); - } + if (needCheckEnv) { + checkNameEnvMap(); } GeneralContext.addEnvChangedListener(new EnvChangedListener() { @@ -187,6 +185,19 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { return designerEnvManager; } + public static void checkNameEnvMap() { + if (designerEnvManager == null || designerEnvManager.nameEnvMap.size() > 0) { + return; + } + String installHome = StableUtils.getInstallHome(); + if (installHome != null) { + String name = Inter.getLocText("FR-Engine_DEFAULT"); + String envPath = StableUtils.pathJoin(new String[]{installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME}); + designerEnvManager.putEnv(name, LocalEnv.createEnv(envPath)); + designerEnvManager.setCurEnvName(name); + } + } + /** * 添加设计器中相关的worker * diff --git a/designer_base/src/com/fr/start/BaseDesigner.java b/designer_base/src/com/fr/start/BaseDesigner.java index 3f24b645a5..2b8aacd626 100644 --- a/designer_base/src/com/fr/start/BaseDesigner.java +++ b/designer_base/src/com/fr/start/BaseDesigner.java @@ -171,7 +171,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock { protected void initLanguage() { //这两句的位置不能随便调换,因为会影响语言切换的问题 - FRContext.setLanguage(DesignerEnvManager.getEnvManager().getLanguage()); + FRContext.setLanguage(DesignerEnvManager.getEnvManager(false).getLanguage()); + DesignerEnvManager.checkNameEnvMap(); } protected void initDefaultFont() {