From 5f34014679f5e75863433904919c1e2e08fc8535 Mon Sep 17 00:00:00 2001 From: Bryant Date: Thu, 24 Oct 2019 09:07:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-23155=20=E8=A7=A3=E5=86=B3=E4=BB=8E?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC=E9=80=80=E5=9B=9E=E5=88=B0=E8=80=81?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=9A=84=E8=BF=98=E5=8E=9F=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../update/ui/dialog/RestoreResultDialog.java | 57 +++++++++++++++---- 1 file changed, 45 insertions(+), 12 deletions(-) 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())); + } } } } From 091d310f3fa7609c38619d5f7a464703b62957a1 Mon Sep 17 00:00:00 2001 From: Bryant Date: Thu, 24 Oct 2019 16:04:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-23155=20=E8=A7=A3=E5=86=B3=E4=BB=8E?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC=E9=80=80=E5=9B=9E=E5=88=B0=E8=80=81?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=9A=84=E8=BF=98=E5=8E=9F=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../update/ui/dialog/RestoreResultDialog.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) 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 d69d595e21..40516e2082 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 @@ -161,13 +161,13 @@ public class RestoreResultDialog extends JDialog { List list = new ArrayList<>(); String installHome = StableUtils.getInstallHome(); - putJarBackupFilesToInstallLib(installHome, map, list); - putJarBackupFilesToInstallEnv(list); + filesToMove(installHome, map); + filesToDelete(installHome, list); RestartHelper.saveFilesWhichToMove(map); RestartHelper.saveFilesWhichToDelete(list.toArray(new String[list.size()])); } - private void putJarBackupFilesToInstallLib(String installHome, Map map, List list) { + private void filesToMove(String installHome, Map map) { String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; String envHome = WorkContext.getCurrent().getPath(); File installLib = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.DESIGNERBACKUPPATH)); @@ -203,18 +203,9 @@ public class RestoreResultDialog extends JDialog { } } } - installLib = new File(StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME)); - files = installLib.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())); - } - } - } } - private void putJarBackupFilesToInstallEnv(List list) { + private void filesToDelete(String installHome, List list) { String envHome = WorkContext.getCurrent().getPath(); File installEnv = new File(StableUtils.pathJoin(envHome,ProjectConstants.LIB_NAME)); File[] files = installEnv.listFiles(); @@ -225,5 +216,14 @@ public class RestoreResultDialog extends JDialog { } } } + 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())); + } + } + } } } \ No newline at end of file