diff --git a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java index 2518ef57c..f6c0e3054 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -83,6 +83,20 @@ public enum SupportOSImpl implements SupportOS { public boolean support() { return OperatingSystem.isMacos(); } + }, + + NON_GUARDIAN_START { + @Override + public boolean support() { + return OperatingSystem.isLinux() || Arch.getArch() == Arch.ARM; + } + }, + + DOCK_ICON { + @Override + public boolean support() { + return OperatingSystem.isMacos(); + } } } diff --git a/designer-base/src/main/resources/com/fr/design/icon/logo.png b/designer-base/src/main/resources/com/fr/design/icon/logo.png new file mode 100644 index 000000000..d4c7d8b24 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/icon/logo.png differ diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index fb974da98..1f8d181ce 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -1,5 +1,6 @@ package com.fr.start; +import com.fr.design.os.impl.SupportOSImpl; import com.fr.log.FineLoggerFactory; /** @@ -14,7 +15,8 @@ public class Designer { public static void main(String[] args) { try { - if (DesignerJavaRuntime.getInstance().isInValidVmOptions()) { + if (DesignerJavaRuntime.getInstance().isInValidVmOptions() + || SupportOSImpl.NON_GUARDIAN_START.support()) { runNonGuardianDesigner(args); } else { // 创建进程 diff --git a/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java b/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java index c264e79cb..6b0c45eab 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java @@ -1,12 +1,18 @@ package com.fr.start; +import com.fr.design.os.impl.SupportOSImpl; import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; import com.fr.process.engine.core.AbstractJavaRuntime; +import com.fr.stable.ArrayUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.os.OperatingSystem; -import java.util.Set; +import javax.imageio.ImageIO; +import java.io.File; +import java.io.IOException; + /** * 设计器Java运行环境 @@ -23,8 +29,20 @@ public class DesignerJavaRuntime extends AbstractJavaRuntime { private static final String JAVA_EXEC = "java"; private static final String WIN_JRE_BIN = StableUtils.pathJoin("jre", "bin"); private static final String MAC_JRE_BIN = StableUtils.pathJoin("jre.bundle", "Contents", "Home", "jre", "bin"); + private static final String BIN_HOME = StableUtils.pathJoin(StableUtils.getInstallHome(), "bin"); + private static final String LOGO_PATH = StableUtils.pathJoin(BIN_HOME, "logo.png"); + private static final String DOCK_OPTIONS = "-Xdock:icon=" + LOGO_PATH; private static final String[] DEBUG_OPTIONS = new String[]{"-Dfile.encoding=UTF-8", "-Xmx2048m"}; + static { + if (SupportOSImpl.DOCK_ICON.support()) { + try { + ImageIO.write(IOUtils.readImage("com/fr/design/icon/logo.png"), "png", new File(LOGO_PATH)); + } catch (IOException ignore) { + } + } + } + private static final DesignerJavaRuntime INSTANCE = new DesignerJavaRuntime(); public static DesignerJavaRuntime getInstance() { @@ -79,7 +97,11 @@ public class DesignerJavaRuntime extends AbstractJavaRuntime { @Override public String[] getJvmOptions() { if (isInstallVersion()) { - return super.getJvmOptions(); + String[] options = super.getJvmOptions(); + if (SupportOSImpl.DOCK_ICON.support()) { + options = ArrayUtils.add(options, DOCK_OPTIONS); + } + return options; } else { return DEBUG_OPTIONS; }