Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchammer2019-11-12 21:09:22 +0000
committerKarsten Thoms2019-12-10 20:55:08 +0000
commit16b7363007dbfa4eb1664350b2d19649d4d3a918 (patch)
tree47c4f4bb7921ea5d8f81782e775c574e1682a2c7 /org.eclipse.debug.ui/ui/org
parent3cc2eb1128810a7319e9e23c0fc6029c324fb30a (diff)
downloadeclipse.platform.debug-16b7363007dbfa4eb1664350b2d19649d4d3a918.tar.gz
eclipse.platform.debug-16b7363007dbfa4eb1664350b2d19649d4d3a918.tar.xz
eclipse.platform.debug-16b7363007dbfa4eb1664350b2d19649d4d3a918.zip
Use jdk 5 for-each loopI20191211-0135I20191210-1800
Replace simple uses of Iterator with a corresponding for-loop. Also add missing braces on loops as necessary. Change-Id: I41b3c365ba0817028550574834223d2d72569144 Signed-off-by: chammer <carsten.hammer@t-online.de>
Diffstat (limited to 'org.eclipse.debug.ui/ui/org')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/DebugTextHover.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/ExpressionInformationControlCreator.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java51
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/EventHandlerModelProxy.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java5
14 files changed, 78 insertions, 115 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java
index f8961d034..df143e554 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java
@@ -67,9 +67,8 @@ public class DebugModelPropertyTester extends PropertyTester {
getAdapter(receiver, IDebugModelProvider.class);
}
if (modelProvider != null) {
- String[] ids = modelProvider.getModelIdentifiers();
- for (int i = 0; i < ids.length; i++) {
- if (ids[i].equals(expectedValue)) {
+ for (String id : modelProvider.getModelIdentifiers()) {
+ if (id.equals(expectedValue)) {
return true;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
index 817aa1906..2a8885796 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
@@ -198,8 +198,8 @@ public class DebugCommandService implements IDebugContextListener {
}
}
// ABORT - no command processors
- for (int i = 0; i < actions.length; i++) {
- actions[i].setEnabled(false);
+ for (IEnabledTarget action : actions) {
+ action.setEnabled(false);
}
}
@@ -252,8 +252,7 @@ public class DebugCommandService implements IDebugContextListener {
*/
private Map<IDebugCommandHandler, List<Object>> collate(Object[] elements, Class<?> handlerType) {
Map<IDebugCommandHandler, List<Object>> map = new HashMap<>();
- for (int i = 0; i < elements.length; i++) {
- Object element = elements[i];
+ for (Object element : elements) {
IDebugCommandHandler handler = getHandler(element, handlerType);
if (handler == null) {
return null;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java
index 73e9c12d1..b81101eed 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java
@@ -139,9 +139,7 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
*/
private void loadDebugModelContextBindings() {
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), ID_DEBUG_MODEL_CONTEXT_BINDINGS);
- IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- IConfigurationElement element = configurationElements[i];
+ for (IConfigurationElement element : extensionPoint.getConfigurationElements()) {
String modelIdentifier = element.getAttribute(ATTR_DEBUG_MODEL_ID);
String contextId = element.getAttribute(ATTR_CONTEXT_ID);
synchronized (this) {
@@ -215,16 +213,15 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
alreadyEnabled = new HashSet<>();
fLaunchToModelIds.put(launch, alreadyEnabled);
}
- for (int i = 0; i < modelIds.length; i++) {
- String id = modelIds[i];
+ for (String id : modelIds) {
if (!alreadyEnabled.contains(id)) {
alreadyEnabled.add(id);
toEnable.add(id);
}
}
}
- for (int i = 0; i < toEnable.size(); i++) {
- activateModel(toEnable.get(i), launch);
+ for (String element : toEnable) {
+ activateModel(element, launch);
}
enableActivitiesFor(modelIds);
@@ -338,8 +335,7 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
@Override
public void launchesTerminated(ILaunch[] launches) {
// disable activated contexts
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
+ for (ILaunch launch : launches) {
List<IContextActivation> activations;
synchronized(this) {
activations = fLanuchToContextActivations.remove(launch);
@@ -385,8 +381,7 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
List<String> workbenchContexts = new ArrayList<>();
String[] modelIds = getDebugModelIds(target);
if (modelIds != null) {
- for (int i = 0; i < modelIds.length; i++) {
- String modelId = modelIds[i];
+ for (String modelId : modelIds) {
synchronized (this) {
List<String> contextIds = fModelToContextIds.get(modelId);
if (contextIds != null) {
@@ -410,8 +405,7 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
*/
private void enableActivitiesFor(String[] modelIds) {
Set<String> activities = null;
- for (int i = 0; i < modelIds.length; i++) {
- String id = modelIds[i];
+ for (String id : modelIds) {
if (!fModelsEnabledForActivities.contains(id)) {
Set<String> ids = fModelToActivities.get(id);
if (ids == null) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
index 2252c2baa..7b99a071b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
@@ -18,7 +18,6 @@ package org.eclipse.debug.internal.ui.contexts;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -251,10 +250,9 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
}
}
- outer: for (Iterator<String> itr = fListenersByPartId.keySet().iterator(); itr.hasNext();) {
- String listenerPartId = itr.next();
- for (int i = 0; i < fProviders.size(); i++) {
- String providerPartId = getCombinedPartId(fProviders.get(i).getPart());
+ outer: for (String listenerPartId : fListenersByPartId.keySet()) {
+ for (IDebugContextProvider provider : fProviders) {
+ String providerPartId = getCombinedPartId(provider.getPart());
if ((listenerPartId == null && providerPartId == null) ||
(listenerPartId != null && listenerPartId.equals(providerPartId)))
{
@@ -285,10 +283,9 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
retVal = new ListenerList<>();
}
- outer: for (Iterator<String> itr = fPostListenersByPartId.keySet().iterator(); itr.hasNext();) {
- String listenerPartId = itr.next();
- for (int i = 0; i < fProviders.size(); i++) {
- String providerPartId = getCombinedPartId(fProviders.get(i).getPart());
+ outer: for (String listenerPartId : fPostListenersByPartId.keySet()) {
+ for (IDebugContextProvider provider : fProviders) {
+ String providerPartId = getCombinedPartId(provider.getPart());
if ((listenerPartId == null && providerPartId == null) || (listenerPartId != null && listenerPartId.equals(providerPartId))) {
continue outer;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/DebugTextHover.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/DebugTextHover.java
index 9ca00b61c..fae00ba3d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/DebugTextHover.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/DebugTextHover.java
@@ -85,9 +85,7 @@ public class DebugTextHover implements ITextHover, ITextHoverExtension, ITextHov
*/
private static String replaceHTMLChars(String variableText) {
StringBuilder buffer= new StringBuilder(variableText.length());
- char[] characters = variableText.toCharArray();
- for (int i = 0; i < characters.length; i++) {
- char character= characters[i];
+ for (char character : variableText.toCharArray()) {
switch (character) {
case '<':
buffer.append("&lt;"); //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/ExpressionInformationControlCreator.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/ExpressionInformationControlCreator.java
index dc4f6f322..a0086d77d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/ExpressionInformationControlCreator.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/ExpressionInformationControlCreator.java
@@ -262,9 +262,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
if (view != null) {
// copy over properties
IPresentationContext copy = ((TreeModelViewer)view.getViewer()).getPresentationContext();
- String[] properties = copy.getProperties();
- for (int i = 0; i < properties.length; i++) {
- String key = properties[i];
+ for (String key : copy.getProperties()) {
fContext.setProperty(key, copy.getProperty(key));
}
}
@@ -276,9 +274,8 @@ public class ExpressionInformationControlCreator implements IInformationControlC
// copy over filters
StructuredViewer structuredViewer = (StructuredViewer) view.getViewer();
if (structuredViewer != null) {
- ViewerFilter[] filters = structuredViewer.getFilters();
- for (int i = 0; i < filters.length; i++) {
- fViewer.addFilter(filters[i]);
+ for (ViewerFilter filter : structuredViewer.getFilters()) {
+ fViewer.addFilter(filter);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
index ea34ebbf3..3c277383d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
@@ -16,7 +16,6 @@ package org.eclipse.debug.internal.ui.importexport.breakpoints;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
@@ -122,11 +121,9 @@ public class EmbeddedBreakpointsViewer {
map = ((DelegatingModelPresentation) current).getAttributes();
}
if(map != null) {
- Object key = null;
IDebugModelPresentation newpres = labelprovider.getPresentation();
- for (Iterator<String> iter = map.keySet().iterator(); iter.hasNext();) {
- key = iter.next();
- newpres.setAttribute((String) key, map.get(key));
+ for (String key : map.keySet()) {
+ newpres.setAttribute(key, map.get(key));
}
}
}
@@ -147,12 +144,10 @@ public class EmbeddedBreakpointsViewer {
* Performs the initialization of the viewer from a selection
*/
private void initViewerState() {
- Object[] items = fSelection.toArray();
fViewer.setGrayedElements(new Object[] {});
fViewer.setCheckedElements(new Object[] {});
ArrayList<IBreakpoint> list = new ArrayList<>();
- for(int i = 0; i < items.length; i++) {
- Object item = items[i];
+ for (Object item : fSelection.toArray()) {
IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(item, IBreakpoint.class);
if(breakpoint != null) {
list.add(breakpoint);
@@ -161,8 +156,8 @@ public class EmbeddedBreakpointsViewer {
getBreakpointsFromContainers((IBreakpointContainer)item, list);
}
}
- for(int i = 0; i < list.size(); i++) {
- updateCheckedState(list.get(i), true);
+ for (IBreakpoint element : list) {
+ updateCheckedState(element, true);
}
}
@@ -182,11 +177,10 @@ public class EmbeddedBreakpointsViewer {
* @return the selection from the viewer with no duplicates
*/
public IStructuredSelection getCheckedElements() {
- Object[] list = fViewer.getCheckedElements();
Vector<Object> selected = new Vector<>();
- for(int i = 0; i < list.length; i++) {
- if(!selected.contains(list[i])) {
- selected.addElement(list[i]);
+ for (Object element : fViewer.getCheckedElements()) {
+ if(!selected.contains(element)) {
+ selected.addElement(element);
}
}
return new StructuredSelection(selected);
@@ -207,9 +201,8 @@ public class EmbeddedBreakpointsViewer {
*/
private Widget[] searchItems(Object element) {
ArrayList<TreeItem> list = new ArrayList<>();
- TreeItem[] items = fTree.getItems();
- for (int i = 0; i < items.length; i++) {
- findAllOccurrences(items[i], element, list);
+ for (TreeItem item : fTree.getItems()) {
+ findAllOccurrences(item, element, list);
}
return list.toArray(new Widget[0]);
}
@@ -224,9 +217,8 @@ public class EmbeddedBreakpointsViewer {
if (element.equals(item.getData())) {
list.add(item);
}
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- findAllOccurrences(items[i], element, list);
+ for (TreeItem childItem : item.getItems()) {
+ findAllOccurrences(childItem, element, list);
}
}
@@ -239,10 +231,9 @@ public class EmbeddedBreakpointsViewer {
private void updateCheckedState(Object obj, boolean enable) {
IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(obj, IBreakpoint.class);
if (breakpoint != null) {
- Widget[] list = searchItems(obj);
TreeItem item = null;
- for(int i = 0; i < list.length; i++) {
- item = (TreeItem)list[i];
+ for (Widget element : searchItems(obj)) {
+ item = (TreeItem)element;
item.setChecked(enable);
refreshParents(item);
}
@@ -250,8 +241,8 @@ public class EmbeddedBreakpointsViewer {
else if (obj instanceof BreakpointContainer) {
ArrayList<IBreakpoint> bps = new ArrayList<>();
getBreakpointsFromContainers((BreakpointContainer)obj, bps);
- for(int j = 0; j < bps.size(); j++) {
- updateCheckedState(bps.get(j), enable);
+ for (IBreakpoint bp : bps) {
+ updateCheckedState(bp, enable);
}
}
}
@@ -291,10 +282,9 @@ public class EmbeddedBreakpointsViewer {
* @return treu is any one or more children is grayed, false otherwise
*/
private int getNumberChildrenGrayed(TreeItem parent) {
- TreeItem[] children = parent.getItems();
int count = 0;
- for(int i = 0; i < children.length; i++) {
- if(children[i].getGrayed()) {
+ for (TreeItem element : parent.getItems()) {
+ if(element.getGrayed()) {
count++;
}
}
@@ -307,10 +297,9 @@ public class EmbeddedBreakpointsViewer {
* @return true if all children are checked, false otherwise
*/
private int getNumberChildrenChecked(TreeItem parent) {
- TreeItem[] children = parent.getItems();
int count = 0;
- for(int i = 0; i < children.length; i++) {
- if(children[i].getChecked()) {
+ for (TreeItem element : parent.getItems()) {
+ if(element.getChecked()) {
count++;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java
index 2d3ea7646..51813e8b4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java
@@ -60,21 +60,21 @@ public class ExpressionContentProvider extends VariableContentProvider {
@Override
public void update(ILabelUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- String[] columnIds = updates[i].getColumnIds();
+ for (ILabelUpdate update : updates) {
+ String[] columnIds = update.getColumnIds();
if (columnIds == null) {
- updateLabel(updates[i], 0);
+ updateLabel(update, 0);
} else {
for (int j = 0; j < columnIds.length; j++) {
if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(columnIds[j])) {
- updateLabel(updates[i], j);
+ updateLabel(update, j);
} else {
- updates[i].setLabel(IInternalDebugCoreConstants.EMPTY_STRING, j);
+ update.setLabel(IInternalDebugCoreConstants.EMPTY_STRING, j);
}
}
}
- updates[i].done();
+ update.done();
}
}
@@ -148,21 +148,21 @@ public class ExpressionContentProvider extends VariableContentProvider {
* @since 3.4
*/
private void findDelegates(Map<IElementContentProvider, List<IViewerUpdate>> delegateMap, List<IViewerUpdate> notDelegated, IViewerUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- if (updates[i] instanceof ViewerUpdateMonitor && !((ViewerUpdateMonitor)updates[i]).isDelegated() && updates[i].getElement() instanceof IExpression){
- IElementContentProvider delegate = ViewerAdapterService.getContentProvider(((IExpression)updates[i].getElement()).getValue());
+ for (IViewerUpdate update : updates) {
+ if (update instanceof ViewerUpdateMonitor && !((ViewerUpdateMonitor)update).isDelegated() && update.getElement() instanceof IExpression){
+ IElementContentProvider delegate = ViewerAdapterService.getContentProvider(((IExpression)update.getElement()).getValue());
if (delegate != null){
List<IViewerUpdate> updateList = delegateMap.get(delegate);
if (updateList == null){
updateList = new ArrayList<>();
delegateMap.put(delegate, updateList);
}
- ((ViewerUpdateMonitor)updates[i]).setDelegated(true);
- updateList.add(updates[i]);
+ ((ViewerUpdateMonitor)update).setDelegated(true);
+ updateList.add(update);
continue;
}
}
- notDelegated.add(updates[i]);
+ notDelegated.add(update);
}
}
@@ -174,8 +174,8 @@ public class ExpressionContentProvider extends VariableContentProvider {
if (expression.hasErrors()) {
String[] messages = expression.getErrorMessages();
LinkedHashSet<ErrorMessageElement> set = new LinkedHashSet<>(messages.length);
- for (int i = 0; i < messages.length; i++) {
- set.add(new ErrorMessageElement(messages[i]));
+ for (String message : messages) {
+ set.add(new ErrorMessageElement(message));
}
return set.toArray();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java
index a6b124150..2f3171d02 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java
@@ -55,21 +55,21 @@ public class ExpressionManagerContentProvider extends ElementContentProvider {
@Override
public void update(ILabelUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- String[] columnIds = updates[i].getColumnIds();
+ for (ILabelUpdate update : updates) {
+ String[] columnIds = update.getColumnIds();
if (columnIds == null) {
- updateLabel(updates[i], 0);
+ updateLabel(update, 0);
} else {
for (int j = 0; j < columnIds.length; j++) {
if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(columnIds[j])) {
- updateLabel(updates[i], j);
+ updateLabel(update, j);
} else {
- updates[i].setLabel(IInternalDebugCoreConstants.EMPTY_STRING, j);
+ update.setLabel(IInternalDebugCoreConstants.EMPTY_STRING, j);
}
}
}
- updates[i].done();
+ update.done();
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java
index ee7f58541..ba0b93b4b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java
@@ -57,9 +57,7 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
if (!isDisposed()) {
- IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (int i = 0; i < workbenchWindows.length; i++) {
- IWorkbenchWindow window = workbenchWindows[i];
+ for (IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) {
// Virtual viewer may have a null control.
Control control = viewer.getControl();
if (control != null && control.getShell().equals(window.getShell())) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/EventHandlerModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/EventHandlerModelProxy.java
index 68eec9df9..82407f3cc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/EventHandlerModelProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/EventHandlerModelProxy.java
@@ -94,8 +94,7 @@ public abstract class EventHandlerModelProxy extends AbstractModelProxy implemen
fTimer.cancel();
fTimerTasks.clear();
DebugPlugin.getDefault().removeDebugEventListener(this);
- for (int i = 0; i < fHandlers.length; i++) {
- DebugEventHandler handler = fHandlers[i];
+ for (DebugEventHandler handler : fHandlers) {
handler.dispose();
}
}
@@ -112,11 +111,9 @@ public abstract class EventHandlerModelProxy extends AbstractModelProxy implemen
if (isDisposed()) {
return;
}
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
+ for (DebugEvent event : events) {
if (containsEvent(event)) {
- for (int j = 0; j < fHandlers.length; j++) {
- DebugEventHandler handler = fHandlers[j];
+ for (DebugEventHandler handler : fHandlers) {
if (isDisposed()) {
return;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java
index 3dd39e4df..abe973266 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java
@@ -82,14 +82,10 @@ public class ConsoleTerminateAction extends Action implements IUpdate {
*/
private List<ITerminate> collectTargets(IProcess process) {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunch[] launches = launchManager.getLaunches();
List<ITerminate> targets = new ArrayList<>();
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
- IProcess[] processes = launch.getProcesses();
- for (int j = 0; j < processes.length; j++) {
- IProcess process2 = processes[j];
- if (process2.equals(process)) {
+ for (ILaunch launch : launchManager.getLaunches()) {
+ for (IProcess proc : launch.getProcesses()) {
+ if (proc.equals(process)) {
IDebugTarget[] debugTargets = launch.getDebugTargets();
Collections.addAll(targets, debugTargets);
return targets; // all possible targets have been terminated for the launch.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
index 870b46430..af04b5154 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
@@ -85,26 +85,26 @@ public class ExpressionDropAdapter extends ViewerDropAdapter {
fDropType = DROP_TYPE_DEFAULT;
event.detail = DND.DROP_NONE;
- for (int i = 0; i < event.dataTypes.length; i++) {
- if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataTypes[i])) {
+ for (TransferData dataType : event.dataTypes) {
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(dataType)) {
if (isExpressionDrop()){
- event.currentDataType = event.dataTypes[i];
+ event.currentDataType = dataType;
event.detail = DND.DROP_MOVE;
fDropType = DROP_TYPE_EXPRESSION;
break;
} else if (isVariableDrop()){
- event.currentDataType = event.dataTypes[i];
+ event.currentDataType = dataType;
event.detail = DND.DROP_COPY;
fDropType = DROP_TYPE_VARIABLE;
break;
} else if (isWatchAdaptableElementDrop()){
- event.currentDataType = event.dataTypes[i];
+ event.currentDataType = dataType;
event.detail = DND.DROP_COPY;
fDropType = DROP_TYPE_WATCH_ADAPTABLE_ELEMENT;
break;
}
- } else if (TextTransfer.getInstance().isSupportedType(event.dataTypes[i])) {
- event.currentDataType = event.dataTypes[i];
+ } else if (TextTransfer.getInstance().isSupportedType(dataType)) {
+ event.currentDataType = dataType;
event.detail = DND.DROP_COPY;
fDropType = DROP_TYPE_DEFAULT;
break;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java
index d86750f7f..d49abd01c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java
@@ -579,9 +579,8 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab {
* @return whether the new name should be used or not
*/
private boolean canRenameVariable(String newVariableName) {
- TableItem[] items = environmentTable.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- EnvironmentVariable existingVariable = (EnvironmentVariable) items[i].getData();
+ for (TableItem item : environmentTable.getTable().getItems()) {
+ EnvironmentVariable existingVariable = (EnvironmentVariable) item.getData();
if (existingVariable.getName().equals(newVariableName)) {
boolean overWrite = MessageDialog.openQuestion(getShell(),

Back to the top