From da284105b607bec381206599791f0b2ea170d81b Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 21 Dec 2007 20:50:26 +0000
Subject: [PATCH] Fix for 1862 verbosity options for quicksetup tools

---
 opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java |   87 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 69 insertions(+), 18 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java b/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
index d1f1243..f1628be 100644
--- a/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
+++ b/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
@@ -759,15 +759,24 @@
 
       if (getUserData().getStopServer()) {
         status = UninstallProgressStep.STOPPING_SERVER;
-        if (displaySeparator) {
+        if (displaySeparator && isVerbose()) {
           notifyListeners(getTaskSeparator());
         }
-        new ServerController(this).stopServer();
+        if (!isVerbose())
+        {
+          notifyListeners(getFormattedWithPoints(
+              INFO_PROGRESS_STOPPING_NON_VERBOSE.get()));
+        }
+        new ServerController(this).stopServer(!isVerbose());
+        if (!isVerbose())
+        {
+          notifyListeners(getFormattedDoneWithLineBreak());
+        }
         displaySeparator = true;
       }
       if (isWindowsServiceEnabled()) {
         status = UninstallProgressStep.DISABLING_WINDOWS_SERVICE;
-        if (displaySeparator) {
+        if (displaySeparator && isVerbose()) {
           notifyListeners(getTaskSeparator());
         }
         disableWindowsService();
@@ -777,7 +786,7 @@
       Set<String> dbsToDelete = getUninstallUserData().getExternalDbsToRemove();
       if (dbsToDelete.size() > 0) {
         status = UninstallProgressStep.DELETING_EXTERNAL_DATABASE_FILES;
-        if (displaySeparator) {
+        if (displaySeparator && isVerbose()) {
           notifyListeners(getTaskSeparator());
         }
 
@@ -790,7 +799,7 @@
       if (logsToDelete.size() > 0) {
         status = UninstallProgressStep.DELETING_EXTERNAL_LOG_FILES;
 
-        if (displaySeparator) {
+        if (displaySeparator && isVerbose()) {
           notifyListeners(getTaskSeparator());
         }
 
@@ -805,7 +814,7 @@
               userData.getRemoveLDIFs() ||
               userData.getRemoveLibrariesAndTools() ||
               userData.getRemoveLogs();
-      if (displaySeparator && somethingToDelete) {
+      if (displaySeparator && somethingToDelete && isVerbose()) {
         notifyListeners(getTaskSeparator());
       }
 
@@ -964,11 +973,23 @@
    */
   private void deleteExternalDatabaseFiles(Set<String> dbFiles)
           throws ApplicationException {
-    notifyListeners(getFormattedProgressWithLineBreak(
+    if (isVerbose())
+    {
+      notifyListeners(getFormattedProgressWithLineBreak(
             INFO_PROGRESS_DELETING_EXTERNAL_DB_FILES.get()));
+    }
+    else
+    {
+      notifyListeners(getFormattedWithPoints(
+          INFO_PROGRESS_DELETING_EXTERNAL_DB_FILES_NON_VERBOSE.get()));
+    }
     for (String path : dbFiles) {
       deleteRecursively(new File(path));
     }
+    if (!isVerbose())
+    {
+      notifyListeners(getFormattedDone());
+    }
   }
 
   /**
@@ -979,11 +1000,23 @@
    */
   private void deleteExternalLogFiles(Set<String> logFiles)
           throws ApplicationException {
-    notifyListeners(getFormattedProgressWithLineBreak(
-            INFO_PROGRESS_DELETING_EXTERNAL_LOG_FILES.get()));
+    if (isVerbose())
+    {
+      notifyListeners(getFormattedProgressWithLineBreak(
+          INFO_PROGRESS_DELETING_EXTERNAL_LOG_FILES.get()));
+    }
+    else
+    {
+      notifyListeners(getFormattedWithPoints(
+          INFO_PROGRESS_DELETING_EXTERNAL_LOG_FILES_NON_VERBOSE.get()));
+    }
     for (String path : logFiles) {
       deleteRecursively(new File(path));
     }
+    if (!isVerbose())
+    {
+      notifyListeners(getFormattedDone());
+    }
   }
 
   /**
@@ -993,8 +1026,16 @@
    */
   private void deleteInstallationFiles(int minRatio, int maxRatio)
           throws ApplicationException {
-    notifyListeners(getFormattedProgressWithLineBreak(
-            INFO_PROGRESS_DELETING_INSTALLATION_FILES.get()));
+    if (isVerbose())
+    {
+      notifyListeners(getFormattedProgressWithLineBreak(
+          INFO_PROGRESS_DELETING_INSTALLATION_FILES.get()));
+    }
+    else
+    {
+      notifyListeners(getFormattedWithPoints(
+          INFO_PROGRESS_DELETING_INSTALLATION_FILES_NON_VERBOSE.get()));
+    }
     File f = new File(getInstallPathFromClasspath());
     InstallationFilesToDeleteFilter filter =
             new InstallationFilesToDeleteFilter();
@@ -1054,6 +1095,10 @@
       }
       hmRatio.put(UninstallProgressStep.DELETING_INSTALLATION_FILES, maxRatio);
     }
+    if (!isVerbose())
+    {
+      notifyListeners(getFormattedDone());
+    }
   }
 
   /**
@@ -1116,12 +1161,15 @@
   private void delete(File file) throws ApplicationException {
     boolean isFile = file.isFile();
 
-    if (isFile) {
-      notifyListeners(getFormattedWithPoints(
-              INFO_PROGRESS_DELETING_FILE.get(file.getAbsolutePath())));
-    } else {
-      notifyListeners(getFormattedWithPoints(
-              INFO_PROGRESS_DELETING_DIRECTORY.get(file.getAbsolutePath())));
+    if (isVerbose())
+    {
+      if (isFile) {
+        notifyListeners(getFormattedWithPoints(
+            INFO_PROGRESS_DELETING_FILE.get(file.getAbsolutePath())));
+      } else {
+        notifyListeners(getFormattedWithPoints(
+            INFO_PROGRESS_DELETING_DIRECTORY.get(file.getAbsolutePath())));
+      }
     }
 
     boolean delete = false;
@@ -1153,7 +1201,10 @@
           errMsg, null);
     }
 
-    notifyListeners(getFormattedDoneWithLineBreak());
+    if (isVerbose())
+    {
+      notifyListeners(getFormattedDoneWithLineBreak());
+    }
   }
 
   private boolean equalsOrDescendant(File file, File directory) {

--
Gitblit v1.10.0