Browse Source

Merge pull request #1540 in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit '8dd916387bbd87b8a36b6bc919ecc246b0696bf9':
  REPORT-28894 多次切换远程的问题 && xml不可读处理
feature/big-screen
Hades 5 years ago
parent
commit
74ddb8790e
  1. 43
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 8
      designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java
  3. 6
      designer-base/src/main/java/com/fr/exit/DesignerExiter.java

43
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -202,6 +202,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
XmlHandler.Self.handle(e);
}
// james:如果没有env定义,要设置一个默认的
@ -348,23 +349,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
ErrorDialog dialog = new ErrorDialog(null,
Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"),
Toolkit.i18nText("Fine-Design_Error_Start_Report"),
e.getMessage()) {
@Override
protected void okEvent() {
dispose();
DesignerExiter.getInstance().execute();
}
@Override
protected void restartEvent() {
dispose();
RestartHelper.restart();
}
};
dialog.setVisible(true);
XmlHandler.Self.handle(e);
} finally {
if (null != fileWriter) {
try {
@ -2059,4 +2044,28 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public void setVcsConfigManager(VcsConfigManager vcsConfigManager) {
this.vcsConfigManager = vcsConfigManager;
}
enum XmlHandler {
Self;
public void handle(Throwable throwable) {
ErrorDialog dialog = new ErrorDialog(null,
Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"),
Toolkit.i18nText("Fine-Design_Error_Start_Report"),
throwable.getMessage()) {
@Override
protected void okEvent() {
dispose();
DesignerExiter.getInstance().execute();
}
@Override
protected void restartEvent() {
dispose();
RestartHelper.restart();
}
};
dialog.setVisible(true);
DesignerExiter.getInstance().execute();
}
};
}

8
designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java vendored

@ -8,7 +8,6 @@ import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector;
import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleContext;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
@ -17,6 +16,7 @@ import com.fr.workspace.connect.WorkspaceClient;
import javax.swing.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit;
public class DesignerWorkspaceGenerator {
private static final int WAIT_FREQ = 60;
private static ExecutorService service = ModuleContext.getExecutor().newSingleThreadExecutor(
private static ExecutorService service = Executors.newCachedThreadPool(
new NamedThreadFactory("DesignerWorkspaceGenerator"));
public static Workspace generate(final DesignerWorkspaceInfo config) throws Exception {
@ -89,4 +89,8 @@ public class DesignerWorkspaceGenerator {
}
}
}
public static void stop() {
service.shutdown();
}
}

6
designer-base/src/main/java/com/fr/exit/DesignerExiter.java

@ -1,5 +1,6 @@
package com.fr.exit;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent;
import com.fr.stable.StableUtils;
@ -19,9 +20,14 @@ public class DesignerExiter {
}
public void execute() {
beforeExit();
if (FineProcessContext.getParentPipe() != null) {
FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY);
}
System.exit(0);
}
private void beforeExit() {
DesignerWorkspaceGenerator.stop();
}
}

Loading…
Cancel
Save