Browse Source

Merge pull request #1223 in DESIGN/design from ~BRYANT/design:release/10.0 to release/10.0

* commit '091d310f3fa7609c38619d5f7a464703b62957a1':
  REPORT-23155 解决从新版本退回到老版本的还原按钮问题
  REPORT-23155 解决从新版本退回到老版本的还原按钮问题
feature/big-screen
Bryant 5 years ago
parent
commit
c1cce73fed
  1. 65
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java

65
designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java

@ -143,7 +143,6 @@ public class RestoreResultDialog extends JDialog {
jTextArea.setFont(new Font("Default", Font.PLAIN, 12));
infoPane.add(jTextArea);
pane.add(infoPane, BorderLayout.CENTER);
this.setSize(RESTORE_OLD_VERSION);
this.setTitle(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Updater_Restore_to_V8"));
}
@ -162,34 +161,68 @@ public class RestoreResultDialog extends JDialog {
List<String> list = new ArrayList<>();
String installHome = StableUtils.getInstallHome();
putJarBackupFilesToInstallLib(installHome, map, list);
putJarBackupFilesToInstallEnv(installHome, map, list);
filesToMove(installHome, map);
filesToDelete(installHome, list);
RestartHelper.saveFilesWhichToMove(map);
RestartHelper.saveFilesWhichToDelete(list.toArray(new String[list.size()]));
}
private void putJarBackupFilesToInstallLib(String installHome, Map<String, String> map, List<String> list) {
private void filesToMove(String installHome, Map<String, String> map) {
String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR;
String envHome = WorkContext.getCurrent().getPath();
File installLib = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.DESIGNERBACKUPPATH));
File[] files = installLib.listFiles();
if (files != null) {
for (File file : files) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
list.add(StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
File envLib = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.BACKUPPATH));
File[] files;
if (installLib.exists() && envLib.exists()) {
files = installLib.listFiles();
if (files != null) {
for (File file : files) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
}
}
files = envLib.listFiles();
if (files != null) {
for (File file : files) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(envHome, ProjectConstants.LIB_NAME, file.getName()));
}
}
} else {
installLib = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir));
files = installLib.listFiles();
if (files != null) {
for (File file : files) {
if (file.getName().contains(UpdateConstants.DESIGNER) || file.getName().equals(UpdateConstants.ASPECTJRT)) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
} else {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(envHome, ProjectConstants.LIB_NAME, file.getName()));
}
}
}
}
}
private void putJarBackupFilesToInstallEnv(String installHome, Map<String, String> map, List<String> list) {
String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR;
File installEnv = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.BACKUPPATH));
private void filesToDelete(String installHome, List<String> list) {
String envHome = WorkContext.getCurrent().getPath();
File installEnv = new File(StableUtils.pathJoin(envHome,ProjectConstants.LIB_NAME));
File[] files = installEnv.listFiles();
if (files != null) {
for (File file : files) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(WorkContext.getCurrent().getPath(), ProjectConstants.LIB_NAME, file.getName()));
list.add(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), ProjectConstants.LIB_NAME, file.getName()));
if (file.getName().startsWith(UpdateConstants.FINE)) {
list.add(StableUtils.pathJoin(envHome, ProjectConstants.LIB_NAME, file.getName()));
}
}
}
installEnv = new File(StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME));
files = installEnv.listFiles();
if (files != null) {
for (File file : files) {
if (file.getName().startsWith(UpdateConstants.FINE) || file.getName().equals(UpdateConstants.ASPECTJRT)) {
list.add(StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
}
}
}
}

Loading…
Cancel
Save