diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index ecdef3ed7e..cfb488694f 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -13,11 +13,10 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.DesignUtils; import com.fr.env.EnvListPane; +import com.fr.exit.DesignerExiter; import com.fr.general.GeneralContext; import com.fr.license.exception.RegistEditionException; import com.fr.log.FineLoggerFactory; -import com.fr.process.engine.core.FineProcessContext; -import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.stable.AssistUtils; import com.fr.stable.EnvChangedListener; import com.fr.start.server.ServerTray; @@ -245,14 +244,13 @@ public class EnvChangeEntrance { @Override public void doOk() { if (!envListOkAction(envListPane, PopTipStrategy.NOW)) { - FineProcessContext.getChildPipe().fire(FineProcessEngineEvent.DESTROY); + DesignerExiter.getInstance().execute(); } } @Override public void doCancel() { - FineProcessContext.getChildPipe().fire(FineProcessEngineEvent.DESTROY); - } + DesignerExiter.getInstance().execute(); } }); envListDialog.setVisible(true); } diff --git a/designer-base/src/main/java/com/fr/design/RestartHelper.java b/designer-base/src/main/java/com/fr/design/RestartHelper.java index 10bee060e7..596257d70c 100644 --- a/designer-base/src/main/java/com/fr/design/RestartHelper.java +++ b/designer-base/src/main/java/com/fr/design/RestartHelper.java @@ -2,11 +2,10 @@ package com.fr.design; import com.fr.design.mainframe.DesignerContext; import com.fr.design.os.impl.RestartAction; +import com.fr.exit.DesignerExiter; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; -import com.fr.process.engine.core.FineProcessContext; -import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.stable.ArrayUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -154,7 +153,7 @@ public class RestartHelper { } finally { WorkContext.getCurrent().close(); frame.dispose(); - FineProcessContext.getChildPipe().fire(FineProcessEngineEvent.DESTROY); + DesignerExiter.getInstance().execute(); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 14a566c731..718a9f50c0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -43,6 +43,7 @@ import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.event.EventDispatcher; import com.fr.exception.DecryptTemplateException; +import com.fr.exit.DesignerExiter; import com.fr.file.FILE; import com.fr.file.FILEFactory; import com.fr.file.FileFILE; @@ -54,8 +55,6 @@ import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; -import com.fr.process.engine.core.FineProcessContext; -import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; @@ -1161,7 +1160,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.dispose(); this.ad.shutDown(); - FineProcessContext.getChildPipe().fire(FineProcessEngineEvent.DESTROY); + DesignerExiter.getInstance().execute(); } // harry:添加程序外拖拽文件进来打开的功能 diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index 93e3e0c1a7..d8f5d01161 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -8,13 +8,12 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.gui.UILookAndFeel; import com.fr.design.mainframe.DesignerContext; +import com.fr.exit.DesignerExiter; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; -import com.fr.process.engine.core.FineProcessContext; -import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.stable.ArrayUtils; import com.fr.stable.CommonCodeUtils; import com.fr.stable.StableUtils; @@ -191,8 +190,7 @@ public class DesignUtils { } else if ("check".equals(line)) { clientSend(new String[] {"response"}, socket); } else if ("end".equals(line)) { - FineProcessContext.getChildPipe().fire(FineProcessEngineEvent.DESTROY); - } + DesignerExiter.getInstance().execute(); } else if (StringUtils.isNotEmpty(line)) { File f = new File(line); String path = f.getAbsolutePath(); diff --git a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java new file mode 100644 index 0000000000..8264d8db91 --- /dev/null +++ b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java @@ -0,0 +1,30 @@ +package com.fr.exit; + +import com.fr.process.engine.core.FineProcessContext; +import com.fr.process.engine.core.FineProcessEngineEvent; +import com.fr.stable.StableUtils; + + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/2/12 + */ +public class DesignerExiter { + + public static final DesignerExiter INSTANCE = new DesignerExiter(); + + private static final String DOT = "."; + + public static DesignerExiter getInstance() { + return INSTANCE; + } + + public void execute() { + if (FineProcessContext.getParentPipe() == null && DOT.equals(StableUtils.getInstallHome())) { + System.exit(0); + } else { + FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); + } + } +} diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 5c0e8d013f..a36c29822f 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -14,18 +14,16 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.ui.util.UIUtil; -import com.fr.design.utils.DesignUtils; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; import com.fr.event.Null; +import com.fr.exit.DesignerExiter; import com.fr.file.FILE; import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; -import com.fr.process.engine.core.FineProcessContext; -import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.stable.OperatingSystem; import java.awt.*; @@ -137,7 +135,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { if (!isException) { showDesignerFrame(true); } else { - FineProcessContext.getChildPipe().fire(FineProcessEngineEvent.DESTROY); + DesignerExiter.getInstance().execute(); } } } diff --git a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java index 0bfbbceabb..f6a2f8500f 100644 --- a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java +++ b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java @@ -11,13 +11,9 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.locale.impl.UserInfoMark; import com.fr.design.mainframe.ActiveKeyGenerator; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.CloudCenter; -import com.fr.general.ComparatorUtils; -import com.fr.general.GeneralContext; +import com.fr.exit.DesignerExiter; import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleMark; -import com.fr.process.engine.core.FineProcessContext; -import com.fr.process.engine.core.FineProcessEngineEvent; import javax.swing.*; import javax.swing.border.TitledBorder; @@ -157,7 +153,7 @@ public class CollectUserInformationDialog extends UIDialog { exitButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { - FineProcessContext.getChildPipe().fire(FineProcessEngineEvent.DESTROY); + DesignerExiter.getInstance().execute(); } }); // set default pane. diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index 56aa763899..ec32a64699 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -42,6 +42,7 @@ import com.fr.design.menu.ShortCut; import com.fr.design.module.DesignModuleFactory; import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.exit.DesignerExiter; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.module.Module; @@ -130,7 +131,7 @@ public class MainDesigner extends BaseDesigner { @Override protected void okEvent() { dispose(); - FineProcessContext.getChildPipe().fire(FineProcessEngineEvent.DESTROY); + DesignerExiter.getInstance().execute(); } @Override diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index 5f8ad4ed55..0adb4a6e28 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -13,11 +13,10 @@ import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignerPort; +import com.fr.exit.DesignerExiter; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.module.Activator; -import com.fr.process.engine.core.FineProcessContext; -import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.Metrics; import com.fr.stable.BuildContext; @@ -85,7 +84,7 @@ public class DesignerStartup extends Activator { }; dialog.setVisible(true); } - FineProcessContext.getChildPipe().fire(FineProcessEngineEvent.DESTROY); + DesignerExiter.getInstance().execute(); return; } // 快快显示启动画面