diff options
author | Carsten Hammer | 2019-09-25 19:55:25 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2019-10-14 16:45:46 +0000 |
commit | bd3a768e9e4d8cc7238025285cede988fcbe95be (patch) | |
tree | d9e80cc5ab4786ed5350bb3be4a9a5742b014fa1 /bundles/org.eclipse.equinox.p2.engine | |
parent | f17aeff069804a760934c6618c41718ccd71e7d1 (diff) | |
download | rt.equinox.p2-bd3a768e9e4d8cc7238025285cede988fcbe95be.tar.gz rt.equinox.p2-bd3a768e9e4d8cc7238025285cede988fcbe95be.tar.xz rt.equinox.p2-bd3a768e9e4d8cc7238025285cede988fcbe95be.zip |
Use jdk 5 for-each loop
Replace simple uses of Iterator with a corresponding for-loop. Also add
missing braces on loops as necessary.
Change-Id: I09ac66de3ceeb578ff636ab21f66307fb0dda95b
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.engine')
3 files changed, 15 insertions, 17 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java index 73aebab23..a5c887e94 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java @@ -94,11 +94,10 @@ public class ActionManager implements IRegistryChangeListener { IExtensionPoint point = RegistryFactory.getRegistry().getExtensionPoint(EngineActivator.ID, PT_ACTIONS); IExtension[] extensions = point.getExtensions(); actionMap = new HashMap<>(extensions.length); - for (int i = 0; i < extensions.length; i++) { + for (IExtension extension : extensions) { try { - IConfigurationElement[] elements = extensions[i].getConfigurationElements(); - for (int j = 0; j < elements.length; j++) { - IConfigurationElement actionElement = elements[j]; + IConfigurationElement[] elements = extension.getConfigurationElements(); + for (IConfigurationElement actionElement : elements) { if (!actionElement.getName().equals(ELEMENT_ACTION)) continue; @@ -111,7 +110,7 @@ public class ActionManager implements IRegistryChangeListener { actionMap.put(actionId, actionElement); } - } catch (InvalidRegistryObjectException e) { + }catch (InvalidRegistryObjectException e) { // skip } } diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java index 64247a8d2..6b29cc85a 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java @@ -139,27 +139,27 @@ public class TouchpointManager implements IRegistryChangeListener { IExtensionPoint point = RegistryFactory.getRegistry().getExtensionPoint(EngineActivator.ID, PT_TOUCHPOINTS); IExtension[] extensions = point.getExtensions(); touchpointEntries = new HashMap<>(extensions.length); - for (int i = 0; i < extensions.length; i++) { + for (IExtension extension : extensions) { try { - IConfigurationElement[] elements = extensions[i].getConfigurationElements(); - for (int j = 0; j < elements.length; j++) { - String elementName = elements[j].getName(); + IConfigurationElement[] elements = extension.getConfigurationElements(); + for (IConfigurationElement element : elements) { + String elementName = element.getName(); if (!ELEMENT_TOUCHPOINT.equalsIgnoreCase(elementName)) { - reportError(NLS.bind(Messages.TouchpointManager_Incorrectly_Named_Extension, elements[j].getName(), ELEMENT_TOUCHPOINT)); + reportError(NLS.bind(Messages.TouchpointManager_Incorrectly_Named_Extension, element.getName(), ELEMENT_TOUCHPOINT)); continue; } - String id = elements[j].getAttribute(ATTRIBUTE_TYPE); + String id = element.getAttribute(ATTRIBUTE_TYPE); if (id == null) { reportError(NLS.bind(Messages.TouchpointManager_Attribute_Not_Specified, ATTRIBUTE_TYPE)); continue; } if (touchpointEntries.get(id) == null) { - touchpointEntries.put(id, new TouchpointEntry(elements[j])); + touchpointEntries.put(id, new TouchpointEntry(element)); } else { reportError(NLS.bind(Messages.TouchpointManager_Conflicting_Touchpoint_Types, id)); } } - } catch (InvalidRegistryObjectException e) { + }catch (InvalidRegistryObjectException e) { //skip this extension } } diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java index 724b3d9a1..0e4535989 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java @@ -86,8 +86,8 @@ public class Sizing extends InstallableUnitPhase { for (IArtifactRequest[] requests : artifactRequests) { if (requests == null) continue; - for (int i = 0; i < requests.length; i++) { - artifactsToObtain.add(requests[i]); + for (IArtifactRequest request : requests) { + artifactsToObtain.add(request); } } @@ -103,8 +103,7 @@ public class Sizing extends InstallableUnitPhase { if (sub.isCanceled()) break; boolean found = false; - for (int i = 0; i < repositories.length; i++) { - IArtifactRepository repo = repositories[i]; + for (IArtifactRepository repo : repositories) { if (sub.isCanceled()) return Status.CANCEL_STATUS; IArtifactDescriptor[] descriptors = repo.getArtifactDescriptors(artifactRequest.getArtifactKey()); |