From 4011ec7344723e8be26ff02842684ccbf3a25ef5 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 9 Mar 2020 16:49:51 +0800 Subject: [PATCH] REPORT-27685 && REPORT-27478 && REPORT-27454 --- .../src/main/java/com/fr/design/RestartHelper.java | 9 ++++++++- .../com/fr/design/mainframe/DesignerFrame.java | 14 +++++++++++--- .../design/update/ui/dialog/UpdateMainDialog.java | 3 +++ .../main/java/com/fr/start/DesignerLauncher.java | 3 ++- .../java/com/fr/start/DesignerSuperListener.java | 2 +- .../src/main/java/com/fr/start/MainDesigner.java | 1 + 6 files changed, 26 insertions(+), 6 deletions(-) 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 596257d70c..b5f1b6b815 100644 --- a/designer-base/src/main/java/com/fr/design/RestartHelper.java +++ b/designer-base/src/main/java/com/fr/design/RestartHelper.java @@ -153,7 +153,14 @@ public class RestartHelper { } finally { WorkContext.getCurrent().close(); frame.dispose(); - DesignerExiter.getInstance().execute(); + try { + // 更新升级过渡用 供当前测试 后面可删除 + Class.forName("com.fr.exit.DesignerExiter"); + DesignerExiter.getInstance().execute(); + } catch (Exception ignore) { + } finally { + System.exit(0); + } } } 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 4d37d75390..d6b9c047ea 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 @@ -50,16 +50,18 @@ import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; +import com.fr.general.IOUtils; +import com.fr.invoke.Reflect; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; 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.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.image4j.codec.ico.ICODecoder; +import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.project.ProjectConstants; @@ -501,8 +503,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta image = ICODecoder.read(DesignerFrame.class .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); } - this.setIconImages(image); - } catch (IOException e) { + if (OperatingSystem.isMacos()) { + Class clazz = Class.forName("com.apple.eawt.Application"); + BufferedImage icon = image.isEmpty() ? IOUtils.readImage("/com/fr/base/images/oem/logo.png") : image.get(image.size() - 1); + Reflect.on(Reflect.on(clazz).call("getApplication").get()).call("setDockIconImage", icon); + } else { + this.setIconImages(image); + } + } catch (IOException | ClassNotFoundException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); } diff --git a/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java b/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java index 52e4144deb..78df599c57 100644 --- a/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java +++ b/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java @@ -30,6 +30,8 @@ import com.fr.general.http.HttpToolbox; import com.fr.json.JSONArray; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; +import com.fr.process.engine.core.FineProcessContext; +import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.stable.*; import com.fr.stable.project.ProjectConstants; import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse; @@ -598,6 +600,7 @@ public class UpdateMainDialog extends UIDialog { final String installLib = StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB); final JFrame frame = DesignerContext.getDesignerFrame(); final RestartHelper helper = new RestartHelper(); + FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); new FileProcess(callBack) { @Override public void onDownloadSuccess() { diff --git a/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java b/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java index d0633ac6a3..9e98fcb400 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java @@ -1,5 +1,6 @@ package com.fr.start; +import com.fr.design.RestartHelper; import com.fr.process.FineProcess; import com.fr.process.engine.FineJavaProcessFactory; import com.fr.process.engine.core.FineProcessContext; @@ -63,6 +64,6 @@ public class DesignerLauncher { public void restart() { beforeExit(); - start(args); + RestartHelper.restart(); } } diff --git a/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java b/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java index acbd92271a..db8e532dcf 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java @@ -57,7 +57,7 @@ public class DesignerSuperListener { process.getPipe().listen(FineProcessEngineEvent.DESTROY, new Listener() { @Override public void on(Event event, Null param) { - DesignerLauncher.getInstance().exit(); + System.exit(0); } }); } 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 238b035125..d4eb68e866 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -106,6 +106,7 @@ public class MainDesigner extends BaseDesigner { watch.start(); //启动运行时 FineRuntime.start(); + DesignerSubListener.getInstance().start(); Module designerRoot = ModuleContext.parseRoot("designer-startup.xml"); //传递启动参数 designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args));