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 | |
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>
10 files changed, 169 insertions, 225 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); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java index ca5219b40..99ae859ea 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java @@ -485,8 +485,8 @@ public class LaunchingResourceManager implements IPropertyChangeListener, IWindo Object o = selection.getFirstElement(); LaunchShortcutExtension ext = null; ILaunchConfiguration[] cfgs = null; - for(int i = 0; i < shortcuts.size(); i++) { - ext = shortcuts.get(i); + for (LaunchShortcutExtension shortcut : shortcuts) { + ext = shortcut; if(o instanceof IEditorPart) { cfgs = ext.getLaunchConfigurations((IEditorPart)o); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java index 1898e7821..ec0934c17 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java @@ -197,9 +197,8 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici launchManager.addLaunchListener(this); DebugUIPlugin.getDefault().addSaveParticipant(this); //update histories for launches already registered - ILaunch[] launches = launchManager.getLaunches(); - for (int i = 0; i < launches.length; i++) { - launchAdded(launches[i]); + for (ILaunch launch : launchManager.getLaunches()) { + launchAdded(launch); } } @@ -243,14 +242,10 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici return configurations; } List<ILaunchConfiguration> filteredConfigs = new ArrayList<>(); - ILaunchConfigurationType type = null; - LaunchConfigurationTypeContribution contribution = null; - ILaunchConfiguration configuration = null; - for (int i = 0; i < configurations.length; i++) { - configuration = configurations[i]; + for (ILaunchConfiguration configuration : configurations) { try { - type = configuration.getType(); - contribution = new LaunchConfigurationTypeContribution(type); + ILaunchConfigurationType type = configuration.getType(); + LaunchConfigurationTypeContribution contribution = new LaunchConfigurationTypeContribution(type); if (DebugUIPlugin.doLaunchConfigurationFiltering(configuration) & !WorkbenchActivityHelper.filterItem(contribution)) { filteredConfigs.add(configuration); } @@ -275,10 +270,10 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici return delegates; } HashSet<ILaunchDelegate> set = new HashSet<>(); - for(int i = 0; i < delegates.length; i++) { + for (ILaunchDelegate delegate : delegates) { //filter by capabilities - if(!WorkbenchActivityHelper.filterItem(new LaunchDelegateContribution(delegates[i]))) { - set.add(delegates[i]); + if(!WorkbenchActivityHelper.filterItem(new LaunchDelegateContribution(delegate))) { + set.add(delegate); } } return set.toArray(new ILaunchDelegate[set.size()]); @@ -327,9 +322,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici protected void removeTerminatedLaunches(ILaunch newLaunch) { if (DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugUIConstants.PREF_AUTO_REMOVE_OLD_LAUNCHES)) { ILaunchManager lManager= DebugPlugin.getDefault().getLaunchManager(); - Object[] launches= lManager.getLaunches(); - for (int i= 0; i < launches.length; i++) { - ILaunch launch= (ILaunch)launches[i]; + for (ILaunch launch : lManager.getLaunches()) { if (launch != newLaunch && launch.isTerminated()) { lManager.removeLaunch(launch); } @@ -434,8 +427,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici * @throws CoreException is an exception occurs */ protected void createEntry(Document doc, Element historyRootElement, ILaunchConfiguration[] configurations) throws CoreException { - for (int i = 0; i < configurations.length; i++) { - ILaunchConfiguration configuration = configurations[i]; + for (ILaunchConfiguration configuration : configurations) { if (configuration.exists()) { Element launch = doc.createElement(IConfigurationElementConstants.LAUNCH); launch.setAttribute(IConfigurationElementConstants.MEMENTO, configuration.getMemento()); @@ -561,18 +553,16 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici if (node.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element)node; if (element.getNodeName().equals(IConfigurationElementConstants.MRU_HISTORY)) { - ILaunchConfiguration[] configs = getLaunchConfigurations(element); - for (int j = 0; j < configs.length; j++) { - history.addHistory(configs[j], false); + for (ILaunchConfiguration config : getLaunchConfigurations(element)) { + history.addHistory(config, false); } } else if (element.getNodeName().equals(IConfigurationElementConstants.FAVORITES)) { ILaunchConfiguration[] favs = getLaunchConfigurations(element); history.setFavorites(favs); // add any favorites that have been added to the workspace before this plug-in // was loaded - @see bug 231600 - ILaunchConfiguration[] configurations = getLaunchManager().getLaunchConfigurations(); - for (int j = 0; j < configurations.length; j++) { - history.checkFavorites(configurations[j]); + for (ILaunchConfiguration configuration : getLaunchManager().getLaunchConfigurations()) { + history.checkFavorites(configuration); } } } @@ -627,9 +617,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici //touch the type to see if its type exists launchConfig.getType(); if (launchConfig.exists()) { - LaunchHistory history = null; - for (int i = 0; i < histories.length; i++) { - history = histories[i]; + for (LaunchHistory history : histories) { if (history.accepts(launchConfig) && history.getLaunchGroup().getMode().equals(mode)) { history.addHistory(launchConfig, prepend); } @@ -651,8 +639,8 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici // Load the configuration elements into a Map fLaunchShortcuts = new ArrayList<>(infos.length); - for (int i = 0; i < infos.length; i++) { - fLaunchShortcuts.add(new LaunchShortcutExtension(infos[i])); + for (IConfigurationElement info : infos) { + fLaunchShortcuts.add(new LaunchShortcutExtension(info)); } Collections.sort(fLaunchShortcuts, new ShortcutComparator()); } @@ -670,8 +658,8 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici // Load the configuration elements into a Map fLaunchGroups = new HashMap<>(infos.length); LaunchGroupExtension ext = null; - for (int i = 0; i < infos.length; i++) { - ext = new LaunchGroupExtension(infos[i]); + for (IConfigurationElement info : infos) { + ext = new LaunchGroupExtension(info); fLaunchGroups.put(ext.getIdentifier(), ext); } } @@ -779,16 +767,12 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici //copy into collection for hashcode matching HashSet<String> typeset = new HashSet<>(ctypes.length); Collections.addAll(typeset, ctypes); - ILaunchConfiguration[] configurations = filterConfigs(getLaunchManager().getLaunchConfigurations()); - ILaunchConfiguration configuration = null; - IResource[] resrcs = null; - for(int i = 0; i < configurations.length; i++) { - configuration = configurations[i]; + for (ILaunchConfiguration configuration : filterConfigs(getLaunchManager().getLaunchConfigurations())) { if(typeset.contains(configuration.getType().getIdentifier()) && acceptConfiguration(configuration)) { - resrcs = configuration.getMappedResources(); + IResource[] resrcs = configuration.getMappedResources(); if (resrcs != null) { - for (int j = 0; j < resrcs.length; j++) { - if (resource.equals(resrcs[j]) || resource.getFullPath().isPrefixOf(resrcs[j].getFullPath())) { + for (IResource res : resrcs) { + if (resource.equals(res) || resource.getFullPath().isPrefixOf(res.getFullPath())) { list.add(configuration); break; } @@ -908,13 +892,13 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici LaunchHistory history = getLaunchHistory(group.getIdentifier()); if(history != null) { ILaunchConfiguration[] configs = history.getCompleteLaunchHistory(); - for(int i = 0; i < configs.length; i++) { - if(configurations.contains(configs[i])) { + for (ILaunchConfiguration config : configs) { + if(configurations.contains(config)) { if(resource instanceof IContainer) { - return configs[i]; + return config; } else { - candidates.add(configs[i]); + candidates.add(config); } } } @@ -925,8 +909,8 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici try { res = config.getMappedResources(); if(res != null) { - for(int i = 0; i < res.length; i++) { - if(res[i].equals(resource)) { + for (IResource re : res) { + if(re.equals(resource)) { return config; } } @@ -935,9 +919,9 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici catch(CoreException ce) {} } } - for(int i = 0; i < configs.length; i++) { - if(candidates.contains(configs[i])) { - return configs[i]; + for (ILaunchConfiguration config : configs) { + if(candidates.contains(config)) { + return config; } } } @@ -1059,8 +1043,8 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici ILaunchGroup[] groups = getLaunchGroups(); fLaunchHistories = new HashMap<>(groups.length); ILaunchGroup extension = null; - for (int i = 0; i < groups.length; i++) { - extension = groups[i]; + for (ILaunchGroup group : groups) { + extension = group; if (extension.isPublic()) { fLaunchHistories.put(extension.getIdentifier(), new LaunchHistory(extension)); } @@ -1097,10 +1081,9 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici return null; } String category = type.getCategory(); - ILaunchGroup[] groups = getLaunchGroups(); ILaunchGroup extension = null; - for (int i = 0; i < groups.length; i++) { - extension = groups[i]; + for (ILaunchGroup group : getLaunchGroups()) { + extension = group; if (category == null) { if (extension.getCategory() == null && extension.getMode().equals(mode)) { return extension; @@ -1147,10 +1130,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici String id = type.getIdentifier(); String name = id + ".SHARED_INFO"; //$NON-NLS-1$ ILaunchConfiguration shared = null; - ILaunchConfiguration[] configurations = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(type); - ILaunchConfiguration configuration = null; - for (int i = 0; i < configurations.length; i++) { - configuration = configurations[i]; + for (ILaunchConfiguration configuration : DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(type)) { if (configuration.getName().equals(name)) { shared = configuration; break; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java index cd8b1a640..cfdeacac5 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java @@ -20,7 +20,6 @@ import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; -import java.util.Iterator; import java.util.Set; import org.eclipse.core.runtime.CoreException; @@ -1269,8 +1268,8 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun } value = IInternalDebugCoreConstants.EMPTY_STRING; //build the preference string - for (Iterator<String> iter = list.iterator(); iter.hasNext();) { - value += iter.next() + DELIMITER; + for (String segment : list) { + value += segment + DELIMITER; } settings.put(DIALOG_EXPANDED_NODES, value); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java index 2e5c82fda..bed606c1b 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java @@ -321,9 +321,7 @@ public class LaunchConfigurationsPreferencePage extends PreferencePage implement * @since 3.2 */ private void initFieldEditors() { - FieldEditor editor; - for(int i = 0; i < fFieldEditors.size(); i++) { - editor = fFieldEditors.get(i); + for (FieldEditor editor : fFieldEditors) { editor.setPreferenceStore(getPreferenceStore()); editor.load(); } @@ -331,10 +329,9 @@ public class LaunchConfigurationsPreferencePage extends PreferencePage implement Platform.getPreferencesService().getBoolean(DebugPlugin.getUniqueIdentifier(), DebugPlugin.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true, null)); //restore the tables' checked state - String[] types = getPreferenceStore().getString(IInternalDebugUIConstants.PREF_FILTER_TYPE_LIST).split("\\,"); //$NON-NLS-1$ TableItem[] items = fTable.getItems(); ILaunchConfigurationType type; - for (String t : types) { + for (String t : getPreferenceStore().getString(IInternalDebugUIConstants.PREF_FILTER_TYPE_LIST).split("\\,")) { //$NON-NLS-1$ for (TableItem item : items) { type = (ILaunchConfigurationType) item.getData(); if (type.getIdentifier().equals(t)) { @@ -347,29 +344,25 @@ public class LaunchConfigurationsPreferencePage extends PreferencePage implement @Override protected void performDefaults() { fDeleteConfigs.setSelection(Preferences.getDefaultBoolean(DebugPlugin.getUniqueIdentifier(), DebugPlugin.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true)); - FieldEditor editor = null; - for(int i = 0; i < fFieldEditors.size(); i++) { - editor = fFieldEditors.get(i); + for (FieldEditor editor : fFieldEditors) { editor.loadDefault(); if(editor instanceof BooleanFieldEditor2) { fTable.setEnabled(((BooleanFieldEditor2)editor).getBooleanValue()); } } - } @Override public boolean performOk() { //save field editors - for(int i = 0; i < fFieldEditors.size(); i++) { - fFieldEditors.get(i).store(); + for (FieldEditor editor : fFieldEditors) { + editor.store(); } Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), DebugPlugin.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, fDeleteConfigs.getSelection(), null); //save table String types = IInternalDebugCoreConstants.EMPTY_STRING; - TableItem[] items = fTable.getItems(); ILaunchConfigurationType type; - for (TableItem item : items) { + for (TableItem item : fTable.getItems()) { if (item.getChecked()) { type = (ILaunchConfigurationType) item.getData(); types += type.getIdentifier()+","; //$NON-NLS-1$ diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java index 23b970649..750ba5e74 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java @@ -544,21 +544,14 @@ public class LaunchPerspectivePreferencePage extends PreferencePage implements I fSwitchSuspend.loadDefault(); PerspectiveManager pm = DebugUIPlugin.getDefault().getPerspectiveManager(); - TreeItem[] items = fTree.getItems(); - ILaunchConfigurationType type = null; - Set<Set<String>> modes = null; - Object[] delegates = null; - for(int i = 0; i < items.length; i++) { - type = (ILaunchConfigurationType) items[i].getData(); - modes = type.getSupportedModeCombinations(); - delegates = fTreeViewer.getFilteredChildren(type); - for (Set<String> modeset : modes) { + for (TreeItem item : fTree.getItems()) { + ILaunchConfigurationType type = (ILaunchConfigurationType) item.getData(); + for (Set<String> modeset : type.getSupportedModeCombinations()) { fgChangeSet.add(new PerspectiveChange(type, null, modeset, pm.getDefaultLaunchPerspective(type, null, modeset))); } - for(int j = 0; j < delegates.length; j++) { - ILaunchDelegate delegate = (ILaunchDelegate) delegates[j]; - modes = new HashSet<>(delegate.getModes()); - for (Set<String> modeset : modes) { + for (Object child : fTreeViewer.getFilteredChildren(type)) { + ILaunchDelegate delegate = (ILaunchDelegate) child; + for (Set<String> modeset : new HashSet<>(delegate.getModes())) { fgChangeSet.add(new PerspectiveChange(type, delegate, modeset, pm.getDefaultLaunchPerspective(type, delegate, modeset))); } } @@ -580,13 +573,12 @@ public class LaunchPerspectivePreferencePage extends PreferencePage implements I ArrayList<String> labels = new ArrayList<>(); labels.add(DebugPreferencesMessages.PerspectivePreferencePage_4); IPerspectiveRegistry registry = PlatformUI.getWorkbench().getPerspectiveRegistry(); - IPerspectiveDescriptor[] descriptors = registry.getPerspectives(); String label = null; - for(int i = 0; i < descriptors.length; i++) { - if(!WorkbenchActivityHelper.filterItem(descriptors[i])) { - label = descriptors[i].getLabel(); + for (IPerspectiveDescriptor descriptor : registry.getPerspectives()) { + if(!WorkbenchActivityHelper.filterItem(descriptor)) { + label = descriptor.getLabel(); labels.add(label); - fgPerspectiveIdMap.put(label, descriptors[i].getId()); + fgPerspectiveIdMap.put(label, descriptor.getId()); } } fgPerspectiveLabels = labels.toArray(new String[labels.size()]); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java index c94d5ada4..51119c0ff 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java @@ -24,7 +24,6 @@ import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.TreeSet; @@ -385,10 +384,9 @@ public class LaunchView extends AbstractDebugView synchronized (this) { if (fContext instanceof ITreeSelection) { ITreeSelection ss = (ITreeSelection) fContext; - TreePath[] ssPaths = ss.getPaths(); - for (int i = 0; i < ssPaths.length; i++) { - if (ssPaths[i].startsWith(element, null)) { - if (ssPaths[i].getSegmentCount() == element.getSegmentCount()) { + for (TreePath path : ss.getPaths()) { + if (path.startsWith(element, null)) { + if (path.getSegmentCount() == element.getSegmentCount()) { event = new DebugContextEvent(this, fContext, type); } else { // if parent of the currently selected element @@ -486,8 +484,8 @@ public class LaunchView extends AbstractDebugView super(LaunchView.this); fProviders = providers; fActiveProvider = providers[0]; - for (int i = 0; i < fProviders.length; i++) { - fProviders[i].addDebugContextListener(this); + for (IDebugContextProvider provider : fProviders) { + provider.addDebugContextListener(this); } } @@ -519,8 +517,8 @@ public class LaunchView extends AbstractDebugView } void dispose() { - for (int i = 0; i < fProviders.length; i++) { - fProviders[i].removeDebugContextListener(this); + for (IDebugContextProvider provider : fProviders) { + provider.removeDebugContextListener(this); } fProviders = null; fActiveProvider = null; @@ -637,8 +635,8 @@ public class LaunchView extends AbstractDebugView IPreferenceStore prefStore = DebugUIPlugin.getDefault().getPreferenceStore(); String mode = prefStore.getString(IDebugPreferenceConstants.DEBUG_VIEW_MODE); setViewMode(mode, parent); - for (int i = 0; i < fDebugViewModeActions.length; i++) { - fDebugViewModeActions[i].setChecked(fDebugViewModeActions[i].getMode().equals(mode)); + for (DebugViewModeAction action : fDebugViewModeActions) { + action.setChecked(action.getMode().equals(mode)); } createDebugToolBarInViewActions(parent); @@ -958,8 +956,8 @@ public class LaunchView extends AbstractDebugView } StringBuilder buffer= new StringBuilder(); - for (Iterator<String> itr = fDebugToolbarPerspectives.iterator(); itr.hasNext();) { - buffer.append(itr.next()).append(','); + for (String perspectiveId : fDebugToolbarPerspectives) { + buffer.append(perspectiveId).append(','); } getPreferenceStore().setValue(IDebugPreferenceConstants.DEBUG_VIEW_TOOLBAR_HIDDEN_PERSPECTIVES, buffer.toString()); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java index 6edd222ea..ff175503e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java @@ -87,10 +87,10 @@ public class LaunchViewCopyToClipboardActionDelegate extends VirtualCopyToClipbo if (items == null) { return; } - for (int i = 0; i < items.length; i++) { - set.add(items[i]); - if (items[i].getExpanded()) { - collectChildItems(set, items[i].getItems()); + for (TreeItem item : items) { + set.add(item); + if (item.getExpanded()) { + collectChildItems(set, item.getItems()); } } } |