diff --git a/designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java b/designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java index 83ffbe5fe2..d69d595e21 100644 --- a/designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java +++ b/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")); } @@ -163,33 +162,67 @@ public class RestoreResultDialog extends JDialog { String installHome = StableUtils.getInstallHome(); putJarBackupFilesToInstallLib(installHome, map, list); - putJarBackupFilesToInstallEnv(installHome, map, list); + putJarBackupFilesToInstallEnv(list); RestartHelper.saveFilesWhichToMove(map); RestartHelper.saveFilesWhichToDelete(list.toArray(new String[list.size()])); } private void putJarBackupFilesToInstallLib(String installHome, Map map, List list) { 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(); + 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())); + } + } + } + } + installLib = new File(StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME)); + 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())); + if (file.getName().startsWith(UpdateConstants.FINE) || file.getName().equals(UpdateConstants.ASPECTJRT)) { + list.add(StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName())); + } } } } - private void putJarBackupFilesToInstallEnv(String installHome, Map map, List list) { - String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; - File installEnv = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.BACKUPPATH)); + private void putJarBackupFilesToInstallEnv(List 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())); + } } } }