--- src/java/org/jayasoft/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java 2006-11-08 10:49:37.000000000 +0100 +++ src/java/org/jayasoft/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java 2006-11-08 10:46:28.000000000 +0100 @@ -400,6 +400,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(); } --- src/java/org/jayasoft/ivyde/eclipse/ui/actions/ResolveAllAction.java 2006-11-08 10:50:11.000000000 +0100 +++ src/java/org/jayasoft/ivyde/eclipse/ui/actions/ResolveAllAction.java 2006-11-08 10:47:20.000000000 +0100 @@ -1,58 +1,80 @@ -package org.jayasoft.ivyde.eclipse.ui.actions; - -import java.util.Iterator; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; -import org.jayasoft.ivyde.eclipse.IvyPlugin; -import org.jayasoft.ivyde.eclipse.cpcontainer.IvyClasspathContainer; - - -public class ResolveAllAction implements IWorkbenchWindowActionDelegate { - /** - * The constructor. - */ - public ResolveAllAction() { - } - - /** - * The action has been activated. The argument of the - * method represents the 'real' action sitting - * in the workbench UI. - * @see IWorkbenchWindowActionDelegate#run - */ - public void run(IAction action) { - for (Iterator iter = IvyPlugin.getDefault().getAllContainers().iterator(); iter.hasNext();) { - IvyClasspathContainer cp = (IvyClasspathContainer) iter.next(); - cp.resolve(); - } - } - - /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() { - } - - /** - * We will cache window object in order to - * be able to provide parent shell for the message dialog. - * @see IWorkbenchWindowActionDelegate#init - */ - public void init(IWorkbenchWindow window) { - } -} +package org.jayasoft.ivyde.eclipse.ui.actions; + +import java.util.Collection; +import java.util.Iterator; + +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; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; +import org.jayasoft.ivyde.eclipse.IvyPlugin; +import org.jayasoft.ivyde.eclipse.cpcontainer.IvyClasspathContainer; + + +public class ResolveAllAction implements IWorkbenchWindowActionDelegate { + /** + * The constructor. + */ + public ResolveAllAction() { + } + + /** + * The action has been activated. The argument of the + * method represents the 'real' action sitting + * in the workbench UI. + * @see IWorkbenchWindowActionDelegate#run + */ + public void run(IAction action) { + Job resolveAllJob = new Job("Resolve all dependencies") { + @Override + 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(); + } + + /** + * Selection in the workbench has been changed. We + * can change the state of the 'real' action here + * if we want, but this can only happen after + * the delegate has been created. + * @see IWorkbenchWindowActionDelegate#selectionChanged + */ + public void selectionChanged(IAction action, ISelection selection) { + } + + /** + * We can use this method to dispose of any system + * resources we previously allocated. + * @see IWorkbenchWindowActionDelegate#dispose + */ + public void dispose() { + } + + /** + * We will cache window object in order to + * be able to provide parent shell for the message dialog. + * @see IWorkbenchWindowActionDelegate#init + */ + public void init(IWorkbenchWindow window) { + } +}