Browse Source

ct

persist/11.0
neil 5 years ago
parent
commit
3c0e846d7f
  1. 32
      designer-base/src/main/java/com/fr/design/RestartHelper.java

32
designer-base/src/main/java/com/fr/design/RestartHelper.java

@ -1,7 +1,7 @@
package com.fr.design; package com.fr.design;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.RestartAction; import com.fr.design.os.impl.RestartAction;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -9,9 +9,7 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSBasedAction;
import com.fr.workspace.WorkContext; import com.fr.stable.os.support.OSSupportCenter;
import javax.swing.*;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; 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 RECORD_FILE = StableUtils.pathJoin(StableUtils.getInstallHome(), "delete.properties");
public static final String MOVE_FILE = StableUtils.pathJoin(StableUtils.getInstallHome(), "move.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中 * 把要删除的文件都记录到delete.properties中
* *
@ -144,20 +141,6 @@ public class RestartHelper {
restart(ArrayUtils.EMPTY_STRING_ARRAY); 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); restartAction.execute(filesToBeDelete);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally { }finally {
try { try {
if (null != randomAccessFile) { if (null != randomAccessFile) {
randomAccessFile.close(); randomAccessFile.close();
@ -196,5 +179,12 @@ public class RestartHelper {
} }
DesignerContext.getDesignerFrame().exit(); DesignerContext.getDesignerFrame().exit();
} }
}
/**
* 提前初始化重启动作
*/
public static void initRestartAction(){
restartAction = OSSupportCenter.getAction(RestartAction.class);
} }
} }
Loading…
Cancel
Save