From 0b2406d64c1a6094ef6f37e3a091df1cfd3e309f Mon Sep 17 00:00:00 2001 From: pengda Date: Fri, 27 Sep 2019 17:51:55 +0800 Subject: [PATCH 01/11] =?UTF-8?q?REPORT-19946=20=20Linux=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/RestartHelper.java | 21 ++++++++++++++++--- .../actions/server/ConnectionListAction.java | 3 ++- .../actions/server/PluginManagerAction.java | 12 ++++++++--- .../gui/iprogressbar/ProgressDialog.java | 5 ++++- .../fr/design/mainframe/DesignerFrame.java | 12 +++++++++-- .../mainframe/toolbar/ToolBarMenuDock.java | 3 ++- .../update/actions/SoftwareUpdateAction.java | 13 +++++++++--- .../push/DesignerPushUpdateManager.java | 11 +++++----- .../src/main/java/com/fr/start/Demo.java | 20 +++++++++++++----- .../design/mainframe/bbs/UserInfoLabel.java | 10 +++++++-- .../fr/start/module/DesignerActivator.java | 5 ++++- 11 files changed, 88 insertions(+), 27 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 7f2aeeb78..09fcf83b8 100644 --- a/designer-base/src/main/java/com/fr/design/RestartHelper.java +++ b/designer-base/src/main/java/com/fr/design/RestartHelper.java @@ -5,7 +5,7 @@ import com.fr.general.ComparatorUtils; import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; -import com.fr.stable.OperatingSystem; +import com.fr.stable.os.OperatingSystem; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -168,10 +168,13 @@ public class RestartHelper { }catch (Exception e){ FineLoggerFactory.getLogger().error(e.getMessage(), e); } - if (OperatingSystem.isMacOS()) { + if (OperatingSystem.isMacos()) { restartInMacOS(installHome, filesToBeDelete); - } else { + } else if(OperatingSystem.isWindows()){ restartInWindows(installHome, filesToBeDelete); + }else{ + //增加一个Linux系统 + restartInLinux(installHome,filesToBeDelete); } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); @@ -210,4 +213,16 @@ public class RestartHelper { builder.command(commands); builder.start(); } + + private static void restartInLinux(String installHome, String[] filesToBeDelete) throws Exception { + ProcessBuilder builder = new ProcessBuilder(); + List commands = new ArrayList(); + //现在先写的是restart.sh + commands.add(installHome + File.separator + "bin" + File.separator + "restart.sh"); + if (ArrayUtils.isNotEmpty(filesToBeDelete)) { + commands.add(StableUtils.join(filesToBeDelete, "+")); + } + builder.command(commands); + builder.start(); + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 76b11b2ff..13050da33 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -16,6 +16,7 @@ import com.fr.design.menu.MenuKeySet; import com.fr.design.dcm.UniversalDatabaseOpener; import com.fr.file.ConnectionConfig; import com.fr.general.IOUtils; +import com.fr.stable.os.OperatingSystem; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; @@ -60,7 +61,7 @@ public class ConnectionListAction extends UpdateAction { * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { - if (ServerPreferenceConfig.getInstance().isUseUniverseDBM()) { + if (ServerPreferenceConfig.getInstance().isUseUniverseDBM() && !OperatingSystem.isLinux()) { UniversalDatabaseOpener.showUniverseDatabaseDialog(); } else { openDesignDatabaseManager(); diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java index 1b7d7bbc4..6739bbef2 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java @@ -5,7 +5,10 @@ import com.fr.design.actions.UpdateAction; import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.menu.MenuKeySet; import com.fr.design.upm.UpmFinder; +import com.fr.design.utils.DesignUtils; import com.fr.general.IOUtils; +import com.fr.stable.os.Arch; +import com.fr.stable.os.OperatingSystem; import javax.swing.*; import java.awt.event.ActionEvent; @@ -16,18 +19,21 @@ import java.awt.event.ActionEvent; * @since 8.0 */ public class PluginManagerAction extends UpdateAction { - + private static String PLUGIN_MANAGER_ROUTE = "#management/plugin"; public PluginManagerAction() { this.setMenuKeySet(PLUGIN_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/server/plugin.png")); } - @Override public void actionPerformed(ActionEvent e) { // 可以启用新版本的插件商店(使用JxBrowser作为容器) - if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM()) { + if(Arch.getArch() == Arch.ARM){ + DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null); + return; + } + if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && !OperatingSystem.isLinux()) { UpmFinder.showUPMDialog(); } else { WebViewDlgHelper.createPluginDialog(); diff --git a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java index a9b470a58..74b79bb17 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java +++ b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java @@ -5,6 +5,7 @@ import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; +import com.fr.stable.os.OperatingSystem; import javax.swing.JDialog; import javax.swing.JLabel; @@ -28,7 +29,9 @@ public class ProgressDialog extends UIDialog { setUndecorated(true); setSize(parent.getSize()); setLocationRelativeTo(null); - setOpacity(0.5f); + if(!OperatingSystem.isLinux()) { + setOpacity(0.5f); + } initComponent(); } 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 b422be44e..6bd26479f 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 @@ -58,6 +58,7 @@ 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.Arch; import com.fr.stable.project.ProjectConstants; import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; @@ -456,13 +457,20 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta northEastPane.add(LogMessageBar.getInstance()); TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING); if (processor != null) { - processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane()); + if(Arch.getArch() != Arch.ARM) { + processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane()); + }else{ + //暂时不知道具体插件,先传null + processor.hold(northEastPane, LogMessageBar.getInstance(), null); + } } northEastPane.add(ad.createAlphaFinePane()); if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { ad.createAlphaFinePane().setVisible(false); } - northEastPane.add(ad.createBBSLoginPane()); + if(Arch.getArch() != Arch.ARM) { + northEastPane.add(ad.createBBSLoginPane()); + } } public void initTitleIcon() { 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 262dbe6d5..43acd1f82 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 @@ -70,6 +70,7 @@ import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventType; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; +import com.fr.stable.os.OperatingSystem; import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; import org.jetbrains.annotations.Nullable; @@ -540,7 +541,7 @@ public abstract class ToolBarMenuDock { } shortCuts.add(SeparatorDef.DEFAULT); - if (DesignerEnvManager.getEnvManager().isOpenDebug()) { + if (DesignerEnvManager.getEnvManager().isOpenDebug() && !OperatingSystem.isLinux()) { shortCuts.add(new FineUIAction()); } shortCuts.add(new AboutAction()); diff --git a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java index cb412dcb1..28eb2217d 100644 --- a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java @@ -4,6 +4,8 @@ import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.DesignerContext; import com.fr.design.update.ui.dialog.UpdateMainDialog; +import com.fr.design.utils.DesignUtils; +import com.fr.stable.os.OperatingSystem; import java.awt.event.ActionEvent; @@ -12,7 +14,7 @@ import java.awt.event.ActionEvent; */ public class SoftwareUpdateAction extends UpdateAction { - + private static String UPDATE_ROUTE = "#management/backup"; public SoftwareUpdateAction() { setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_UpdateAndUpgrade")); setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/update/update_new.png")); @@ -26,8 +28,13 @@ public class SoftwareUpdateAction extends UpdateAction { */ @Override public void actionPerformed(ActionEvent e) { - UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); - dialog.showDialog(); + //说之后更新升级要用jxbrowser,Linux下进平台 + if(!OperatingSystem.isLinux()) { + UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); + dialog.showDialog(); + }else{ + DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null); + } } } diff --git a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java index 44cfb146b..0d2b21051 100644 --- a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java +++ b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java @@ -12,6 +12,7 @@ import com.fr.general.http.HttpToolbox; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; +import com.fr.stable.os.OperatingSystem; import com.fr.workspace.WorkContext; import java.util.concurrent.ExecutorService; @@ -87,13 +88,13 @@ public class DesignerPushUpdateManager { public boolean isAutoPushUpdateSupported() { boolean isLocalEnv = WorkContext.getCurrent().isLocal(); boolean isChineseEnv = GeneralContext.isChineseEnv(); - - return isAutoPushUpdateSupported(isLocalEnv, isChineseEnv); + boolean isLinux = OperatingSystem.isLinux(); + return isAutoPushUpdateSupported(isLocalEnv, isChineseEnv,isLinux); } - private boolean isAutoPushUpdateSupported(boolean isLocalEnv, boolean isChineseEnv) { - // 远程设计和非中文环境,都不生效 - return isLocalEnv && isChineseEnv; + private boolean isAutoPushUpdateSupported(boolean isLocalEnv, boolean isChineseEnv,boolean isLinux) { + // 远程设计和非中文环境以及Linux环境,都不生效 + return isLocalEnv && isChineseEnv && !isLinux; } /** diff --git a/designer-base/src/main/java/com/fr/start/Demo.java b/designer-base/src/main/java/com/fr/start/Demo.java index bac5a9b0f..820d71ccf 100644 --- a/designer-base/src/main/java/com/fr/start/Demo.java +++ b/designer-base/src/main/java/com/fr/start/Demo.java @@ -2,7 +2,7 @@ package com.fr.start; import com.fr.log.FineLoggerFactory; -import com.fr.stable.OperatingSystem; +import com.fr.stable.os.OperatingSystem; import com.fr.stable.StableUtils; import java.io.IOException; @@ -17,13 +17,15 @@ public class Demo { String executorPath; - if (OperatingSystem.isMacOS()) { + if (OperatingSystem.isMacos()) { executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app"); - } else { + } else if(OperatingSystem.isWindows()){ executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe demo"); + }else{ + executorPath = StableUtils.pathJoin(installHome, "bin", "designer.sh demo"); } - if (OperatingSystem.isMacOS()) { + if (OperatingSystem.isMacos()) { ProcessBuilder builder = new ProcessBuilder(); builder.command("open", "-a", executorPath, "--args", "demo"); try { @@ -31,7 +33,7 @@ public class Demo { } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - } else { + } else if(OperatingSystem.isWindows()){ // ProcessBuilder这种方式在window下报错:系统找不到指定文件 Runtime rt = Runtime.getRuntime(); try { @@ -39,6 +41,14 @@ public class Demo { } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } + }else{ + //先用和win一样的方式 + Runtime rt = Runtime.getRuntime(); + try { + rt.exec(executorPath); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } } System.exit(0); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java index 7fe8b8ff8..5f0df0d4e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java @@ -28,7 +28,8 @@ import com.fr.general.DateUtils; import com.fr.general.http.HttpClient; import com.fr.log.FineLoggerFactory; import com.fr.stable.EncodeConstants; -import com.fr.stable.OperatingSystem; +import com.fr.stable.os.Arch; +import com.fr.stable.os.OperatingSystem; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -142,7 +143,8 @@ public class UserInfoLabel extends UILabel { @Override public void run() { // vito:最新mac10.12和javafx弹出框初始化时会有大几率卡死在native方法,这里先屏蔽一下。 - if (!FRContext.isChineseEnv() || OperatingSystem.isMacOS()) { + //ARM下暂时也不能用javafx + if (!shouldShowBBSDialog()) { return; } String lastBBSNewsTime = DesignerEnvManager.getEnvManager().getLastShowBBSNewsTime(); @@ -242,6 +244,10 @@ public class UserInfoLabel extends UILabel { } } + private static boolean shouldShowBBSDialog(){ + return FRContext.isChineseEnv() && !OperatingSystem.isMacos() && Arch.getArch() != Arch.ARM; + } + public String getUserName() { return userName; } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 822a332f3..ddb268ade 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -91,6 +91,7 @@ import com.fr.report.cell.painter.CellImagePainter; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; +import com.fr.stable.os.Arch; import com.fr.stable.plugin.ExtraDesignClassManagerProvider; import com.fr.stable.script.CalculatorProviderContext; import com.fr.stable.script.ValueConverter; @@ -125,7 +126,9 @@ public class DesignerActivator extends Activator { designerModuleStart(); loadLogAppender(); DesignerSocketIO.update(); - UserInfoPane.getInstance().updateBBSUserInfo(); + if(Arch.getArch() != Arch.ARM) { + UserInfoPane.getInstance().updateBBSUserInfo(); + } storePassport(); AlphaFineHelper.switchConfig4Locale(); } From 37ac3633126de59d97a601ae6e776b88097991ed Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 9 Oct 2019 09:40:35 +0800 Subject: [PATCH 02/11] =?UTF-8?q?REPORT-19946=20Linux=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/server/ConnectionListAction.java | 25 +++---- .../actions/server/PluginManagerAction.java | 21 ++---- .../gui/iprogressbar/ProgressDialog.java | 13 +++- .../fr/design/mainframe/DesignerFrame.java | 34 ++++++--- .../mainframe/toolbar/ToolBarMenuDock.java | 15 +++- .../design/os/impl/DatabaseDialogAction.java | 73 +++++++++++++++++++ .../com/fr/design/os/impl/PMDialogAction.java | 26 +++++++ .../com/fr/design/os/impl/SupportOSImpl.java | 27 +++++++ .../fr/design/os/impl/UpdateDialogAction.java | 22 ++++++ .../update/actions/SoftwareUpdateAction.java | 17 ++--- .../java/com/fr/design/OSBasedAction.java | 6 ++ .../java/com/fr/design/OSSupportCenter.java | 25 +++++++ .../test/java/com/fr/design/SupportOS.java | 6 ++ .../fr/start/module/DesignerActivator.java | 13 +++- 14 files changed, 259 insertions(+), 64 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java create mode 100644 designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java create mode 100644 designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java create mode 100644 designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java create mode 100644 designer-base/src/test/java/com/fr/design/OSBasedAction.java create mode 100644 designer-base/src/test/java/com/fr/design/OSSupportCenter.java create mode 100644 designer-base/src/test/java/com/fr/design/SupportOS.java diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 13050da33..2b4b13745 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -1,26 +1,17 @@ package com.fr.design.actions.server; - -import com.fr.config.ServerPreferenceConfig; import com.fr.data.impl.Connection; import com.fr.design.actions.UpdateAction; -import com.fr.design.data.datapane.connect.ConnectionManagerPane; import com.fr.design.data.datapane.connect.ConnectionShowPane; import com.fr.design.data.datapane.connect.DatabaseConnectionPane; import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.NameInspector; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; -import com.fr.design.dcm.UniversalDatabaseOpener; +import com.fr.design.os.impl.DatabaseDialogAction; import com.fr.file.ConnectionConfig; import com.fr.general.IOUtils; -import com.fr.stable.os.OperatingSystem; -import com.fr.transaction.CallBackAdaptor; -import com.fr.transaction.Configurations; -import com.fr.transaction.WorkerFacade; - +import com.fr.general.os.OSBasedAction; +import com.fr.general.os.OSSupportCenter; import javax.swing.*; import java.awt.event.ActionEvent; import java.util.Map; @@ -61,14 +52,16 @@ public class ConnectionListAction extends UpdateAction { * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { - if (ServerPreferenceConfig.getInstance().isUseUniverseDBM() && !OperatingSystem.isLinux()) { + /* if (ServerPreferenceConfig.getInstance().isUseUniverseDBM() && !OperatingSystem.isLinux()) { UniversalDatabaseOpener.showUniverseDatabaseDialog(); } else { openDesignDatabaseManager(); - } + }*/ + OSBasedAction osBasedAction = OSSupportCenter.getAction(DatabaseDialogAction.class); + osBasedAction.execute(); } - private void openDesignDatabaseManager() { + /* private void openDesignDatabaseManager() { DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); final ConnectionConfig datasourceManager = ConnectionConfig.getInstance(); final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() { @@ -109,7 +102,7 @@ public class ConnectionListAction extends UpdateAction { }); databaseListDialog.setVisible(true); } - +*/ /** * 更新datasourceManager diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java index 6739bbef2..17ab3bdb2 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java @@ -1,15 +1,11 @@ package com.fr.design.actions.server; -import com.fr.config.ServerPreferenceConfig; import com.fr.design.actions.UpdateAction; -import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.menu.MenuKeySet; -import com.fr.design.upm.UpmFinder; -import com.fr.design.utils.DesignUtils; +import com.fr.design.os.impl.PMDialogAction; import com.fr.general.IOUtils; -import com.fr.stable.os.Arch; -import com.fr.stable.os.OperatingSystem; - +import com.fr.general.os.OSBasedAction; +import com.fr.general.os.OSSupportCenter; import javax.swing.*; import java.awt.event.ActionEvent; @@ -29,15 +25,8 @@ public class PluginManagerAction extends UpdateAction { @Override public void actionPerformed(ActionEvent e) { // 可以启用新版本的插件商店(使用JxBrowser作为容器) - if(Arch.getArch() == Arch.ARM){ - DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null); - return; - } - if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && !OperatingSystem.isLinux()) { - UpmFinder.showUPMDialog(); - } else { - WebViewDlgHelper.createPluginDialog(); - } + OSBasedAction osBasedAction = OSSupportCenter.getAction(PMDialogAction.class); + osBasedAction.execute(); } public static final MenuKeySet PLUGIN_MANAGER = new MenuKeySet() { diff --git a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java index 74b79bb17..f091bccc0 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java +++ b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java @@ -3,8 +3,12 @@ package com.fr.design.gui.iprogressbar; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.os.impl.SupportOSImpl; +import com.fr.design.upm.UpmFinder; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; +import com.fr.general.os.OSBasedAction; +import com.fr.general.os.OSSupportCenter; import com.fr.stable.os.OperatingSystem; import javax.swing.JDialog; @@ -29,9 +33,12 @@ public class ProgressDialog extends UIDialog { setUndecorated(true); setSize(parent.getSize()); setLocationRelativeTo(null); - if(!OperatingSystem.isLinux()) { - setOpacity(0.5f); - } + OSSupportCenter.buildAction(new OSBasedAction() { + @Override + public void execute() { + setOpacity(0.5f); + } + }, SupportOSImpl.OPACITY); initComponent(); } 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 6bd26479f..17cb23273 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 @@ -40,6 +40,7 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.menu.MenuManager; import com.fr.design.menu.ShortCut; +import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.event.EventDispatcher; import com.fr.exception.DecryptTemplateException; @@ -48,6 +49,8 @@ import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; +import com.fr.general.os.OSBasedAction; +import com.fr.general.os.OSSupportCenter; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; @@ -58,7 +61,6 @@ 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.Arch; import com.fr.stable.project.ProjectConstants; import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; @@ -84,6 +86,7 @@ import java.awt.Graphics; import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; +import java.awt.Component; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -450,27 +453,36 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta return northEastPane; } - private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) { + private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) { northEastPane.removeAll(); northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); northEastPane.add(LogMessageBar.getInstance()); TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING); if (processor != null) { - if(Arch.getArch() != Arch.ARM) { - processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane()); - }else{ - //暂时不知道具体插件,先传null - processor.hold(northEastPane, LogMessageBar.getInstance(), null); - } + final Component[] bbsLoginPane = {null}; + OSSupportCenter.buildAction(new OSBasedAction() { + @Override + public void execute() { + bbsLoginPane[0] = ad.createBBSLoginPane(); + } + }, SupportOSImpl.USERINFOPANE); + processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]); } northEastPane.add(ad.createAlphaFinePane()); if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { ad.createAlphaFinePane().setVisible(false); } - if(Arch.getArch() != Arch.ARM) { - northEastPane.add(ad.createBBSLoginPane()); - } + /*if(Arch.getArch() != Arch.ARM) { + + }*/ + OSSupportCenter.buildAction(new OSBasedAction() { + @Override + public void execute() { + northEastPane.add(ad.createBBSLoginPane()); + } + }, SupportOSImpl.USERINFOPANE); + } public void initTitleIcon() { 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 43acd1f82..18b248ffd 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,6 +54,7 @@ import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; +import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.update.actions.SoftwareUpdateAction; import com.fr.design.utils.ThemeUtils; @@ -61,6 +62,8 @@ import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.locale.LocaleAction; import com.fr.general.locale.LocaleCenter; +import com.fr.general.os.OSBasedAction; +import com.fr.general.os.OSSupportCenter; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; @@ -525,7 +528,7 @@ public abstract class ToolBarMenuDock { * @return 帮组菜单的子菜单 */ public ShortCut[] createHelpShortCuts() { - java.util.List shortCuts = new ArrayList(); + final java.util.List shortCuts = new ArrayList(); shortCuts.add(new WebDemoAction()); // 英文,把 video 和帮助文档放到 Help 下面 if (GeneralContext.getLocale().equals(Locale.US)) { @@ -541,8 +544,14 @@ public abstract class ToolBarMenuDock { } shortCuts.add(SeparatorDef.DEFAULT); - if (DesignerEnvManager.getEnvManager().isOpenDebug() && !OperatingSystem.isLinux()) { - shortCuts.add(new FineUIAction()); + if (DesignerEnvManager.getEnvManager().isOpenDebug()) { + OSSupportCenter.buildAction(new OSBasedAction() { + @Override + public void execute() { + shortCuts.add(new FineUIAction()); + } + }, SupportOSImpl.FINEUI); + } shortCuts.add(new AboutAction()); diff --git a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java new file mode 100644 index 000000000..aede9edd9 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java @@ -0,0 +1,73 @@ +package com.fr.design.os.impl; + +import com.fr.config.ServerPreferenceConfig; +import com.fr.design.data.datapane.connect.ConnectionManagerPane; +import com.fr.design.dcm.UniversalDatabaseOpener; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrame; +import com.fr.file.ConnectionConfig; +import com.fr.general.os.OSBasedAction; +import com.fr.stable.os.OperatingSystem; +import com.fr.transaction.CallBackAdaptor; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerFacade; +import static com.fr.design.actions.server.ConnectionListAction.doWithDatasourceManager; + +//数据连接窗口 +public class DatabaseDialogAction implements OSBasedAction { + + @Override + public void execute() { + if (ServerPreferenceConfig.getInstance().isUseUniverseDBM() && !OperatingSystem.isLinux()) { + UniversalDatabaseOpener.showUniverseDatabaseDialog(); + } else { + openDesignDatabaseManager(); + } + } + + private void openDesignDatabaseManager() { + DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); + final ConnectionConfig datasourceManager = ConnectionConfig.getInstance(); + final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() { + public void complete() { + ConnectionConfig connectionConfig = datasourceManager.mirror(); + populate(connectionConfig); + } + + protected void renameConnection(String oldName, String newName) { + datasourceManager.renameConnection(oldName, newName); + } + }; + final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); + databaseListDialog.addDialogActionListener(new DialogActionAdapter() { + public void doOk() { + if (!databaseManagerPane.isNamePermitted()) { + databaseListDialog.setDoOKSucceed(false); + return; + } + Configurations.modify(new WorkerFacade(ConnectionConfig.class) { + @Override + public void run() { + databaseManagerPane.update(datasourceManager); + } + }.addCallBack(new CallBackAdaptor() { + @Override + public boolean beforeCommit() { + //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 + return doWithDatasourceManager(datasourceManager, databaseManagerPane, databaseListDialog); + } + + @Override + public void afterCommit() { + DesignerContext.getDesignerBean("databasename").refreshBeanElement(); + } + })); + } + }); + databaseListDialog.setVisible(true); + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java new file mode 100644 index 000000000..03a111c3d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java @@ -0,0 +1,26 @@ +package com.fr.design.os.impl; + +import com.fr.config.ServerPreferenceConfig; +import com.fr.design.extra.WebViewDlgHelper; +import com.fr.design.upm.UpmFinder; +import com.fr.design.utils.DesignUtils; +import com.fr.general.os.OSBasedAction; +import com.fr.stable.os.Arch; +import com.fr.stable.os.OperatingSystem; + +//插件管理窗口 +public class PMDialogAction implements OSBasedAction { + private static String PLUGIN_MANAGER_ROUTE = "#management/plugin"; + @Override + public void execute() { + if(Arch.getArch() == Arch.ARM){ + DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null); + return; + } + if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && !OperatingSystem.isLinux()) { + UpmFinder.showUPMDialog(); + } else { + WebViewDlgHelper.createPluginDialog(); + } + } +} 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 new file mode 100644 index 000000000..f65ad71eb --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -0,0 +1,27 @@ +package com.fr.design.os.impl; + +import com.fr.general.os.SupportOS; +import com.fr.stable.os.Arch; +import com.fr.stable.os.OperatingSystem; + +public enum SupportOSImpl implements SupportOS { + //登录 + USERINFOPANE{ + public boolean support(){ + return Arch.getArch() != Arch.ARM; + } + }, + //透明度 + OPACITY{ + public boolean support(){ + return !OperatingSystem.isLinux(); + } + }, + //FineUI选项 + FINEUI{ + public boolean support(){ + return !OperatingSystem.isLinux(); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java new file mode 100644 index 000000000..ff437e858 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java @@ -0,0 +1,22 @@ +package com.fr.design.os.impl; + +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.update.ui.dialog.UpdateMainDialog; +import com.fr.design.utils.DesignUtils; +import com.fr.general.os.OSBasedAction; +import com.fr.stable.os.OperatingSystem; + +//更新升级窗口 +public class UpdateDialogAction implements OSBasedAction { + private static String UPDATE_ROUTE = "#management/backup"; + @Override + public void execute() { + if(!OperatingSystem.isLinux()) { + UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); + dialog.showDialog(); + }else{ + DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java index 28eb2217d..9e21afefb 100644 --- a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java @@ -2,11 +2,9 @@ package com.fr.design.update.actions; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.update.ui.dialog.UpdateMainDialog; -import com.fr.design.utils.DesignUtils; -import com.fr.stable.os.OperatingSystem; - +import com.fr.design.os.impl.UpdateDialogAction; +import com.fr.general.os.OSBasedAction; +import com.fr.general.os.OSSupportCenter; import java.awt.event.ActionEvent; /** @@ -14,7 +12,6 @@ import java.awt.event.ActionEvent; */ public class SoftwareUpdateAction extends UpdateAction { - private static String UPDATE_ROUTE = "#management/backup"; public SoftwareUpdateAction() { setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_UpdateAndUpgrade")); setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/update/update_new.png")); @@ -29,12 +26,8 @@ public class SoftwareUpdateAction extends UpdateAction { @Override public void actionPerformed(ActionEvent e) { //说之后更新升级要用jxbrowser,Linux下进平台 - if(!OperatingSystem.isLinux()) { - UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); - dialog.showDialog(); - }else{ - DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null); - } + OSBasedAction osBasedAction = OSSupportCenter.getAction(UpdateDialogAction.class); + osBasedAction.execute(); } } diff --git a/designer-base/src/test/java/com/fr/design/OSBasedAction.java b/designer-base/src/test/java/com/fr/design/OSBasedAction.java new file mode 100644 index 000000000..4e31afab6 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/OSBasedAction.java @@ -0,0 +1,6 @@ +package com.fr.design; + +public interface OSBasedAction { + void execute(); +} + diff --git a/designer-base/src/test/java/com/fr/design/OSSupportCenter.java b/designer-base/src/test/java/com/fr/design/OSSupportCenter.java new file mode 100644 index 000000000..dc031c723 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/OSSupportCenter.java @@ -0,0 +1,25 @@ +package com.fr.design; + +import com.fr.invoke.Reflect; + +import java.util.HashMap; +import java.util.Map; + +public class OSSupportCenter { + + private static Map osBasedActionMap = new HashMap(); + public static void buildAction(OSBasedAction action, SupportOS supportOS){ + if(supportOS.support()){ + action.execute(); + } + } + + public static T getAction(Class clazz) { + OSBasedAction action = osBasedActionMap.get(clazz); + if(action == null){ + action = Reflect.on(clazz).create().get(); + osBasedActionMap.put(clazz,action); + } + return (T) action; + } +} diff --git a/designer-base/src/test/java/com/fr/design/SupportOS.java b/designer-base/src/test/java/com/fr/design/SupportOS.java new file mode 100644 index 000000000..a50688341 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/SupportOS.java @@ -0,0 +1,6 @@ +package com.fr.design; + +public interface SupportOS { + //判断是否支持 + boolean support(); +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index ddb268ade..70dae1f02 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -54,11 +54,14 @@ import com.fr.design.mainframe.form.FormReportComponentComposite; import com.fr.design.mainframe.loghandler.DesignerLogAppender; import com.fr.design.mainframe.socketio.DesignerSocketIO; import com.fr.design.module.DesignModuleFactory; +import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.parameter.FormParameterReader; import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.parameter.WorkBookParameterReader; import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane; import com.fr.form.stable.ElementCaseThumbnailProcessor; +import com.fr.general.os.OSBasedAction; +import com.fr.general.os.OSSupportCenter; import com.fr.general.xml.GeneralXMLTools; import com.fr.js.EmailJavaScript; import com.fr.js.JavaScriptImpl; @@ -126,9 +129,13 @@ public class DesignerActivator extends Activator { designerModuleStart(); loadLogAppender(); DesignerSocketIO.update(); - if(Arch.getArch() != Arch.ARM) { - UserInfoPane.getInstance().updateBBSUserInfo(); - } + OSSupportCenter.buildAction(new OSBasedAction() { + @Override + public void execute() { + UserInfoPane.getInstance().updateBBSUserInfo(); + } + }, SupportOSImpl.USERINFOPANE); + storePassport(); AlphaFineHelper.switchConfig4Locale(); } From db8e23ec40a598789b66adc569d9f44717177bef Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 9 Oct 2019 10:27:17 +0800 Subject: [PATCH 03/11] =?UTF-8?q?REPORT-19946=20Linux=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/server/ConnectionListAction.java | 10 +++------- .../fr/design/actions/server/PluginManagerAction.java | 5 +++-- .../com/fr/design/gui/iprogressbar/ProgressDialog.java | 6 ++---- .../java/com/fr/design/mainframe/DesignerFrame.java | 7 ++----- .../fr/design/mainframe/toolbar/ToolBarMenuDock.java | 5 ++--- .../java/com/fr/design/os}/OSBasedAction.java | 3 +-- .../java/com/fr/design/os}/OSSupportCenter.java | 9 ++++----- .../java/com/fr/design/os}/SupportOS.java | 4 ++-- .../com/fr/design/os/impl/DatabaseDialogAction.java | 2 +- .../java/com/fr/design/os/impl/PMDialogAction.java | 2 +- .../main/java/com/fr/design/os/impl/SupportOSImpl.java | 2 +- .../java/com/fr/design/os/impl/UpdateDialogAction.java | 2 +- .../fr/design/update/actions/SoftwareUpdateAction.java | 5 +++-- .../java/com/fr/start/module/DesignerActivator.java | 5 ++--- 14 files changed, 28 insertions(+), 39 deletions(-) rename designer-base/src/{test/java/com/fr/design => main/java/com/fr/design/os}/OSBasedAction.java (68%) rename designer-base/src/{test/java/com/fr/design => main/java/com/fr/design/os}/OSSupportCenter.java (59%) rename designer-base/src/{test/java/com/fr/design => main/java/com/fr/design/os}/SupportOS.java (73%) diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 2b4b13745..946cfe450 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -7,11 +7,12 @@ import com.fr.design.data.datapane.connect.DatabaseConnectionPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.gui.NameInspector; import com.fr.design.menu.MenuKeySet; +import com.fr.design.os.OSBasedAction; +import com.fr.design.os.OSSupportCenter; import com.fr.design.os.impl.DatabaseDialogAction; import com.fr.file.ConnectionConfig; import com.fr.general.IOUtils; -import com.fr.general.os.OSBasedAction; -import com.fr.general.os.OSSupportCenter; + import javax.swing.*; import java.awt.event.ActionEvent; import java.util.Map; @@ -52,11 +53,6 @@ public class ConnectionListAction extends UpdateAction { * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { - /* if (ServerPreferenceConfig.getInstance().isUseUniverseDBM() && !OperatingSystem.isLinux()) { - UniversalDatabaseOpener.showUniverseDatabaseDialog(); - } else { - openDesignDatabaseManager(); - }*/ OSBasedAction osBasedAction = OSSupportCenter.getAction(DatabaseDialogAction.class); osBasedAction.execute(); } diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java index 17ab3bdb2..96e17fa75 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java @@ -2,10 +2,11 @@ package com.fr.design.actions.server; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; +import com.fr.design.os.OSBasedAction; +import com.fr.design.os.OSSupportCenter; import com.fr.design.os.impl.PMDialogAction; import com.fr.general.IOUtils; -import com.fr.general.os.OSBasedAction; -import com.fr.general.os.OSSupportCenter; + import javax.swing.*; import java.awt.event.ActionEvent; diff --git a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java index f091bccc0..1480d7f12 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java +++ b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java @@ -3,13 +3,11 @@ package com.fr.design.gui.iprogressbar; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.os.OSBasedAction; +import com.fr.design.os.OSSupportCenter; import com.fr.design.os.impl.SupportOSImpl; -import com.fr.design.upm.UpmFinder; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; -import com.fr.general.os.OSBasedAction; -import com.fr.general.os.OSSupportCenter; -import com.fr.stable.os.OperatingSystem; import javax.swing.JDialog; import javax.swing.JLabel; 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 17cb23273..ee2cc2f2e 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 @@ -40,6 +40,8 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.menu.MenuManager; import com.fr.design.menu.ShortCut; +import com.fr.design.os.OSBasedAction; +import com.fr.design.os.OSSupportCenter; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.event.EventDispatcher; @@ -49,8 +51,6 @@ import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; -import com.fr.general.os.OSBasedAction; -import com.fr.general.os.OSSupportCenter; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; @@ -473,9 +473,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { ad.createAlphaFinePane().setVisible(false); } - /*if(Arch.getArch() != Arch.ARM) { - - }*/ OSSupportCenter.buildAction(new OSBasedAction() { @Override public void execute() { 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 18b248ffd..fafc89efa 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,6 +54,8 @@ import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; +import com.fr.design.os.OSBasedAction; +import com.fr.design.os.OSSupportCenter; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.update.actions.SoftwareUpdateAction; @@ -62,8 +64,6 @@ import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.locale.LocaleAction; import com.fr.general.locale.LocaleCenter; -import com.fr.general.os.OSBasedAction; -import com.fr.general.os.OSSupportCenter; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; @@ -73,7 +73,6 @@ import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventType; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import com.fr.stable.os.OperatingSystem; import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; import org.jetbrains.annotations.Nullable; diff --git a/designer-base/src/test/java/com/fr/design/OSBasedAction.java b/designer-base/src/main/java/com/fr/design/os/OSBasedAction.java similarity index 68% rename from designer-base/src/test/java/com/fr/design/OSBasedAction.java rename to designer-base/src/main/java/com/fr/design/os/OSBasedAction.java index 4e31afab6..3a7540d5e 100644 --- a/designer-base/src/test/java/com/fr/design/OSBasedAction.java +++ b/designer-base/src/main/java/com/fr/design/os/OSBasedAction.java @@ -1,6 +1,5 @@ -package com.fr.design; +package com.fr.design.os; public interface OSBasedAction { void execute(); } - diff --git a/designer-base/src/test/java/com/fr/design/OSSupportCenter.java b/designer-base/src/main/java/com/fr/design/os/OSSupportCenter.java similarity index 59% rename from designer-base/src/test/java/com/fr/design/OSSupportCenter.java rename to designer-base/src/main/java/com/fr/design/os/OSSupportCenter.java index dc031c723..9945e2dd7 100644 --- a/designer-base/src/test/java/com/fr/design/OSSupportCenter.java +++ b/designer-base/src/main/java/com/fr/design/os/OSSupportCenter.java @@ -1,21 +1,20 @@ -package com.fr.design; +package com.fr.design.os; import com.fr.invoke.Reflect; - import java.util.HashMap; import java.util.Map; public class OSSupportCenter { - private static Map osBasedActionMap = new HashMap(); + private static Map,OSBasedAction> osBasedActionMap = new HashMap,OSBasedAction>(); public static void buildAction(OSBasedAction action, SupportOS supportOS){ if(supportOS.support()){ action.execute(); } } - public static T getAction(Class clazz) { - OSBasedAction action = osBasedActionMap.get(clazz); + public static T getAction(Class clazz) { + OSBasedAction action = osBasedActionMap.get(clazz); if(action == null){ action = Reflect.on(clazz).create().get(); osBasedActionMap.put(clazz,action); diff --git a/designer-base/src/test/java/com/fr/design/SupportOS.java b/designer-base/src/main/java/com/fr/design/os/SupportOS.java similarity index 73% rename from designer-base/src/test/java/com/fr/design/SupportOS.java rename to designer-base/src/main/java/com/fr/design/os/SupportOS.java index a50688341..9f25b39a2 100644 --- a/designer-base/src/test/java/com/fr/design/SupportOS.java +++ b/designer-base/src/main/java/com/fr/design/os/SupportOS.java @@ -1,6 +1,6 @@ -package com.fr.design; +package com.fr.design.os; public interface SupportOS { //判断是否支持 boolean support(); -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java index aede9edd9..1e7ef3566 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java @@ -7,8 +7,8 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; +import com.fr.design.os.OSBasedAction; import com.fr.file.ConnectionConfig; -import com.fr.general.os.OSBasedAction; import com.fr.stable.os.OperatingSystem; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; diff --git a/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java index 03a111c3d..e853e2aeb 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java @@ -2,9 +2,9 @@ package com.fr.design.os.impl; import com.fr.config.ServerPreferenceConfig; import com.fr.design.extra.WebViewDlgHelper; +import com.fr.design.os.OSBasedAction; import com.fr.design.upm.UpmFinder; import com.fr.design.utils.DesignUtils; -import com.fr.general.os.OSBasedAction; import com.fr.stable.os.Arch; import com.fr.stable.os.OperatingSystem; 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 f65ad71eb..0f1665be0 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 @@ -1,6 +1,6 @@ package com.fr.design.os.impl; -import com.fr.general.os.SupportOS; +import com.fr.design.os.SupportOS; import com.fr.stable.os.Arch; import com.fr.stable.os.OperatingSystem; diff --git a/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java index ff437e858..8047528bf 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java @@ -1,9 +1,9 @@ package com.fr.design.os.impl; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.os.OSBasedAction; import com.fr.design.update.ui.dialog.UpdateMainDialog; import com.fr.design.utils.DesignUtils; -import com.fr.general.os.OSBasedAction; import com.fr.stable.os.OperatingSystem; //更新升级窗口 diff --git a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java index 9e21afefb..eda560ce5 100644 --- a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java @@ -2,9 +2,10 @@ package com.fr.design.update.actions; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; +import com.fr.design.os.OSBasedAction; +import com.fr.design.os.OSSupportCenter; import com.fr.design.os.impl.UpdateDialogAction; -import com.fr.general.os.OSBasedAction; -import com.fr.general.os.OSSupportCenter; + import java.awt.event.ActionEvent; /** diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 70dae1f02..76a4f394a 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -54,14 +54,14 @@ import com.fr.design.mainframe.form.FormReportComponentComposite; import com.fr.design.mainframe.loghandler.DesignerLogAppender; import com.fr.design.mainframe.socketio.DesignerSocketIO; import com.fr.design.module.DesignModuleFactory; +import com.fr.design.os.OSBasedAction; +import com.fr.design.os.OSSupportCenter; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.parameter.FormParameterReader; import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.parameter.WorkBookParameterReader; import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane; import com.fr.form.stable.ElementCaseThumbnailProcessor; -import com.fr.general.os.OSBasedAction; -import com.fr.general.os.OSSupportCenter; import com.fr.general.xml.GeneralXMLTools; import com.fr.js.EmailJavaScript; import com.fr.js.JavaScriptImpl; @@ -94,7 +94,6 @@ import com.fr.report.cell.painter.CellImagePainter; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; -import com.fr.stable.os.Arch; import com.fr.stable.plugin.ExtraDesignClassManagerProvider; import com.fr.stable.script.CalculatorProviderContext; import com.fr.stable.script.ValueConverter; From 0bb7a68b4844739829c8d7ef31201ef449745434 Mon Sep 17 00:00:00 2001 From: pengda Date: Thu, 10 Oct 2019 10:03:59 +0800 Subject: [PATCH 04/11] =?UTF-8?q?REPORT-19946=20Linux=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/server/ConnectionListAction.java | 4 +- .../actions/server/PluginManagerAction.java | 4 +- .../gui/iprogressbar/ProgressDialog.java | 4 +- .../fr/design/mainframe/DesignerFrame.java | 4 +- .../mainframe/toolbar/ToolBarMenuDock.java | 4 +- .../java/com/fr/design/os/OSBasedAction.java | 5 -- .../com/fr/design/os/OSSupportCenter.java | 24 -------- .../main/java/com/fr/design/os/SupportOS.java | 6 -- .../design/os/impl/DatabaseDialogAction.java | 8 ++- .../com/fr/design/os/impl/DemoAction.java | 59 +++++++++++++++++++ .../com/fr/design/os/impl/PMDialogAction.java | 8 ++- .../com/fr/design/os/impl/SupportOSImpl.java | 20 +++++-- .../fr/design/os/impl/UpdateDialogAction.java | 9 ++- .../update/actions/SoftwareUpdateAction.java | 4 +- .../src/main/java/com/fr/start/Demo.java | 53 ++--------------- .../fr/start/module/DesignerActivator.java | 4 +- 16 files changed, 111 insertions(+), 109 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/os/OSBasedAction.java delete mode 100644 designer-base/src/main/java/com/fr/design/os/OSSupportCenter.java delete mode 100644 designer-base/src/main/java/com/fr/design/os/SupportOS.java create mode 100644 designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 946cfe450..15c6cb705 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -7,8 +7,8 @@ import com.fr.design.data.datapane.connect.DatabaseConnectionPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.gui.NameInspector; import com.fr.design.menu.MenuKeySet; -import com.fr.design.os.OSBasedAction; -import com.fr.design.os.OSSupportCenter; +import com.fr.stable.os.support.OSBasedAction; +import com.fr.stable.os.support.OSSupportCenter; import com.fr.design.os.impl.DatabaseDialogAction; import com.fr.file.ConnectionConfig; import com.fr.general.IOUtils; diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java index 96e17fa75..7b41f6fd8 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java @@ -2,10 +2,10 @@ package com.fr.design.actions.server; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; -import com.fr.design.os.OSBasedAction; -import com.fr.design.os.OSSupportCenter; import com.fr.design.os.impl.PMDialogAction; import com.fr.general.IOUtils; +import com.fr.stable.os.support.OSBasedAction; +import com.fr.stable.os.support.OSSupportCenter; import javax.swing.*; import java.awt.event.ActionEvent; diff --git a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java index 1480d7f12..90318823f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java +++ b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java @@ -3,8 +3,8 @@ package com.fr.design.gui.iprogressbar; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.os.OSBasedAction; -import com.fr.design.os.OSSupportCenter; +import com.fr.stable.os.support.OSBasedAction; +import com.fr.stable.os.support.OSSupportCenter; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; 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 ee2cc2f2e..c0183fb0f 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 @@ -40,8 +40,6 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.menu.MenuManager; import com.fr.design.menu.ShortCut; -import com.fr.design.os.OSBasedAction; -import com.fr.design.os.OSSupportCenter; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.event.EventDispatcher; @@ -61,6 +59,8 @@ 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.support.OSBasedAction; +import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.project.ProjectConstants; import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; 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 fafc89efa..c24ac2484 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,8 +54,6 @@ import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; -import com.fr.design.os.OSBasedAction; -import com.fr.design.os.OSSupportCenter; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.update.actions.SoftwareUpdateAction; @@ -73,6 +71,8 @@ import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventType; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; +import com.fr.stable.os.support.OSBasedAction; +import com.fr.stable.os.support.OSSupportCenter; import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; import org.jetbrains.annotations.Nullable; diff --git a/designer-base/src/main/java/com/fr/design/os/OSBasedAction.java b/designer-base/src/main/java/com/fr/design/os/OSBasedAction.java deleted file mode 100644 index 3a7540d5e..000000000 --- a/designer-base/src/main/java/com/fr/design/os/OSBasedAction.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.fr.design.os; - -public interface OSBasedAction { - void execute(); -} diff --git a/designer-base/src/main/java/com/fr/design/os/OSSupportCenter.java b/designer-base/src/main/java/com/fr/design/os/OSSupportCenter.java deleted file mode 100644 index 9945e2dd7..000000000 --- a/designer-base/src/main/java/com/fr/design/os/OSSupportCenter.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.fr.design.os; - -import com.fr.invoke.Reflect; -import java.util.HashMap; -import java.util.Map; - -public class OSSupportCenter { - - private static Map,OSBasedAction> osBasedActionMap = new HashMap,OSBasedAction>(); - public static void buildAction(OSBasedAction action, SupportOS supportOS){ - if(supportOS.support()){ - action.execute(); - } - } - - public static T getAction(Class clazz) { - OSBasedAction action = osBasedActionMap.get(clazz); - if(action == null){ - action = Reflect.on(clazz).create().get(); - osBasedActionMap.put(clazz,action); - } - return (T) action; - } -} diff --git a/designer-base/src/main/java/com/fr/design/os/SupportOS.java b/designer-base/src/main/java/com/fr/design/os/SupportOS.java deleted file mode 100644 index 9f25b39a2..000000000 --- a/designer-base/src/main/java/com/fr/design/os/SupportOS.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.fr.design.os; - -public interface SupportOS { - //判断是否支持 - boolean support(); -} diff --git a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java index 1e7ef3566..a47b94cc1 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java @@ -7,15 +7,19 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; -import com.fr.design.os.OSBasedAction; import com.fr.file.ConnectionConfig; import com.fr.stable.os.OperatingSystem; +import com.fr.stable.os.support.OSBasedAction; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; import static com.fr.design.actions.server.ConnectionListAction.doWithDatasourceManager; -//数据连接窗口 +/** + * 数据连接窗口 + * @author pengda + * @date 2019/10/9 + */ public class DatabaseDialogAction implements OSBasedAction { @Override diff --git a/designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java b/designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java new file mode 100644 index 000000000..412213184 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java @@ -0,0 +1,59 @@ +package com.fr.design.os.impl; + +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StableUtils; +import com.fr.stable.os.OperatingSystem; +import com.fr.stable.os.support.OSBasedAction; + +import java.io.IOException; +/** + * @author pengda + * @date 2019/10/9 + */ +public class DemoAction implements OSBasedAction { + + @Override + public void execute() { + String installHome = StableUtils.getInstallHome(); + if (installHome == null) { + FineLoggerFactory.getLogger().error("Can not find the install home, please check it."); + return; + } + + String executorPath; + + if (OperatingSystem.isMacos()) { + executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app"); + } else if(OperatingSystem.isWindows()){ + executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe demo"); + }else{ + executorPath = StableUtils.pathJoin(installHome, "bin", "designer.sh demo"); + } + + if (OperatingSystem.isMacos()) { + ProcessBuilder builder = new ProcessBuilder(); + builder.command("open", "-a", executorPath, "--args", "demo"); + try { + builder.start(); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } else if(OperatingSystem.isWindows()){ + // ProcessBuilder这种方式在window下报错:系统找不到指定文件 + Runtime rt = Runtime.getRuntime(); + try { + rt.exec(executorPath); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + }else{ + //先用和win一样的方式 + Runtime rt = Runtime.getRuntime(); + try { + rt.exec(executorPath); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java index e853e2aeb..0595d887c 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java @@ -2,13 +2,17 @@ package com.fr.design.os.impl; import com.fr.config.ServerPreferenceConfig; import com.fr.design.extra.WebViewDlgHelper; -import com.fr.design.os.OSBasedAction; import com.fr.design.upm.UpmFinder; import com.fr.design.utils.DesignUtils; import com.fr.stable.os.Arch; import com.fr.stable.os.OperatingSystem; +import com.fr.stable.os.support.OSBasedAction; -//插件管理窗口 +/** + * 插件管理窗口 + * @author pengda + * @date 2019/10/9 + */ public class PMDialogAction implements OSBasedAction { private static String PLUGIN_MANAGER_ROUTE = "#management/plugin"; @Override 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 0f1665be0..dc7ea4954 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 @@ -1,23 +1,33 @@ package com.fr.design.os.impl; -import com.fr.design.os.SupportOS; import com.fr.stable.os.Arch; import com.fr.stable.os.OperatingSystem; - +import com.fr.stable.os.support.SupportOS; +/** + * @author pengda + * @date 2019/10/9 + */ public enum SupportOSImpl implements SupportOS { - //登录 + + /** + * ARM下屏蔽登录 + */ USERINFOPANE{ public boolean support(){ return Arch.getArch() != Arch.ARM; } }, - //透明度 + /** + * Linux系统屏蔽透明度 + */ OPACITY{ public boolean support(){ return !OperatingSystem.isLinux(); } }, - //FineUI选项 + /** + * Linux系统屏蔽FineUI选项 + */ FINEUI{ public boolean support(){ return !OperatingSystem.isLinux(); diff --git a/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java index 8047528bf..f0a2a0ee8 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java @@ -1,12 +1,16 @@ package com.fr.design.os.impl; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.os.OSBasedAction; import com.fr.design.update.ui.dialog.UpdateMainDialog; import com.fr.design.utils.DesignUtils; import com.fr.stable.os.OperatingSystem; +import com.fr.stable.os.support.OSBasedAction; -//更新升级窗口 +/** + * 更新升级窗口 + * @author pengda + * @date 2019/10/9 + */ public class UpdateDialogAction implements OSBasedAction { private static String UPDATE_ROUTE = "#management/backup"; @Override @@ -18,5 +22,4 @@ public class UpdateDialogAction implements OSBasedAction { DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null); } } - } diff --git a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java index eda560ce5..d65d8fec5 100644 --- a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java @@ -2,9 +2,9 @@ package com.fr.design.update.actions; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; -import com.fr.design.os.OSBasedAction; -import com.fr.design.os.OSSupportCenter; import com.fr.design.os.impl.UpdateDialogAction; +import com.fr.stable.os.support.OSBasedAction; +import com.fr.stable.os.support.OSSupportCenter; import java.awt.event.ActionEvent; diff --git a/designer-base/src/main/java/com/fr/start/Demo.java b/designer-base/src/main/java/com/fr/start/Demo.java index 820d71ccf..58f4050fd 100644 --- a/designer-base/src/main/java/com/fr/start/Demo.java +++ b/designer-base/src/main/java/com/fr/start/Demo.java @@ -1,56 +1,13 @@ package com.fr.start; - -import com.fr.log.FineLoggerFactory; -import com.fr.stable.os.OperatingSystem; -import com.fr.stable.StableUtils; - -import java.io.IOException; +import com.fr.design.os.impl.DemoAction; +import com.fr.stable.os.support.OSBasedAction; +import com.fr.stable.os.support.OSSupportCenter; public class Demo { public static void main(String[] args) { - String installHome = StableUtils.getInstallHome(); - if (installHome == null) { - FineLoggerFactory.getLogger().error("Can not find the install home, please check it."); - return; - } - - String executorPath; - - if (OperatingSystem.isMacos()) { - executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app"); - } else if(OperatingSystem.isWindows()){ - executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe demo"); - }else{ - executorPath = StableUtils.pathJoin(installHome, "bin", "designer.sh demo"); - } - - if (OperatingSystem.isMacos()) { - ProcessBuilder builder = new ProcessBuilder(); - builder.command("open", "-a", executorPath, "--args", "demo"); - try { - builder.start(); - } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } else if(OperatingSystem.isWindows()){ - // ProcessBuilder这种方式在window下报错:系统找不到指定文件 - Runtime rt = Runtime.getRuntime(); - try { - rt.exec(executorPath); - } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - }else{ - //先用和win一样的方式 - Runtime rt = Runtime.getRuntime(); - try { - rt.exec(executorPath); - } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - + OSBasedAction osBasedAction = OSSupportCenter.getAction(DemoAction.class); + osBasedAction.execute(); System.exit(0); } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 76a4f394a..38e6c4a6a 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -54,8 +54,6 @@ import com.fr.design.mainframe.form.FormReportComponentComposite; import com.fr.design.mainframe.loghandler.DesignerLogAppender; import com.fr.design.mainframe.socketio.DesignerSocketIO; import com.fr.design.module.DesignModuleFactory; -import com.fr.design.os.OSBasedAction; -import com.fr.design.os.OSSupportCenter; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.parameter.FormParameterReader; import com.fr.design.parameter.ParameterPropertyPane; @@ -94,6 +92,8 @@ import com.fr.report.cell.painter.CellImagePainter; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; +import com.fr.stable.os.support.OSBasedAction; +import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.plugin.ExtraDesignClassManagerProvider; import com.fr.stable.script.CalculatorProviderContext; import com.fr.stable.script.ValueConverter; From 8637ca61e78cda0db123151db731a1b2ccef1103 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Thu, 10 Oct 2019 10:05:14 +0800 Subject: [PATCH 05/11] =?UTF-8?q?REPORT-22291=20=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=8E=A7=E5=88=B6=EF=BC=8C=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=88=9A=E5=8D=87=E7=BA=A7=E5=88=B010.0.4?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E7=A8=8B=EF=BC=8C=E9=BB=98=E8=AE=A4=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/actions/file/PreferencePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 6a8132a60..3c1d7ed4d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -305,7 +305,7 @@ public class PreferencePane extends BasicPane { gcButton.setEnabled(gcEnableCheckBox.isSelected()); } }); - + gcEnableCheckBox.setSelected(GcConfig.getInstance().isGcEnable()); //集群下禁用 if (ClusterBridge.isClusterMode()) { gcEnableCheckBox.setEnabled(false); From ccab3dd2279a12f4eb9771d8da02e05797c44774 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Thu, 10 Oct 2019 14:40:07 +0800 Subject: [PATCH 06/11] =?UTF-8?q?REPORT-20329=20sonar=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java index fcae55615..4ee6fe978 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java @@ -374,7 +374,7 @@ public class SyntaxView extends View implements TabExpander, if (host.isCodeFoldingEnabled()) { visibleLineCount -= host.getFoldManager().getHiddenLineCount(); } - return visibleLineCount * lineHeight; + return (float) visibleLineCount * lineHeight; default: throw new IllegalArgumentException("Invalid axis: " + axis); } From 228010dbe7ff2953f3b6c9ecabb99bdd44dbf3ee Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Thu, 10 Oct 2019 14:44:20 +0800 Subject: [PATCH 07/11] =?UTF-8?q?REPORT-22291=20=E6=92=A4=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/actions/file/PreferencePane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 3c1d7ed4d..72b87d425 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -305,7 +305,6 @@ public class PreferencePane extends BasicPane { gcButton.setEnabled(gcEnableCheckBox.isSelected()); } }); - gcEnableCheckBox.setSelected(GcConfig.getInstance().isGcEnable()); //集群下禁用 if (ClusterBridge.isClusterMode()) { gcEnableCheckBox.setEnabled(false); From 7d541ad364afe53aaa285ff855be40f0588adcf3 Mon Sep 17 00:00:00 2001 From: Maksim Date: Thu, 10 Oct 2019 15:00:57 +0800 Subject: [PATCH 08/11] =?UTF-8?q?sonar=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../syntax/ui/rtextarea/RTextAreaEditorKit.java | 8 ++++---- .../gui/syntax/ui/rtextarea/RTextAreaUI.java | 3 ++- .../main/java/com/fr/design/gui/toast/Toast.java | 4 ++-- .../com/fr/design/layout/FRGUIPaneFactory.java | 16 ++++++++-------- .../com/fr/design/layout/TableLayoutHelper.java | 2 +- .../PatternBackgroundQuickPane.java | 4 ++-- .../TextureBackgroundQuickPane.java | 4 ++-- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java index 277064c2f..de97867fb 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java @@ -741,10 +741,10 @@ public class RTextAreaEditorKit extends DefaultEditorKit { public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { Font font = textArea.getFont(); float oldSize = font.getSize2D(); - float newSize = oldSize - decreaseAmount; + double newSize = (double)oldSize - (double)decreaseAmount; if (newSize>=MINIMUM_SIZE) { // Shrink by decreaseAmount. - font = font.deriveFont(newSize); + font = font.deriveFont((float)newSize); textArea.setFont(font); } else if (oldSize>MINIMUM_SIZE) { @@ -1329,10 +1329,10 @@ public class RTextAreaEditorKit extends DefaultEditorKit { public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { Font font = textArea.getFont(); float oldSize = font.getSize2D(); - float newSize = oldSize + increaseAmount; + double newSize = (double)oldSize + (double)increaseAmount; if (newSize<=MAXIMUM_SIZE) { // Grow by increaseAmount. - font = font.deriveFont(newSize); + font = font.deriveFont((float)newSize); textArea.setFont(font); } else if (oldSize j ? i : j; + double m = (double)(width + WIDTH_OFFSET_M) / (double)WIDTH_PARA_F; + double n = (double)(width + WIDTH_OFFSET_N ) / (double)WIDTH_PARA_F; + double i = Math.abs(((double) ((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m); + double j = Math.abs(((double) ((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n); + double x = i > j ? i : j; if (AssistUtils.equals(x, i)) { - w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M; + w = (int) (Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M); } else if (AssistUtils.equals(x, j)) { - w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N; + w = (int) (Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N); } return w; } @@ -579,7 +579,7 @@ public class FRGUIPaneFactory { */ public static int caculateHeight(int height) { int h = 0; - float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA; + double x = (double)(height + HEIGHT_OFFSET) / HEIGHT_PARA; h = ((int) x + 1) * HEIGHT_PARA; return h; } diff --git a/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java b/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java index b26e057ef..1be77c849 100644 --- a/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java +++ b/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java @@ -372,7 +372,7 @@ public class TableLayoutHelper { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; JPanel jp1 = TableLayoutHelper.createTableLayoutPane(createTestComponents("jp1"), TableLayoutHelper.FILL_NONE); - JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp2"), TableLayoutHelper.FILL_LASTCOL_AND_ROW, 2 * TEN, 2 * TEN); + JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp2"), TableLayoutHelper.FILL_LASTCOL_AND_ROW, (double)2 * TEN, (double)2 * TEN); JPanel jp3 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp3"), new double[]{f, p, f, p}, new double[]{f, f}, 4, 4); JPanel jp4 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp4"), diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java index 5e69d9f82..9da1344dc 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java @@ -164,11 +164,11 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { Graphics2D g2d = (Graphics2D) g; Dimension d = getSize(); - this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1)); + this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0, (double)d.width - 1, (double)d.height - 1)); if (this.pIndex == patternIndex) {// it's selected. g2d.setPaint(UIConstants.LINE_COLOR); - GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1)); + GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, (double)d.width - 1, (double)d.height - 1)); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java index 773498502..0d94bf3bc 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java @@ -101,7 +101,7 @@ public class TextureBackgroundQuickPane extends BackgroundQuickPane { Dimension d = getSize(); g2d.setPaint(this.buttonTexturePaint); - GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1)); + GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, (double) d.width - 1, (double)d.height - 1)); if (ComparatorUtils.equals(texturePaint, this.buttonTexturePaint)) {// it's // selected. @@ -109,7 +109,7 @@ public class TextureBackgroundQuickPane extends BackgroundQuickPane { } else { g2d.setPaint(null); } - GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1)); + GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, (double)d.width - 1, (double) d.height - 1)); } public Dimension getPreferredSize() { From b4ba0de7160223841f29a58941adc9a2df9e94b6 Mon Sep 17 00:00:00 2001 From: pengda Date: Thu, 10 Oct 2019 15:09:13 +0800 Subject: [PATCH 09/11] =?UTF-8?q?REPORT-19946=20Linux=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/RestartHelper.java | 17 ++--- .../design/actions/file/PreferencePane.java | 9 ++- .../gui/iprogressbar/ProgressDialog.java | 2 +- .../fr/design/mainframe/DesignerFrame.java | 4 +- .../mainframe/toolbar/ToolBarMenuDock.java | 2 +- .../design/os/impl/DatabaseDialogAction.java | 2 +- .../com/fr/design/os/impl/DemoAction.java | 2 +- .../com/fr/design/os/impl/PMDialogAction.java | 2 +- .../com/fr/design/os/impl/RestartAction.java | 74 +++++++++++++++++++ .../com/fr/design/os/impl/SupportOSImpl.java | 26 +++++++ .../fr/design/os/impl/UpdateDialogAction.java | 2 +- .../push/DesignerPushUpdateManager.java | 7 +- .../design/mainframe/bbs/UserInfoLabel.java | 10 +-- .../fr/start/module/DesignerActivator.java | 3 +- 14 files changed, 130 insertions(+), 32 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/os/impl/RestartAction.java 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 09fcf83b8..4a0813f32 100644 --- a/designer-base/src/main/java/com/fr/design/RestartHelper.java +++ b/designer-base/src/main/java/com/fr/design/RestartHelper.java @@ -1,6 +1,7 @@ package com.fr.design; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.os.impl.RestartAction; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; @@ -8,6 +9,8 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.os.OperatingSystem; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; +import com.fr.stable.os.support.OSBasedAction; +import com.fr.stable.os.support.OSSupportCenter; import java.io.File; import java.io.FileInputStream; @@ -168,14 +171,8 @@ public class RestartHelper { }catch (Exception e){ FineLoggerFactory.getLogger().error(e.getMessage(), e); } - if (OperatingSystem.isMacos()) { - restartInMacOS(installHome, filesToBeDelete); - } else if(OperatingSystem.isWindows()){ - restartInWindows(installHome, filesToBeDelete); - }else{ - //增加一个Linux系统 - restartInLinux(installHome,filesToBeDelete); - } + OSBasedAction osBasedAction = OSSupportCenter.getAction(RestartAction.class); + osBasedAction.execute(filesToBeDelete); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } finally { @@ -190,7 +187,7 @@ public class RestartHelper { } } - private static void restartInMacOS(String installHome, String[] filesToBeDelete) throws Exception { + /* private static void restartInMacOS(String installHome, String[] filesToBeDelete) throws Exception { ProcessBuilder builder = new ProcessBuilder(); List commands = new ArrayList(); commands.add("open"); @@ -224,5 +221,5 @@ public class RestartHelper { } builder.command(commands); builder.start(); - } + }*/ } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 6a8132a60..20d2af94f 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -28,7 +28,7 @@ import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.common.VcsHelper; -import com.fr.design.update.push.DesignerPushUpdateManager; +import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.general.ComparatorUtils; @@ -213,10 +213,15 @@ public class PreferencePane extends BasicPane { joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve")); improvePane.add(joinProductImproveCheckBox); - if (DesignerPushUpdateManager.getInstance().isAutoPushUpdateSupported()) { + if(SupportOSImpl.AUTOPUSHUPDATE.support()){ autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update")); improvePane.add(autoPushUpdateCheckBox); } + /* + if (DesignerPushUpdateManager.getInstance().isAutoPushUpdateSupported()) { + autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update")); + improvePane.add(autoPushUpdateCheckBox); + }*/ JPanel spaceUpPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); spaceUpPane.add(oraclePane, BorderLayout.NORTH); diff --git a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java index 90318823f..e416083f7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java +++ b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java @@ -33,7 +33,7 @@ public class ProgressDialog extends UIDialog { setLocationRelativeTo(null); OSSupportCenter.buildAction(new OSBasedAction() { @Override - public void execute() { + public void execute(Object... objects) { setOpacity(0.5f); } }, SupportOSImpl.OPACITY); 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 c0183fb0f..56e119d6a 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 @@ -463,7 +463,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta final Component[] bbsLoginPane = {null}; OSSupportCenter.buildAction(new OSBasedAction() { @Override - public void execute() { + public void execute(Object... objects) { bbsLoginPane[0] = ad.createBBSLoginPane(); } }, SupportOSImpl.USERINFOPANE); @@ -475,7 +475,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } OSSupportCenter.buildAction(new OSBasedAction() { @Override - public void execute() { + public void execute(Object... objects) { northEastPane.add(ad.createBBSLoginPane()); } }, SupportOSImpl.USERINFOPANE); 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 c24ac2484..d916d967f 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 @@ -546,7 +546,7 @@ public abstract class ToolBarMenuDock { if (DesignerEnvManager.getEnvManager().isOpenDebug()) { OSSupportCenter.buildAction(new OSBasedAction() { @Override - public void execute() { + public void execute(Object... objects) { shortCuts.add(new FineUIAction()); } }, SupportOSImpl.FINEUI); diff --git a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java index a47b94cc1..7db000493 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java @@ -23,7 +23,7 @@ import static com.fr.design.actions.server.ConnectionListAction.doWithDatasource public class DatabaseDialogAction implements OSBasedAction { @Override - public void execute() { + public void execute(Object... objects) { if (ServerPreferenceConfig.getInstance().isUseUniverseDBM() && !OperatingSystem.isLinux()) { UniversalDatabaseOpener.showUniverseDatabaseDialog(); } else { diff --git a/designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java b/designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java index 412213184..8feb02952 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java @@ -13,7 +13,7 @@ import java.io.IOException; public class DemoAction implements OSBasedAction { @Override - public void execute() { + public void execute(Object... objects) { String installHome = StableUtils.getInstallHome(); if (installHome == null) { FineLoggerFactory.getLogger().error("Can not find the install home, please check it."); diff --git a/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java index 0595d887c..3f2f09728 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java @@ -16,7 +16,7 @@ import com.fr.stable.os.support.OSBasedAction; public class PMDialogAction implements OSBasedAction { private static String PLUGIN_MANAGER_ROUTE = "#management/plugin"; @Override - public void execute() { + public void execute(Object... objects) { if(Arch.getArch() == Arch.ARM){ DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null); return; diff --git a/designer-base/src/main/java/com/fr/design/os/impl/RestartAction.java b/designer-base/src/main/java/com/fr/design/os/impl/RestartAction.java new file mode 100644 index 000000000..b18254c11 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/os/impl/RestartAction.java @@ -0,0 +1,74 @@ +package com.fr.design.os.impl; + +import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StableUtils; +import com.fr.stable.os.OperatingSystem; +import com.fr.stable.os.support.OSBasedAction; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +public class RestartAction implements OSBasedAction { + @Override + public void execute(Object... objects) { + String[] filesToBeDelete = (String[])objects; + String installHome = StableUtils.getInstallHome(); + try{ + if (OperatingSystem.isMacos()) { + restartInMacOS(installHome, filesToBeDelete); + } else if(OperatingSystem.isWindows()){ + restartInWindows(installHome, filesToBeDelete); + }else{ + //增加一个Linux系统 + restartInLinux(installHome,filesToBeDelete); + } + }catch(Exception e){ + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + + } + + private static void restartInMacOS(String installHome, String[] filesToBeDelete) throws Exception { + ProcessBuilder builder = new ProcessBuilder(); + List commands = new ArrayList(); + commands.add("open"); + commands.add(installHome + File.separator + "bin" + File.separator + "restart.app"); + if (ArrayUtils.isNotEmpty(filesToBeDelete)) { + commands.add("--args"); + commands.add(StableUtils.join(filesToBeDelete, "+")); + } + builder.command(commands); + builder.start(); + } + + private static void restartInWindows(String installHome, String[] filesToBeDelete) throws Exception { + ProcessBuilder builder = new ProcessBuilder(); + List commands = new ArrayList(); + commands.add(installHome + File.separator + "bin" + File.separator + "restart.exe"); + if (ArrayUtils.isNotEmpty(filesToBeDelete)) { + commands.add(StableUtils.join(filesToBeDelete, "+")); + } + builder.command(commands); + builder.start(); + } + + private static void restartInLinux(String installHome, String[] filesToBeDelete) throws Exception { + ProcessBuilder builder = new ProcessBuilder(); + List commands = new ArrayList(); + //现在先写的是restart.sh + commands.add(installHome + File.separator + "bin" + File.separator + "restart.sh"); + if (ArrayUtils.isNotEmpty(filesToBeDelete)) { + commands.add(StableUtils.join(filesToBeDelete, "+")); + } + builder.command(commands); + builder.start(); + } + + + + + + + +} 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 dc7ea4954..31aac9aa1 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 @@ -1,8 +1,12 @@ package com.fr.design.os.impl; +import com.fr.base.FRContext; +import com.fr.general.GeneralContext; import com.fr.stable.os.Arch; import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.support.SupportOS; +import com.fr.workspace.WorkContext; + /** * @author pengda * @date 2019/10/9 @@ -32,6 +36,28 @@ public enum SupportOSImpl implements SupportOS { public boolean support(){ return !OperatingSystem.isLinux(); } + }, + /** + * 自动更新推送 + */ + AUTOPUSHUPDATE{ + @Override + public boolean support() { + boolean isLocalEnv = WorkContext.getCurrent().isLocal(); + boolean isChineseEnv = GeneralContext.isChineseEnv(); + boolean isLinux = OperatingSystem.isLinux(); + // 远程设计和非中文环境以及Linux环境,都不生效 + return isLocalEnv && isChineseEnv && !isLinux; + } + }, + /** + * BBS窗口 + */ + BBSDIALOG{ + @Override + public boolean support() { + return FRContext.isChineseEnv() && !OperatingSystem.isMacos() && Arch.getArch() != Arch.ARM; + } } } diff --git a/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java index f0a2a0ee8..64f8f2112 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java @@ -14,7 +14,7 @@ import com.fr.stable.os.support.OSBasedAction; public class UpdateDialogAction implements OSBasedAction { private static String UPDATE_ROUTE = "#management/backup"; @Override - public void execute() { + public void execute(Object... objects) { if(!OperatingSystem.isLinux()) { UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); dialog.showDialog(); diff --git a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java index 0d2b21051..afec652b3 100644 --- a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java +++ b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java @@ -4,6 +4,7 @@ import com.fr.concurrent.NamedThreadFactory; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; +import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.update.ui.dialog.UpdateMainDialog; import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; @@ -13,6 +14,8 @@ import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.stable.os.OperatingSystem; +import com.fr.stable.os.support.OSBasedAction; +import com.fr.stable.os.support.OSSupportCenter; import com.fr.workspace.WorkContext; import java.util.concurrent.ExecutorService; @@ -130,8 +133,8 @@ public class DesignerPushUpdateManager { initUpdateInfo(currentVersion, latestVersion); } } - - return isAutoPushUpdateSupported() && updateInfo.hasNewPushVersion(); + return SupportOSImpl.AUTOPUSHUPDATE.support() && updateInfo.hasNewPushVersion(); + // return isAutoPushUpdateSupported(). && updateInfo.hasNewPushVersion(); } private boolean isValidJarVersion(String fullCurrentVersion, String fullLatestVersion) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java index 5f0df0d4e..6e423e172 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java @@ -16,6 +16,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.upm.event.CertificateEvent; import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.gui.GUICoreUtils; @@ -28,11 +29,8 @@ import com.fr.general.DateUtils; import com.fr.general.http.HttpClient; import com.fr.log.FineLoggerFactory; import com.fr.stable.EncodeConstants; -import com.fr.stable.os.Arch; -import com.fr.stable.os.OperatingSystem; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; - import javax.swing.SwingConstants; import java.awt.Cursor; import java.awt.Desktop; @@ -144,7 +142,7 @@ public class UserInfoLabel extends UILabel { public void run() { // vito:最新mac10.12和javafx弹出框初始化时会有大几率卡死在native方法,这里先屏蔽一下。 //ARM下暂时也不能用javafx - if (!shouldShowBBSDialog()) { + if (!SupportOSImpl.BBSDIALOG.support()) { return; } String lastBBSNewsTime = DesignerEnvManager.getEnvManager().getLastShowBBSNewsTime(); @@ -244,10 +242,6 @@ public class UserInfoLabel extends UILabel { } } - private static boolean shouldShowBBSDialog(){ - return FRContext.isChineseEnv() && !OperatingSystem.isMacos() && Arch.getArch() != Arch.ARM; - } - public String getUserName() { return userName; } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 38e6c4a6a..04d42d9ed 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -130,11 +130,10 @@ public class DesignerActivator extends Activator { DesignerSocketIO.update(); OSSupportCenter.buildAction(new OSBasedAction() { @Override - public void execute() { + public void execute(Object... objects) { UserInfoPane.getInstance().updateBBSUserInfo(); } }, SupportOSImpl.USERINFOPANE); - storePassport(); AlphaFineHelper.switchConfig4Locale(); } From 9825e2811822776648d003a4d5c2220f142a77af Mon Sep 17 00:00:00 2001 From: pengda Date: Thu, 10 Oct 2019 15:14:44 +0800 Subject: [PATCH 10/11] =?UTF-8?q?REPORT-19946=20Linux=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../update/push/DesignerPushUpdateManager.java | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java index afec652b3..dcc282c53 100644 --- a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java +++ b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java @@ -85,21 +85,6 @@ public class DesignerPushUpdateManager { return StringUtils.EMPTY; } - /** - * "自动更新推送"选项是否生效 - */ - public boolean isAutoPushUpdateSupported() { - boolean isLocalEnv = WorkContext.getCurrent().isLocal(); - boolean isChineseEnv = GeneralContext.isChineseEnv(); - boolean isLinux = OperatingSystem.isLinux(); - return isAutoPushUpdateSupported(isLocalEnv, isChineseEnv,isLinux); - } - - private boolean isAutoPushUpdateSupported(boolean isLocalEnv, boolean isChineseEnv,boolean isLinux) { - // 远程设计和非中文环境以及Linux环境,都不生效 - return isLocalEnv && isChineseEnv && !isLinux; - } - /** * 检查更新,如果有合适的更新版本,则弹窗 */ @@ -134,7 +119,6 @@ public class DesignerPushUpdateManager { } } return SupportOSImpl.AUTOPUSHUPDATE.support() && updateInfo.hasNewPushVersion(); - // return isAutoPushUpdateSupported(). && updateInfo.hasNewPushVersion(); } private boolean isValidJarVersion(String fullCurrentVersion, String fullLatestVersion) { From c004e4172b8b7890fcf8a552c58be647ddd41931 Mon Sep 17 00:00:00 2001 From: author Date: Thu, 10 Oct 2019 16:17:36 +0800 Subject: [PATCH 11/11] =?UTF-8?q?REPORT-22587=20=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86=EF=BC=8C=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E8=B5=84=E6=BA=90=E4=BA=A4=E4=BA=92=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/upm/UpmFinder.java | 29 ++++++-- .../java/com/fr/design/upm/UpmShowPane.java | 69 ++++++++++--------- 2 files changed, 60 insertions(+), 38 deletions(-) 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 cf7716aa3..5238b0c65 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 @@ -1,6 +1,7 @@ package com.fr.design.upm; import com.fr.base.FRContext; +import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader; import com.fr.design.dialog.UIDialog; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; @@ -8,6 +9,7 @@ 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.log.FineLoggerFactory; import com.fr.stable.StableUtils; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; @@ -60,11 +62,30 @@ public class UpmFinder { flag = false; } if (flag) { - UpmShowPane upmPane = new UpmShowPane(); - if (dialog == null) { - dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane); + if (!checkUPMResourcesExist()){ + // upm下载 + int val = JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); + if (val == JOptionPane.OK_OPTION){ + try { + UpmResourceLoader.INSTANCE.download(); + UpmResourceLoader.INSTANCE.install(); + JOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), + Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE); + } catch (Exception e){ + FineLoggerFactory.getLogger().error(e.getMessage(), e); + JOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"), + Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE); + } + } + } + else { + UpmShowPane upmPane = new UpmShowPane(); + if (dialog == null) { + dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane); + } + dialog.setVisible(true); } - dialog.setVisible(true); } else { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java b/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java index 31e44c8ab..1bc4b9e94 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java @@ -29,40 +29,41 @@ public class UpmShowPane extends BasicPane { UpmShowPane() { setLayout(new BorderLayout()); - if (UpmFinder.checkUPMResourcesExist()) { - modernUIPane = new ModernUIPane.Builder<>() - .prepare(new ScriptContextAdapter() { - @Override - public void onScriptContextCreated(ScriptContextEvent event) { - JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); - window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); - } - }) - .withURL(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()) - .build(); - EventDispatcher.listen(DownloadEvent.UPDATE, new Listener() { - @Override - public void on(Event event, String param) { - modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()); - } - }); - } else { - modernUIPane = new ModernUIPane.Builder<>() - .withComponent(WarnComponent.KEY) - .prepare(new ScriptContextAdapter() { - @Override - public void onScriptContextCreated(ScriptContextEvent event) { - JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); - window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); - } - }).build(); - EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener() { - @Override - public void on(Event event, String param) { - modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()); - } - }); - } +// 先屏蔽掉这个判断,后续可能修改交互 +// if (UpmFinder.checkUPMResourcesExist()) { + modernUIPane = new ModernUIPane.Builder<>() + .prepare(new ScriptContextAdapter() { + @Override + public void onScriptContextCreated(ScriptContextEvent event) { + JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); + window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); + } + }) + .withURL(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()) + .build(); + EventDispatcher.listen(DownloadEvent.UPDATE, new Listener() { + @Override + public void on(Event event, String param) { + modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()); + } + }); +// } else { +// modernUIPane = new ModernUIPane.Builder<>() +// .withComponent(WarnComponent.KEY) +// .prepare(new ScriptContextAdapter() { +// @Override +// public void onScriptContextCreated(ScriptContextEvent event) { +// JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); +// window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); +// } +// }).build(); +// EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener() { +// @Override +// public void on(Event event, String param) { +// modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()); +// } +// }); +// } add(modernUIPane, BorderLayout.CENTER); } }