ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1231742 - in /ant/ivy/ivyde/trunk: doc/release-notes.html org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/CleanCacheAction.java org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/IvyMenuContributionItem.java
Date Sun, 15 Jan 2012 20:07:13 GMT
Author: hibou
Date: Sun Jan 15 20:07:12 2012
New Revision: 1231742

URL: http://svn.apache.org/viewvc?rev=1231742&view=rev
Log:
IVYDE-289 : add a confirm popup before cleaning the caches

Modified:
    ant/ivy/ivyde/trunk/doc/release-notes.html
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/CleanCacheAction.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/IvyMenuContributionItem.java

Modified: ant/ivy/ivyde/trunk/doc/release-notes.html
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/doc/release-notes.html?rev=1231742&r1=1231741&r2=1231742&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/doc/release-notes.html (original)
+++ ant/ivy/ivyde/trunk/doc/release-notes.html Sun Jan 15 20:07:12 2012
@@ -132,6 +132,7 @@ List of changes since <a href="/ivy/ivyd
     <li>NEW: Add configuration option to use an extended revision id when resolving
eclipse projects (IVYDE-235) (thanks to Jeffrey M. Metcalf)</li>
     <li>NEW: Allow specifying source and javadoc mapping on binaries directly in the
ivy.xml (IVYDE-267)</li>
     <li>NEW: Ivy Resolve Visualizer (IVYDE-208)</li>
+    <li>NEW: "clean caches" operations have now a confirm popup (IVYDE-289)</li>
 </ul><ul>
     <li>IMPROVE: let IvyDE refresh workspace after a resolve (IVYDE-27) (thanks to
Clint Burghduff)</li>
     <li>IMPROVE: IvyDE now resolve by batch, then preventing too many workspace build
(IVYDE-177)</li>

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/CleanCacheAction.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/CleanCacheAction.java?rev=1231742&r1=1231741&r2=1231742&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/CleanCacheAction.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/CleanCacheAction.java
Sun Jan 15 20:07:12 2012
@@ -19,20 +19,26 @@ package org.apache.ivyde.eclipse.ui.menu
 
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 
 import org.apache.ivy.core.cache.RepositoryCacheManager;
 import org.apache.ivy.core.cache.ResolutionCacheManager;
+import org.apache.ivy.util.Message;
 import org.apache.ivyde.eclipse.IvyPlugin;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
 
 public class CleanCacheAction extends Action {
 
     private final List/* <Cleanable> */cleanables;
 
+    private final String name;
+
     public abstract static class Cleanable {
         public void launchClean() {
             Job cleanJob = new Job("Cleaning cache " + getName()) {
@@ -83,21 +89,27 @@ public class CleanCacheAction extends Ac
         }
     }
 
-    public CleanCacheAction(List/* <Cleanable> */cleanables) {
+    public CleanCacheAction(String name, List/* <Cleanable> */cleanables) {
+        this.name = name;
         this.cleanables = cleanables;
     }
 
     public void run() {
-        StringBuffer builder = new StringBuffer("Ivy cache cleaned: ");
-        Iterator itCleanable = cleanables.iterator();
-        while (itCleanable.hasNext()) {
-            Cleanable cleanable = (Cleanable) itCleanable.next();
-            cleanable.launchClean();
-            builder.append(cleanable.getName());
-            if (itCleanable.hasNext()) {
-                builder.append(", ");
+        final boolean ok[] = new boolean[1];
+        Display.getDefault().syncExec(new Runnable() {
+            public void run() {
+                ok[0] = MessageDialog.openConfirm(IvyPlugin.getActiveWorkbenchShell(), name,
+                    "Are you sure you want to " + name.toLowerCase(Locale.US)
+                            + ". (cannot be undone)");
+            }
+        });
+        if (ok[0]) {
+            Iterator itCleanable = cleanables.iterator();
+            while (itCleanable.hasNext()) {
+                Cleanable cleanable = (Cleanable) itCleanable.next();
+                cleanable.launchClean();
+                Message.log(Message.MSG_INFO, "Ivy cache cleaned: " + cleanable.getName());
             }
         }
-        IvyPlugin.log(IStatus.INFO, builder.toString(), null);
     }
 }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/IvyMenuContributionItem.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/IvyMenuContributionItem.java?rev=1231742&r1=1231741&r2=1231742&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/IvyMenuContributionItem.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/IvyMenuContributionItem.java
Sun Jan 15 20:07:12 2012
@@ -326,7 +326,7 @@ public class IvyMenuContributionItem ext
 
     public void addCleanable(MenuManager menuManager, List/* <IContributionItem> */items,
             String name, List/* <Cleanable> */cleanables) {
-        CleanCacheAction action = new CleanCacheAction(cleanables);
+        CleanCacheAction action = new CleanCacheAction(name, cleanables);
         action.setText(name);
         fillMenu(menuManager, items, new ActionContributionItem(action));
     }



Mime
View raw message