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