diff options
Diffstat (limited to 'examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/SourceManagementAction.java')
-rw-r--r-- | examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/SourceManagementAction.java | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/SourceManagementAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/SourceManagementAction.java index ffe6985cd..94aff96e4 100644 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/SourceManagementAction.java +++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/SourceManagementAction.java @@ -14,7 +14,6 @@ package org.eclipse.team.examples.pessimistic.ui; import java.util.HashSet; -import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -33,29 +32,28 @@ public abstract class SourceManagementAction extends PessimisticProviderAction { /** * Collects the selected resources by project, then iterates - * over the projects finding the associated provider. If a + * over the projects finding the associated provider. If a * provider is found it requests that this action manage the resources * using the found provider. - * + * * @see org.eclipse.ui.IActionDelegate#run(IAction) */ + @Override public void run(IAction action) { IResource[] resources= getSelectedResources(); if (resources == null || resources.length == 0) return; - Set resourceSet= new HashSet(resources.length); - for(int i= 0; i < resources.length; i++) { - IResource resource= resources[i]; + Set<IResource> resourceSet = new HashSet<>(resources.length); + for (IResource resource : resources) { recursivelyAdd(resource, resourceSet); } if (!resourceSet.isEmpty()) { - final Map byProject= sortByProject(resourceSet); + final Map<IProject, Set<IResource>> byProject = sortByProject(resourceSet); IRunnableWithProgress runnable= monitor -> { - for (Iterator i= byProject.keySet().iterator(); i.hasNext();) { - IProject project= (IProject) i.next(); + for (IProject project : byProject.keySet()) { PessimisticFilesystemProvider provider= getProvider(project); if (provider != null) { - Set set= (Set)byProject.get(project); + Set<IResource> set = byProject.get(project); IResource[] resources1= new IResource[set.size()]; set.toArray(resources1); manageResources(provider, resources1, monitor); @@ -63,12 +61,12 @@ public abstract class SourceManagementAction extends PessimisticProviderAction { } }; runWithProgressDialog(runnable); - } + } } /** * Manages the <code>resources</code> using the given <code>provider</code>. - * + * * @param provider The provider associated with the resources. * @param resources The resources to be managed. * @param monitor A progress monitor to give feedback. |