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 cdb4fc532..5720629e7 100644 --- a/designer-base/src/main/java/com/fr/design/RestartHelper.java +++ b/designer-base/src/main/java/com/fr/design/RestartHelper.java @@ -1,7 +1,7 @@ package com.fr.design; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.os.impl.RestartAction; +import com.fr.design.mainframe.DesignerContext; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; @@ -9,9 +9,7 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.os.support.OSBasedAction; -import com.fr.workspace.WorkContext; - -import javax.swing.*; +import com.fr.stable.os.support.OSSupportCenter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -31,8 +29,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 final OSBasedAction restartAction = new RestartAction(); - + private static OSBasedAction restartAction; /** * 把要删除的文件都记录到delete.properties中 * @@ -144,20 +141,6 @@ public class RestartHelper { restart(ArrayUtils.EMPTY_STRING_ARRAY); } - public static void restartForUpdate(JFrame frame) { - try { - restartAction.execute(ArrayUtils.EMPTY_STRING_ARRAY); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } finally { - WorkContext.getCurrent().close(); - frame.dispose(); - System.exit(0); - } - } - - - /** * 重启设计器并删除某些特定的文件 * @@ -186,7 +169,7 @@ public class RestartHelper { restartAction.execute(filesToBeDelete); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - } finally { + }finally { try { if (null != randomAccessFile) { randomAccessFile.close(); @@ -196,5 +179,12 @@ public class RestartHelper { } DesignerContext.getDesignerFrame().exit(); } + + } + /** + * 提前初始化重启动作 + */ + public static void initRestartAction(){ + restartAction = OSSupportCenter.getAction(RestartAction.class); } } \ No newline at end of file