|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.fr.env.handler; |
|
|
|
|
|
|
|
|
|
import com.fr.base.exception.ExceptionDescriptor; |
|
|
|
|
import com.fr.design.EnvChangeEntrance; |
|
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
|
import com.fr.design.env.DesignerWorkspaceInfo; |
|
|
|
@ -11,6 +12,7 @@ import com.fr.env.handler.impl.CommonHandler;
|
|
|
|
|
import com.fr.env.handler.impl.ExecutionHandler; |
|
|
|
|
import com.fr.env.handler.impl.UnexpectedHandler; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import javax.swing.UIManager; |
|
|
|
@ -23,11 +25,11 @@ import static javax.swing.JOptionPane.ERROR_MESSAGE;
|
|
|
|
|
* @version 10.0 |
|
|
|
|
* Created by hades on 2021/8/5 |
|
|
|
|
*/ |
|
|
|
|
public class RemoteDesignExceptionHandler { |
|
|
|
|
public class WorkspaceExceptionHandler { |
|
|
|
|
|
|
|
|
|
private static final RemoteDesignExceptionHandler INSTANCE = new RemoteDesignExceptionHandler(); |
|
|
|
|
private static final WorkspaceExceptionHandler INSTANCE = new WorkspaceExceptionHandler(); |
|
|
|
|
|
|
|
|
|
public static RemoteDesignExceptionHandler getInstance() { |
|
|
|
|
public static WorkspaceExceptionHandler getInstance() { |
|
|
|
|
return INSTANCE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -35,7 +37,7 @@ public class RemoteDesignExceptionHandler {
|
|
|
|
|
|
|
|
|
|
private final List<Handler<RefWrapper, ResultWrapper>> switchList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
private RemoteDesignExceptionHandler() { |
|
|
|
|
private WorkspaceExceptionHandler() { |
|
|
|
|
// 要保证顺序
|
|
|
|
|
testList.add(new CancelHandler()); |
|
|
|
|
testList.add(new ExecutionHandler()); |
|
|
|
@ -65,11 +67,15 @@ public class RemoteDesignExceptionHandler {
|
|
|
|
|
public void handleInSwitch(Throwable e, DesignerWorkspaceInfo workspaceInfo) { |
|
|
|
|
if (workspaceInfo == null || workspaceInfo.getType() == DesignerWorkspaceType.Local) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
FineJOptionPane.showMessageDialog(EnvChangeEntrance.getInstance().getDialog(), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), |
|
|
|
|
ERROR_MESSAGE, |
|
|
|
|
UIManager.getIcon("OptionPane.errorIcon")); |
|
|
|
|
if (e instanceof ExceptionDescriptor) { |
|
|
|
|
new CommonHandler(true).handle(new RefWrapper(e, StringUtils.EMPTY)); |
|
|
|
|
} else { |
|
|
|
|
FineJOptionPane.showMessageDialog(EnvChangeEntrance.getInstance().getDialog(), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), |
|
|
|
|
ERROR_MESSAGE, |
|
|
|
|
UIManager.getIcon("OptionPane.errorIcon")); |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
handle(e, switchList, workspaceInfo); |
|
|
|
@ -78,6 +84,7 @@ public class RemoteDesignExceptionHandler {
|
|
|
|
|
public void handleInStart(Throwable e, DesignerWorkspaceInfo workspaceInfo) { |
|
|
|
|
if (workspaceInfo == null || workspaceInfo.getType() == DesignerWorkspaceType.Local) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
new CommonHandler(false).handle(new RefWrapper(e, StringUtils.EMPTY)); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
handle(e, testList, workspaceInfo); |