Bug 551568 - add children to delegates

Change-Id: Ib911d62c6a4e066b0e15a924c778b1d64b39ceb3
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
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 750ba5e..2295df9 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
@@ -468,27 +468,22 @@
 
 	//prep selection context, remove types from the equation
 		HashSet<ILaunchDelegate> delegates = new HashSet<>();
-		Object o = null;
-		for(int i = 0; i < selection.length; i++) {
-			o = selection[i];
+		for (Object o : selection) {
 			if(o instanceof ILaunchDelegate) {
 				delegates.add((ILaunchDelegate) o);
 			}
 			else if(o instanceof ILaunchConfigurationType) {
 				fgCurrentWorkingContext.add(o);
-				Object[] kids = fTreeViewer.getFilteredChildren(o);
-				for (int j = 0; j < kids.length; j++) {
-					delegates.add((ILaunchDelegate) kids[i]);
+				for (Object kid : fTreeViewer.getFilteredChildren(o)) {
+					delegates.add((ILaunchDelegate) kid);
 				}
 			}
 		}
 	//compare the listing of delegates to find common mode sets
 		HashSet<Set<String>> common = new HashSet<>();
-		List<Set<String>> modes = null;
 		HashSet<Set<String>> pruned = new HashSet<>();
 		for (ILaunchDelegate delegate : delegates) {
-			modes = delegate.getModes();
-			for (Set<String> fmodes : modes) {
+			for (Set<String> fmodes : delegate.getModes()) {
 				if (isCommonModeset(fmodes, delegates, pruned)) {
 					common.add(fmodes);
 					fgCurrentWorkingContext.add(delegate);