You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by xa...@apache.org on 2007/04/16 12:10:20 UTC

svn commit: r529214 - in /incubator/ivy/ivyde/trunk: CHANGES.txt plugin.xml src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java

Author: xavier
Date: Mon Apr 16 05:10:18 2007
New Revision: 529214

URL: http://svn.apache.org/viewvc?view=rev&rev=529214
Log:
IMPROVE: enable 'Resolve all' action (IVYDE-42)

Modified:
    incubator/ivy/ivyde/trunk/CHANGES.txt
    incubator/ivy/ivyde/trunk/plugin.xml
    incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
    incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java

Modified: incubator/ivy/ivyde/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ivy/ivyde/trunk/CHANGES.txt?view=diff&rev=529214&r1=529213&r2=529214
==============================================================================
--- incubator/ivy/ivyde/trunk/CHANGES.txt (original)
+++ incubator/ivy/ivyde/trunk/CHANGES.txt Mon Apr 16 05:10:18 2007
@@ -1,8 +1,9 @@
 				IvyDE 
 				============================================
 
-  version 1.3.0 (not yet released)
+  version in svn (not yet released)
 ===========================
+- IMPROVE: enable 'Resolve all' action (IVYDE-42)
 - moved to apache, packages renamed to org.apache.ivyde
   				
 

Modified: incubator/ivy/ivyde/trunk/plugin.xml
URL: http://svn.apache.org/viewvc/incubator/ivy/ivyde/trunk/plugin.xml?view=diff&rev=529214&r1=529213&r2=529214
==============================================================================
--- incubator/ivy/ivyde/trunk/plugin.xml (original)
+++ incubator/ivy/ivyde/trunk/plugin.xml Mon Apr 16 05:10:18 2007
@@ -221,8 +221,6 @@
    </extension>
    -->
 
-   <!-- Uncomment to enable resolve all action
-   
    <extension point = "org.eclipse.ui.actionSets">
 	   <actionSet id="org.apache.ivyde.eclipse.ui.actions.actionSet"
 		   label="IvyDE Actions"
@@ -245,7 +243,6 @@
             id="org.apache.ivyde.eclipse.ui.actions.resolveAll">
       </command>
    </extension>
-   -->
    
 
 

Modified: incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
URL: http://svn.apache.org/viewvc/incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java?view=diff&rev=529214&r1=529213&r2=529214
==============================================================================
--- incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java (original)
+++ incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java Mon Apr 16 05:10:18 2007
@@ -520,6 +520,15 @@
         }        
     }
 
+    /**
+     * This method is here to available the Resolve all action to run in a single progress window.
+     * It is quiet ugly but it is a first way to do this quiet quickly.
+     * @param monitor
+     */
+    public void resolve(IProgressMonitor monitor) {
+        computeClasspathEntries(false, true).run(monitor);
+    }
+    
     public void resolve() {
         computeClasspathEntries(false, true).schedule();
     }

Modified: incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java
URL: http://svn.apache.org/viewvc/incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java?view=diff&rev=529214&r1=529213&r2=529214
==============================================================================
--- incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java (original)
+++ incubator/ivy/ivyde/trunk/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAllAction.java Mon Apr 16 05:10:18 2007
@@ -1,9 +1,15 @@
 package org.apache.ivyde.eclipse.ui.actions;
 
+import java.util.Collection;
 import java.util.Iterator;
 
 import org.apache.ivyde.eclipse.IvyPlugin;
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.ui.IWorkbenchWindow;
@@ -24,10 +30,25 @@
 	 * @see IWorkbenchWindowActionDelegate#run
 	 */
 	public void run(IAction action) {
-        for (Iterator iter = IvyPlugin.getDefault().getAllContainers().iterator(); iter.hasNext();) {
-			IvyClasspathContainer cp = (IvyClasspathContainer) iter.next();
-			cp.resolve();
-		}
+        Job resolveAllJob = new Job("Resolve all dependencies") {
+            protected IStatus run(IProgressMonitor monitor) {
+                Collection containers = IvyPlugin.getDefault().getAllContainers();
+                monitor.beginTask("Resolve all dependencies", containers.size());
+                for (Iterator iter = IvyPlugin.getDefault().getAllContainers().iterator(); iter.hasNext();) {
+                    if (monitor.isCanceled()) {
+                        return Status.CANCEL_STATUS;
+                    }
+                    SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
+                    IvyClasspathContainer cp = (IvyClasspathContainer) iter.next();
+                    cp.resolve(subMonitor);
+                }
+
+                return Status.OK_STATUS;
+            }
+        };
+
+        resolveAllJob.setUser(true);
+        resolveAllJob.schedule();
 	}
 	
 	/**