From 5220af6b8320ef3a83f4d4c31d16fd44d3e8f928 Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 16 Oct 2019 10:24:05 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-22779=20=E6=9B=B4=E6=96=B0=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E5=90=8E=E9=87=8D=E5=90=AF=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/RestartHelper.java | 44 ++++--------------- .../fr/start/module/DesignerActivator.java | 2 + 2 files changed, 10 insertions(+), 36 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 4a0813f32..1fef32bb3 100644 --- a/designer-base/src/main/java/com/fr/design/RestartHelper.java +++ b/designer-base/src/main/java/com/fr/design/RestartHelper.java @@ -33,7 +33,7 @@ public class RestartHelper { public static final String RECORD_FILE = StableUtils.pathJoin(StableUtils.getInstallHome(), "delete.properties"); public static final String MOVE_FILE = StableUtils.pathJoin(StableUtils.getInstallHome(), "move.properties"); - + private static OSBasedAction restartAction; /** * 把要删除的文件都记录到delete.properties中 @@ -171,8 +171,8 @@ public class RestartHelper { }catch (Exception e){ FineLoggerFactory.getLogger().error(e.getMessage(), e); } - OSBasedAction osBasedAction = OSSupportCenter.getAction(RestartAction.class); - osBasedAction.execute(filesToBeDelete); + + restartAction.execute(filesToBeDelete); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } finally { @@ -187,39 +187,11 @@ public class RestartHelper { } } - /* 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(); + /** + * 提前初始化重启动作 + */ + public static void initRestartAction(){ + restartAction = OSSupportCenter.getAction(RestartAction.class); } - 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-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 1727906fb..051857c33 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 @@ -11,6 +11,7 @@ import com.fr.config.MarketConfig; import com.fr.decision.update.backup.RecoverManager; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.RestartHelper; import com.fr.design.actions.NewFormAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.BiasCellAction; @@ -139,6 +140,7 @@ public class DesignerActivator extends Activator { storePassport(); AlphaFineHelper.switchConfig4Locale(); RecoverManager.register(new RecoverForDesigner()); + RestartHelper.initRestartAction(); } @Override