Browse Source

REPORT-4985 文设计器-切换工作目录 中出现中文“默认”

master
plough 7 years ago
parent
commit
5e7f9afa00
  1. 27
      designer_base/src/com/fr/design/DesignerEnvManager.java
  2. 3
      designer_base/src/com/fr/start/BaseDesigner.java

27
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
*

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

Loading…
Cancel
Save