diff options
author | chammer | 2019-11-12 22:01:53 +0000 |
---|---|---|
committer | Karsten Thoms | 2019-12-10 20:54:52 +0000 |
commit | 3cc2eb1128810a7319e9e23c0fc6029c324fb30a (patch) | |
tree | 32f9c49e2534359f2d324cd0bf93f5536302c5d8 /org.eclipse.debug.core/core/org | |
parent | 96aae7f86b741a42618dbe787394e64557605e66 (diff) | |
download | eclipse.platform.debug-3cc2eb1128810a7319e9e23c0fc6029c324fb30a.tar.gz eclipse.platform.debug-3cc2eb1128810a7319e9e23c0fc6029c324fb30a.tar.xz eclipse.platform.debug-3cc2eb1128810a7319e9e23c0fc6029c324fb30a.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: Ic778a3ae3faac8009970f13a7f9f15f07d5d7b58
Signed-off-by: chammer <carsten.hammer@t-online.de>
Diffstat (limited to 'org.eclipse.debug.core/core/org')
3 files changed, 97 insertions, 115 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java index 142c01828..fbb9f8135 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java @@ -163,10 +163,10 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio monitor.subTask(DebugCoreMessages.LaunchConfigurationDelegate_6); List<IAdaptable> errors = new ArrayList<>(); - for (int i = 0; i < projects.length; i++) { - monitor.subTask(MessageFormat.format(DebugCoreMessages.LaunchConfigurationDelegate_7, new Object[] { projects[i].getName() })); - if (existsProblems(projects[i])) { - errors.add(projects[i]); + for (IProject project : projects) { + monitor.subTask(MessageFormat.format(DebugCoreMessages.LaunchConfigurationDelegate_7, new Object[] { project.getName() })); + if (existsProblems(project)) { + errors.add(project); } } if (!errors.isEmpty()) { @@ -203,8 +203,8 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio if (breakpoints == null) { return true; } - for (int i = 0; i < breakpoints.length; i++) { - if (breakpoints[i].isEnabled()) { + for (IBreakpoint breakpoint : breakpoints) { + if (breakpoint.isEnabled()) { IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus); if (prompter != null) { boolean launchInDebugModeInstead = ((Boolean)prompter.handleStatus(switchToDebugPromptStatus, configuration)).booleanValue(); @@ -283,9 +283,9 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio */ protected IProject[] computeReferencedBuildOrder(IProject[] baseProjects) throws CoreException { HashSet<IProject> unorderedProjects = new HashSet<>(); - for(int i = 0; i< baseProjects.length; i++) { - unorderedProjects.add(baseProjects[i]); - addReferencedProjects(baseProjects[i], unorderedProjects); + for (IProject baseProject : baseProjects) { + unorderedProjects.add(baseProject); + addReferencedProjects(baseProject, unorderedProjects); } IProject[] projectSet = unorderedProjects.toArray(new IProject[unorderedProjects.size()]); return computeBuildOrder(projectSet); @@ -303,9 +303,7 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio */ protected void addReferencedProjects(IProject project, Set<IProject> references) throws CoreException { if (project.isOpen()) { - IProject[] projects = project.getReferencedProjects(); - for (int i = 0; i < projects.length; i++) { - IProject refProject= projects[i]; + for (IProject refProject : project.getReferencedProjects()) { if (refProject.exists() && !references.contains(refProject)) { references.add(refProject); addReferencedProjects(refProject, references); @@ -330,8 +328,7 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio List<IProject> unorderedProjects = new ArrayList<>(projects.length); Collections.addAll(unorderedProjects, projects); - for (int i = 0; i < orderedNames.length; i++) { - String projectName = orderedNames[i]; + for (String projectName : orderedNames) { for (Iterator<IProject> iterator = unorderedProjects.iterator(); iterator.hasNext();) { IProject project = iterator.next(); if (project.getName().equals(projectName)) { @@ -364,8 +361,8 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio protected boolean existsProblems(IProject proj) throws CoreException { IMarker[] markers = proj.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE); if (markers.length > 0) { - for (int i = 0; i < markers.length; i++) { - if (isLaunchProblem(markers[i])) { + for (IMarker marker : markers) { + if (isLaunchProblem(marker)) { return true; } } @@ -405,11 +402,11 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio public void run(IProgressMonitor pm) throws CoreException { SubMonitor localmonitor = SubMonitor.convert(pm, DebugCoreMessages.LaunchConfigurationDelegate_scoped_incremental_build, projects.length); try { - for (int i = 0; i < projects.length; i++ ) { + for (IProject project : projects) { if (localmonitor.isCanceled()) { throw new OperationCanceledException(); } - projects[i].build(IncrementalProjectBuilder.INCREMENTAL_BUILD, localmonitor.newChild(1)); + project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, localmonitor.newChild(1)); } } finally { localmonitor.done(); diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java index ddce2a193..a5ad21310 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java @@ -689,9 +689,9 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe @Override public void addLaunches(ILaunch[] launches) { List<ILaunch> added = new ArrayList<>(launches.length); - for (int i = 0; i < launches.length; i++) { - if (internalAddLaunch(launches[i])) { - added.add(launches[i]); + for (ILaunch launch : launches) { + if (internalAddLaunch(launch)) { + added.add(launch); } } if (!added.isEmpty()) { @@ -974,10 +974,9 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe */ public ILaunchConfiguration findLaunchConfiguration(String name) { if(name != null) { - ILaunchConfiguration[] configs = getLaunchConfigurations(); - for (int i = 0; i < configs.length; i++) { - if(name.equals(configs[i].getName())) { - return configs[i]; + for (ILaunchConfiguration config : getLaunchConfigurations()) { + if(name.equals(config.getName())) { + return config; } } } @@ -1004,8 +1003,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe File[] configFiles = directory.listFiles(configFilter); if (configFiles != null && configFiles.length > 0) { LaunchConfiguration config = null; - for (int i = 0; i < configFiles.length; i++) { - config = new LaunchConfiguration(LaunchConfiguration.getSimpleName(configFiles[i].getName()), null, false); + for (File configFile : configFiles) { + config = new LaunchConfiguration(LaunchConfiguration.getSimpleName(configFile.getName()), null, false); configs.add(config); } } @@ -1018,8 +1017,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe File[] prototypeFiles = directory.listFiles(prototypeFilter); if (prototypeFiles != null && prototypeFiles.length > 0) { LaunchConfiguration config = null; - for (int i = 0; i < prototypeFiles.length; i++) { - config = new LaunchConfiguration(LaunchConfiguration.getSimpleName(prototypeFiles[i].getName()), null, true); + for (File prototypeFile : prototypeFiles) { + config = new LaunchConfiguration(LaunchConfiguration.getSimpleName(prototypeFile.getName()), null, true); configs.add(config); } } @@ -1497,10 +1496,9 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe @Override public ILaunchConfigurationType getLaunchConfigurationType(String id) { - ILaunchConfigurationType[] types = getLaunchConfigurationTypes(); - for(int i = 0; i < types.length; i++) { - if (types[i].getIdentifier().equals(id)) { - return types[i]; + for (ILaunchConfigurationType type : getLaunchConfigurationTypes()) { + if (type.getIdentifier().equals(id)) { + return type; } } return null; @@ -1577,10 +1575,9 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe */ public ILaunchDelegate getLaunchDelegate(String id) { if(id != null) { - ILaunchDelegate[] delegates = getLaunchDelegates(); - for(int i = 0; i < delegates.length; i++) { - if(id.equals(delegates[i].getId())) { - return delegates[i]; + for (ILaunchDelegate delegate : getLaunchDelegates()) { + if(id.equals(delegate.getId())) { + return delegate; } } } @@ -1597,19 +1594,17 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe fLaunchDelegates = new HashMap<>(); //get all launch delegate contributions IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES); - IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); LaunchDelegate delegate = null; - for(int i = 0; i < infos.length; i++) { - delegate = new LaunchDelegate(infos[i]); + for (IConfigurationElement info : extensionPoint.getConfigurationElements()) { + delegate = new LaunchDelegate(info); fLaunchDelegates.put(delegate.getId(), delegate); } //get all delegates from launch configuration type contributions extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); - infos = extensionPoint.getConfigurationElements(); - for(int i = 0; i < infos.length; i++) { + for (IConfigurationElement info : extensionPoint.getConfigurationElements()) { //must check to see if delegate is provided in contribution - if(infos[i].getAttribute(IConfigurationElementConstants.DELEGATE) != null) { - delegate = new LaunchDelegate(infos[i]); + if(info.getAttribute(IConfigurationElementConstants.DELEGATE) != null) { + delegate = new LaunchDelegate(info); fLaunchDelegates.put(delegate.getId(), delegate); } } @@ -1721,12 +1716,11 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe * @since 3.5 */ private LaunchDelegate getLaunchDelegateExtension(String typeId, String id, Set<String> modeset) { - LaunchDelegate[] extensions = getLaunchDelegates(typeId); - for(int j = 0; j < extensions.length; j++) { - if(id.equals(extensions[j].getId())) { - List<Set<String>> modesets = extensions[j].getModes(); + for (LaunchDelegate extension : getLaunchDelegates(typeId)) { + if(id.equals(extension.getId())) { + List<Set<String>> modesets = extension.getModes(); if(modesets.contains(modeset)) { - return extensions[j]; + return extension; } } } @@ -1760,12 +1754,12 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe try { IResource[] resources = config.getMappedResources(); if(resources != null) { - for(int j = 0; j < resources.length; j++) { - if(resources[j].equals(resource)) { + for (IResource res : resources) { + if(res.equals(resource)) { configurations.add(config); break; - } else if (resource.getType() == IResource.PROJECT && resources[j].getType() == IResource.FILE){ - if (resources[j].getProject().equals(resource)) { + } else if (resource.getType() == IResource.PROJECT && res.getType() == IResource.FILE){ + if (res.getProject().equals(resource)) { configurations.add(config); break; } @@ -1895,8 +1889,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe fComparators = new HashMap<>(infos.length); IConfigurationElement configurationElement = null; String attr = null; - for (int i= 0; i < infos.length; i++) { - configurationElement = infos[i]; + for (IConfigurationElement info : infos) { + configurationElement = info; attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$ if (attr != null) { fComparators.put(attr, new LaunchConfigurationComparator(configurationElement)); @@ -1919,8 +1913,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); fLaunchConfigurationTypes = new ArrayList<>(infos.length); - for (int i= 0; i < infos.length; i++) { - fLaunchConfigurationTypes.add(new LaunchConfigurationType(infos[i])); + for (IConfigurationElement info : infos) { + fLaunchConfigurationTypes.add(new LaunchConfigurationType(info)); } } } @@ -1935,8 +1929,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); fLaunchModes = new HashMap<>(); ILaunchMode mode = null; - for (int i= 0; i < infos.length; i++) { - mode = new LaunchMode(infos[i]); + for (IConfigurationElement info : infos) { + mode = new LaunchMode(info); fLaunchModes.put(mode.getIdentifier(), mode); } } @@ -1952,18 +1946,18 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_CONTAINER_TYPES); IConfigurationElement[] extensions = extensionPoint.getConfigurationElements(); sourceContainerTypes = new HashMap<>(); - for (int i = 0; i < extensions.length; i++) { + for (IConfigurationElement extension : extensions) { sourceContainerTypes.put( - extensions[i].getAttribute(IConfigurationElementConstants.ID), - new SourceContainerType(extensions[i])); + extension.getAttribute(IConfigurationElementConstants.ID), + new SourceContainerType(extension)); } extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_PATH_COMPUTERS); extensions = extensionPoint.getConfigurationElements(); sourcePathComputers = new HashMap<>(); - for (int i = 0; i < extensions.length; i++) { + for (IConfigurationElement extension : extensions) { sourcePathComputers.put( - extensions[i].getAttribute(IConfigurationElementConstants.ID), - new SourcePathComputer(extensions[i])); + extension.getAttribute(IConfigurationElementConstants.ID), + new SourcePathComputer(extension)); } } } @@ -1978,8 +1972,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe fSourceLocators = new HashMap<>(infos.length); IConfigurationElement configurationElement = null; String id = null; - for (int i= 0; i < infos.length; i++) { - configurationElement = infos[i]; + for (IConfigurationElement info : infos) { + configurationElement = info; id = configurationElement.getAttribute(IConfigurationElementConstants.ID); if (id != null) { fSourceLocators.put(id,configurationElement); @@ -2229,16 +2223,16 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe @Override public void removeLaunches(ILaunch[] launches) { List<ILaunch> removed = new ArrayList<>(launches.length); - for (int i = 0; i < launches.length; i++) { - if (internalRemoveLaunch(launches[i])) { - removed.add(launches[i]); + for (ILaunch launch : launches) { + if (internalRemoveLaunch(launch)) { + removed.add(launch); } } if (!removed.isEmpty()) { ILaunch[] removedLaunches = removed.toArray(new ILaunch[removed.size()]); fireUpdate(removedLaunches, REMOVED); - for (int i = 0; i < removedLaunches.length; i++) { - fireUpdate(removedLaunches[i], REMOVED); + for (ILaunch launch : removedLaunches) { + fireUpdate(launch, REMOVED); } } } @@ -2292,14 +2286,14 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe try { ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(); IResource[] resources = null; - for(int i = 0; i < configs.length; i++) { - if(configs[i].isLocal()) { - resources = configs[i].getMappedResources(); + for (ILaunchConfiguration config : configs) { + if(config.isLocal()) { + resources = config.getMappedResources(); if(resources != null) { - for(int j = 0; j < resources.length; j++){ - if(resource.equals(resources[j]) || - resource.getFullPath().isPrefixOf(resources[j].getFullPath())) { - list.add(configs[i]); + for (IResource res : resources) { + if(resource.equals(res) || + resource.getFullPath().isPrefixOf(res.getFullPath())) { + list.add(config); break; } } @@ -2333,10 +2327,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe fListeners = new ListenerList<>(); fLaunchesListeners = new ListenerList<>(); fLaunchConfigurationListeners = new ListenerList<>(); - ILaunch[] launches = getLaunches(); - ILaunch launch = null; - for (int i= 0; i < launches.length; i++) { - launch = launches[i]; + for (ILaunch launch : getLaunches()) { if(launch != null) { try { if (launch instanceof IDisconnect) { @@ -2367,8 +2358,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe */ public void persistPreferredLaunchDelegates() { ILaunchConfigurationType[] types = getLaunchConfigurationTypes(); - for(int i = 0; i < types.length; i++) { - persistPreferredLaunchDelegate((LaunchConfigurationType)types[i]); + for (ILaunchConfigurationType type : types) { + persistPreferredLaunchDelegate((LaunchConfigurationType)type); } } @@ -2413,10 +2404,10 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe ILaunch[] launches = getLaunches(); ILaunchConfiguration[] configs = getMappedConfigurations(resource); try { - for(int i = 0; i < launches.length; i++) { - for(int j = 0; j < configs.length; j++) { - if(configs[j].equals(launches[i].getLaunchConfiguration()) & launches[i].canTerminate()) { - launches[i].terminate(); + for (ILaunch launch : launches) { + for (ILaunchConfiguration config : configs) { + if(config.equals(launch.getLaunchConfiguration()) & launch.canTerminate()) { + launch.terminate(); } } } @@ -2545,11 +2536,10 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe } List<Status> stati = null; SubMonitor lmonitor = SubMonitor.convert(monitor, DebugCoreMessages.LaunchManager_29, files.length); - for (int i = 0; i < files.length; i++) { + for (File source : files) { if (lmonitor.isCanceled()) { break; } - File source = files[i]; lmonitor.subTask(MessageFormat.format(DebugCoreMessages.LaunchManager_28, new Object[] { source.getName() })); IPath location = new Path(LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH.toOSString()).append(source.getName()); File target = location.toFile(); @@ -2622,13 +2612,11 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe */ public synchronized boolean launchModeAvailable(String mode) { if (fActiveModes == null) { - ILaunchConfigurationType[] types = getLaunchConfigurationTypes(); - ILaunchMode[] modes = getLaunchModes(); fActiveModes = new HashSet<>(3); - for (int i = 0; i < types.length; i++) { - for (int j = 0; j < modes.length; j++) { - if (types[i].supportsMode(modes[j].getIdentifier())) { - fActiveModes.add(modes[j].getIdentifier()); + for (ILaunchConfigurationType type : getLaunchConfigurationTypes()) { + for (ILaunchMode launchMode : getLaunchModes()) { + if (type.supportsMode(launchMode.getIdentifier())) { + fActiveModes.add(launchMode.getIdentifier()); } } } @@ -2646,15 +2634,15 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe catch(IllegalArgumentException iae) { //blanket change all reserved names if(Platform.OS_WIN32.equals(Platform.getOS())) { - for(int i = 0; i < UNSUPPORTED_WIN32_CONFIG_NAMES.length; i++) { - if(UNSUPPORTED_WIN32_CONFIG_NAMES[i].equals(name)) { + for (String element : UNSUPPORTED_WIN32_CONFIG_NAMES) { + if(element.equals(name)) { name = "launch_configuration"; //$NON-NLS-1$ } } } //blanket replace all invalid chars - for (int i = 0; i < DISALLOWED_CONFIG_NAME_CHARS.length; i++) { - name = name.replace(DISALLOWED_CONFIG_NAME_CHARS[i], '_'); + for (char element : DISALLOWED_CONFIG_NAME_CHARS) { + name = name.replace(element, '_'); } } //run it through the generator once more in case a replaced name has already been done @@ -2664,15 +2652,15 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe @Override public boolean isValidLaunchConfigurationName(String configname) throws IllegalArgumentException { if(Platform.OS_WIN32.equals(Platform.getOS())) { - for(int i = 0; i < UNSUPPORTED_WIN32_CONFIG_NAMES.length; i++) { - if(configname.equals(UNSUPPORTED_WIN32_CONFIG_NAMES[i])) { + for (String element : UNSUPPORTED_WIN32_CONFIG_NAMES) { + if(configname.equals(element)) { throw new IllegalArgumentException(MessageFormat.format(DebugCoreMessages.LaunchManager_invalid_config_name, new Object[] { configname })); } } } - for (int i = 0; i < DISALLOWED_CONFIG_NAME_CHARS.length; i++) { - if (configname.indexOf(DISALLOWED_CONFIG_NAME_CHARS[i]) > -1) { - throw new IllegalArgumentException(MessageFormat.format(DebugCoreMessages.LaunchManager_invalid_config_name_char, new Object[] { String.valueOf(DISALLOWED_CONFIG_NAME_CHARS[i]) })); + for (char element : DISALLOWED_CONFIG_NAME_CHARS) { + if (configname.indexOf(element) > -1) { + throw new IllegalArgumentException(MessageFormat.format(DebugCoreMessages.LaunchManager_invalid_config_name_char, new Object[] { String.valueOf(element) })); } } return true; diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java index fd03c0510..a7f92d2e6 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java @@ -188,10 +188,9 @@ public class LogicalStructureManager { } // If an index is stored for this combo, retrieve the id at the index String id= fStructureTypeIds.get(index.intValue()); - for (int i = 0; i < structureTypes.length; i++) { - // Return the type with the retrieved id - ILogicalStructureType type = structureTypes[i]; + for (ILogicalStructureType type : structureTypes) { if (type.getId().equals(id)) { + // Return the type with the retrieved id return type; } } @@ -228,8 +227,7 @@ public class LogicalStructureManager { */ protected String getComboString(ILogicalStructureType[] types) { StringBuilder comboKey= new StringBuilder(); - for (int i = 0; i < types.length; i++) { - ILogicalStructureType type = types[i]; + for (ILogicalStructureType type : types) { int typeIndex = fStructureTypeIds.indexOf(type.getId()); if (typeIndex == -1) { typeIndex= fStructureTypeIds.size(); @@ -246,8 +244,7 @@ public class LogicalStructureManager { IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LOGICAL_STRUCTURE_TYPES); IConfigurationElement[] extensions = point.getConfigurationElements(); fTypes = new ArrayList<>(extensions.length); - for (int i = 0; i < extensions.length; i++) { - IConfigurationElement extension = extensions[i]; + for (IConfigurationElement extension : extensions) { LogicalStructureType type; try { type = new LogicalStructureType(extension); @@ -260,9 +257,9 @@ public class LogicalStructureManager { point= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LOGICAL_STRUCTURE_PROVIDERS); extensions= point.getConfigurationElements(); fTypeProviders = new ArrayList<>(extensions.length); - for (int i= 0; i < extensions.length; i++) { + for (IConfigurationElement extension : extensions) { try { - fTypeProviders.add(new LogicalStructureProvider(extensions[i])); + fTypeProviders.add(new LogicalStructureProvider(extension)); } catch (CoreException e) { DebugPlugin.log(e); } |