diff --git a/designer-base/src/main/java/com/fr/design/fun/OemProcessor.java b/designer-base/src/main/java/com/fr/design/fun/OemProcessor.java index 01e53c9c56..44acc11902 100644 --- a/designer-base/src/main/java/com/fr/design/fun/OemProcessor.java +++ b/designer-base/src/main/java/com/fr/design/fun/OemProcessor.java @@ -10,8 +10,11 @@ import java.util.List; * 设计器Oem接口 */ public interface OemProcessor { + public static final String MARK_STRING = "OemProcessor"; + /** * 启动动画,如果不替换则返回null + * * @return */ SplashStrategy createSplashStrategy(); @@ -19,12 +22,14 @@ public interface OemProcessor { /** * 替换标题图标--DesignerFrame.initTitleIcon * 如果不替换则返回null + * * @return */ List createTitleIcon(); /** * 处理设计器菜单(增删改) + * * @param menuDefs 已加载的菜单 * @return 新的菜单数组 */ 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 397fd312a8..04dab52b50 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 @@ -461,10 +461,15 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta try { @SuppressWarnings("unchecked") OemProcessor oemProcessor = OemHandler.findOem(); - List image; - if (oemProcessor != null && oemProcessor.createTitleIcon() != null) { - image = oemProcessor.createTitleIcon(); - } else { + List image = null; + if (oemProcessor != null) { + try { + image = oemProcessor.createTitleIcon(); + } catch (Throwable e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + if (image == null) { image = ICODecoder.read(DesignerFrame.class .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 4459bd554d..2577b6bd02 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -57,6 +57,7 @@ import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.utils.ThemeUtils; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.manage.PluginFilter; @@ -202,11 +203,18 @@ public abstract class ToolBarMenuDock { }; this.menus = menus(plus); - OemProcessor oemProcessor = OemHandler.findOem(); - if (oemProcessor != null) { - this.menus = oemProcessor.dealWithMenuDef(this.menus); + try { + OemProcessor oemProcessor = OemHandler.findOem(); + if (oemProcessor != null) { + this.menus = oemProcessor.dealWithMenuDef(this.menus); + if (this.menus == null) { + this.menus = menus(plus); + } + } + } catch (Throwable e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + this.menus = menus(plus); } - for (int i = 0; i < menus.length; i++) { menus[i].setHasRecMenu(true); UIMenu subMenu = menus[i].createJMenu(); diff --git a/designer-base/src/main/java/com/fr/start/OemActivator.java b/designer-base/src/main/java/com/fr/start/OemActivator.java deleted file mode 100644 index 6e3bba6036..0000000000 --- a/designer-base/src/main/java/com/fr/start/OemActivator.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fr.start; - -import com.fr.design.fun.OemProcessor; -import com.fr.module.Activator; -import com.fr.module.extension.Prepare; - -/** - * 设计器OEM注册 - */ -public class OemActivator extends Activator implements Prepare { - - @Override - public void start() { - } - - @Override - public void stop() { - - } - - @Override - public void prepare() { - // 加入Oem - setSingleton(OemProcessor.class, new OemImpl()); - } - -} diff --git a/designer-base/src/main/java/com/fr/start/OemHandler.java b/designer-base/src/main/java/com/fr/start/OemHandler.java index ff56bc1735..b127e07f43 100644 --- a/designer-base/src/main/java/com/fr/start/OemHandler.java +++ b/designer-base/src/main/java/com/fr/start/OemHandler.java @@ -1,18 +1,14 @@ package com.fr.start; import com.fr.design.fun.OemProcessor; -import com.fr.module.Module; -import com.fr.module.ModuleContext; +import com.fr.stable.bridge.StableFactory; /** * OEM处理中心 */ public class OemHandler { + public static OemProcessor findOem() { - Module oemModule = ModuleContext.getModule(OemActivator.class); - if (oemModule != null) { - return oemModule.getSingleton(OemProcessor.class); - } - return null; + return StableFactory.getMarkedInstanceObjectFromClass(OemProcessor.MARK_STRING, OemProcessor.class); } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java index 9f6f751229..3c255c936d 100644 --- a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java @@ -15,6 +15,7 @@ import com.fr.stable.BuildContext; import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; +import com.fr.start.OemHandler; import com.fr.start.SplashContext; import com.fr.start.SplashStrategy; import com.fr.start.fx.SplashFx; @@ -125,9 +126,14 @@ public class PreStartActivator extends Activator { } private SplashStrategy createSplash() { - OemProcessor oemProcessor = getSingleton(OemProcessor.class); + OemProcessor oemProcessor = OemHandler.findOem(); if (oemProcessor != null) { - SplashStrategy splashStrategy = oemProcessor.createSplashStrategy(); + SplashStrategy splashStrategy = null; + try { + splashStrategy = oemProcessor.createSplashStrategy(); + } catch (Throwable e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } if (splashStrategy != null) { return splashStrategy; }