From 5632a9b78cb9a95fb328639da737306d4386d743 Mon Sep 17 00:00:00 2001 From: bryant Date: Mon, 2 Nov 2020 10:44:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-42577=20=E6=97=A5=E6=96=87=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=8D=87=E7=BA=A7=E5=B1=8F=E8=94=BD=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/locale/impl/SupportLocaleImpl.java | 23 ++----- .../mainframe/toolbar/ToolBarMenuDock.java | 67 +++++++++++++------ .../java/com/fr/design/upm/UpmFinder.java | 67 ++++++++----------- 3 files changed, 80 insertions(+), 77 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java b/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java index 0373dad03..e192336d6 100644 --- a/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java +++ b/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java @@ -138,9 +138,8 @@ public enum SupportLocaleImpl implements SupportLocale { @Override public Set support() { Set set = new HashSet(); - set.add(Locale.US); - set.add(Locale.KOREA); - set.add(Locale.JAPAN); + set.add(Locale.CHINA); + set.add(Locale.TAIWAN); return set; } }, @@ -152,24 +151,12 @@ public enum SupportLocaleImpl implements SupportLocale { @Override public Set support() { Set set = new HashSet(); - set.add(Locale.CHINA); - set.add(Locale.TAIWAN); - return set; - } - }, - - /** - * 更新升级-帮助菜单下 - */ - UPDATE_HELP { - @Override - public Set support() { - Set set = new HashSet<>(); set.add(Locale.US); set.add(Locale.KOREA); - set.add(Locale.CHINA); - set.add(Locale.TAIWAN); + set.add(Locale.JAPAN); return set; } } + + } 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 078d4d128..af03c2ef8 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 @@ -54,7 +54,9 @@ import com.fr.design.mainframe.ToolBarNewTemplatePane; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; +import com.fr.design.menu.SnapChatMenuDef; import com.fr.design.menu.ToolBarDef; +import com.fr.design.notification.SnapChatAllTypes; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.update.actions.SoftwareUpdateAction; @@ -528,18 +530,35 @@ public abstract class ToolBarMenuDock { * @return 帮组菜单的子菜单 */ public ShortCut[] createHelpShortCuts() { - final java.util.List shortCuts = new ArrayList<>(); + final java.util.List shortCuts = new ArrayList(); - LocaleCenter.buildAction(() -> shortCuts.add(new VideoAction()), SupportLocaleImpl.VIDEO); + Locale locale = GeneralContext.getLocale(); - LocaleCenter.buildAction(() -> shortCuts.add(new TutorialAction()), SupportLocaleImpl.TUTORIAL_HELP); + LocaleCenter.buildAction(new LocaleAction() { + @Override + public void execute() { + shortCuts.add(new VideoAction()); + } + }, SupportLocaleImpl.VIDEO); - LocaleCenter.buildAction(() -> shortCuts.add(new TechSupportAction()), SupportLocaleImpl.TECH_SUPPORT_HELP); + LocaleCenter.buildAction(new LocaleAction() { + @Override + public void execute() { + shortCuts.add(new TutorialAction()); + } + }, SupportLocaleImpl.TUTORIAL_HELP); + + LocaleCenter.buildAction(new LocaleAction() { + @Override + public void execute() { + shortCuts.add(new TechSupportAction()); + } + }, SupportLocaleImpl.TECH_SUPPORT_HELP); //远程不使用更新升级,产品演示 if (WorkContext.getCurrent().isLocal()) { shortCuts.add(new WebDemoAction()); - LocaleCenter.buildAction(() -> shortCuts.add(new SoftwareUpdateAction()), SupportLocaleImpl.UPDATE_HELP); + shortCuts.add(new SoftwareUpdateAction()); } if (AlphaFineConfigManager.isALPHALicAvailable()) { shortCuts.add(new AlphaFineAction()); @@ -547,7 +566,12 @@ public abstract class ToolBarMenuDock { shortCuts.add(SeparatorDef.DEFAULT); if (DesignerEnvManager.getEnvManager().isOpenDebug()) { - OSSupportCenter.buildAction(objects -> shortCuts.add(new FineUIAction()), SupportOSImpl.FINEUI); + OSSupportCenter.buildAction(new OSBasedAction() { + @Override + public void execute(Object... objects) { + shortCuts.add(new FineUIAction()); + } + }, SupportOSImpl.FINEUI); } shortCuts.add(new AboutAction()); @@ -561,22 +585,17 @@ public abstract class ToolBarMenuDock { * @return 社区菜单的子菜单 */ public ShortCut[] createCommunityShortCuts() { - + final java.util.List shortCuts = new ArrayList(); shortCuts.add(new BBSAction()); - + shortCuts.add(SeparatorDef.DEFAULT); - + shortCuts.add(new VideoAction()); - LocaleCenter.buildAction(new LocaleAction() { - @Override - public void execute() { - shortCuts.add(new TutorialAction()); - } - }, SupportLocaleImpl.TUTORIAL_COMMUNITY); + shortCuts.add(new TutorialAction()); shortCuts.add(new QuestionAction()); shortCuts.add(new TechSolutionAction()); - + shortCuts.add(SeparatorDef.DEFAULT); LocaleCenter.buildAction(new LocaleAction() { @@ -606,9 +625,16 @@ public abstract class ToolBarMenuDock { shortCuts.add(new TechSupportAction()); } }, SupportLocaleImpl.TECH_SUPPORT_COMMUNITY); - + + LocaleCenter.buildAction(new LocaleAction() { + @Override + public void execute() { + shortCuts.add(new TutorialAction()); + } + }, SupportLocaleImpl.TUTORIAL_COMMUNITY); + shortCuts.add(SeparatorDef.DEFAULT); - + shortCuts.add(new CenterAction()); shortCuts.add(new SignAction()); LocaleCenter.buildAction(new LocaleAction() { @@ -632,7 +658,10 @@ public abstract class ToolBarMenuDock { public MenuDef createCommunityMenuDef() { - MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"), 'C'); + MenuDef menuDef = new SnapChatMenuDef( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"), + 'C', + SnapChatAllTypes.Menu.BBS); ShortCut[] otherCommunityShortCuts = createCommunityShortCuts(); for (ShortCut shortCut : otherCommunityShortCuts) { menuDef.addShortCut(shortCut); diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java index 2aaa9556b..9a6205cf4 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java @@ -10,7 +10,6 @@ import com.fr.design.update.ui.dialog.UpdateMainDialog; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; -import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; import com.fr.workspace.Workspace; @@ -18,7 +17,6 @@ import com.fr.workspace.WorkspaceEvent; import javax.swing.*; import java.io.File; -import java.util.Locale; /** * @author richie @@ -29,7 +27,6 @@ public class UpmFinder { private static final String UPM_DIR = "/upm"; private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html"; - private static final String JXBROWSER = "com.teamdev.jxbrowser.chromium.Browser"; public static String installHome = FRContext.getCommonOperator().getWebRootPath(); @@ -59,49 +56,39 @@ public class UpmFinder { } public static void showUPMDialog() { - boolean hasJxBrowser = true; + boolean flag = true; try { - Class.forName(JXBROWSER); + Class.forName("com.teamdev.jxbrowser.chromium.Browser"); } catch (ClassNotFoundException e) { - hasJxBrowser = false; + flag = false; } - if (hasJxBrowser) { - showUpmPane(); - } else { - showUpdatePane(); - } - } - - private static void showUpmPane() { - if (!checkUPMResourcesExist()){ - // upm下载 - int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"), - Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); - if (val == JOptionPane.OK_OPTION){ - try { - UpmResourceLoader.INSTANCE.download(); - UpmResourceLoader.INSTANCE.install(); - FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), - Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); - } catch (Exception e){ - FineLoggerFactory.getLogger().error(e.getMessage(), e); - FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"), - Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); + if (flag) { + if (!checkUPMResourcesExist()){ + // upm下载 + int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"), + Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); + if (val == JOptionPane.OK_OPTION){ + try { + UpmResourceLoader.INSTANCE.download(); + UpmResourceLoader.INSTANCE.install(); + FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), + Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); + } catch (Exception e){ + FineLoggerFactory.getLogger().error(e.getMessage(), e); + FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"), + Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); + } } } - } - else { - UpmShowPane upmPane = new UpmShowPane(); - if (dialog == null) { - dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane); + else { + UpmShowPane upmPane = new UpmShowPane(); + if (dialog == null) { + dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane); + } + dialog.setVisible(true); } - dialog.setVisible(true); - } - } - - private static void showUpdatePane() { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); - if (!GeneralContext.getLocale().equals(Locale.JAPAN)) { + } else { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); dialog.setAutoUpdateAfterInit(); dialog.showDialog(); From 64771ff47e5506a535874ea9a65117cd0b8ea834 Mon Sep 17 00:00:00 2001 From: bryant Date: Mon, 2 Nov 2020 10:50:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-42577=20=E6=97=A5=E6=96=87=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=8D=87=E7=BA=A7=E5=B1=8F=E8=94=BD=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/locale/impl/SupportLocaleImpl.java | 12 +++++------- .../design/mainframe/toolbar/ToolBarMenuDock.java | 14 ++++++-------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java b/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java index e192336d6..d026138a7 100644 --- a/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java +++ b/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java @@ -138,8 +138,9 @@ public enum SupportLocaleImpl implements SupportLocale { @Override public Set support() { Set set = new HashSet(); - set.add(Locale.CHINA); - set.add(Locale.TAIWAN); + set.add(Locale.US); + set.add(Locale.KOREA); + set.add(Locale.JAPAN); return set; } }, @@ -151,12 +152,9 @@ public enum SupportLocaleImpl implements SupportLocale { @Override public Set support() { Set set = new HashSet(); - set.add(Locale.US); - set.add(Locale.KOREA); - set.add(Locale.JAPAN); + set.add(Locale.CHINA); + set.add(Locale.TAIWAN); return set; } } - - } 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 af03c2ef8..33df99cac 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 @@ -592,7 +592,12 @@ public abstract class ToolBarMenuDock { shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(new VideoAction()); - shortCuts.add(new TutorialAction()); + LocaleCenter.buildAction(new LocaleAction() { + @Override + public void execute() { + shortCuts.add(new TutorialAction()); + } + }, SupportLocaleImpl.TUTORIAL_COMMUNITY); shortCuts.add(new QuestionAction()); shortCuts.add(new TechSolutionAction()); @@ -626,13 +631,6 @@ public abstract class ToolBarMenuDock { } }, SupportLocaleImpl.TECH_SUPPORT_COMMUNITY); - LocaleCenter.buildAction(new LocaleAction() { - @Override - public void execute() { - shortCuts.add(new TutorialAction()); - } - }, SupportLocaleImpl.TUTORIAL_COMMUNITY); - shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(new CenterAction());