Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchammer2019-11-13 19:46:53 +0000
committerKarsten Thoms2019-11-14 20:34:53 +0000
commitb6ba22337a71947b6accd816def6d99beb20a8ca (patch)
treeaa527995e66d609ed4b7f87488ea312da066dcb4 /org.eclipse.debug.ui/ui/org
parent2d8961f9216a5f2d26b44ae19f75c652ba5b0f48 (diff)
downloadeclipse.platform.debug-b6ba22337a71947b6accd816def6d99beb20a8ca.tar.gz
eclipse.platform.debug-b6ba22337a71947b6accd816def6d99beb20a8ca.tar.xz
eclipse.platform.debug-b6ba22337a71947b6accd816def6d99beb20a8ca.zip
Use jdk 5 for-each loopI20191114-1800
Replace simple uses of Iterator with a corresponding for-loop. Also add missing braces on loops as necessary. Change-Id: I87544aca0942d3b3a9ea40f9994f1a12c75a4f9e 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/VariableValueEditorManager.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsPage.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java35
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualFindAction.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java44
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneSelectionProvider.java4
14 files changed, 69 insertions, 101 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariableValueEditorManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariableValueEditorManager.java
index 4266ff096..2608bf0cc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariableValueEditorManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariableValueEditorManager.java
@@ -100,8 +100,7 @@ public class VariableValueEditorManager {
private void loadVariableEditors() {
IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_VARIABLE_VALUE_EDITORS);
IConfigurationElement[] elements = ep.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
+ for (IConfigurationElement element : elements) {
String modelId = element.getAttribute("modelId"); //$NON-NLS-1$
if (modelId != null) {
fEditorMap.put(modelId, element);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java
index 6c9509d95..d316c5382 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java
@@ -459,14 +459,13 @@ public class ToggleBreakpointsTargetManager implements IToggleBreakpointsTargetM
fKnownFactories = new LinkedHashMap<>();
fKnownFactories.put(DEFAULT_TOGGLE_TARGET_ID, new ToggleBreakpointsTargetAdapterFactory());
IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_TOGGLE_BREAKPOINTS_TARGET_FACTORIES);
- IConfigurationElement[] elements = ep.getConfigurationElements();
- for (int i= 0; i < elements.length; i++) {
- String id = elements[i].getAttribute(IConfigurationElementConstants.ID);
+ for (IConfigurationElement element : ep.getConfigurationElements()) {
+ String id = element.getAttribute(IConfigurationElementConstants.ID);
if (id != null && id.length() != 0) {
if (fKnownFactories.containsKey(id)) {
DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, "org.eclipse.debug.ui.toggleBreakpointsTargetFactory extension failed to load breakpoint toggle target because the specified id is already registered. Specified ID is: " + id, null)); //$NON-NLS-1$
} else {
- fKnownFactories.put(id, new ToggleTargetFactory(elements[i]));
+ fKnownFactories.put(id, new ToggleTargetFactory(element));
}
} else {
DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, "org.eclipse.debug.ui.toggleBreakpointsTargetFactory extension failed to load breakpoint toggle target because the specified id is empty.", null)); //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java
index 40ad431b6..cf62aaf60 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java
@@ -98,9 +98,8 @@ public class TerminateAndRemoveAction extends DebugCommandAction {
boolean isAllTerminated = true;
ISelection context = event.getContext();
if (context instanceof IStructuredSelection) {
- Object[] elements = ((IStructuredSelection)context).toArray();
- for (int i = 0; i < elements.length; i++) {
- if (!isTerminated(elements[i])) {
+ for (Object element : ((IStructuredSelection)context)) {
+ if (!isTerminated(element)) {
isAllTerminated = false;
break;
}
@@ -129,8 +128,8 @@ public class TerminateAndRemoveAction extends DebugCommandAction {
protected void postExecute(IRequest request, Object[] targets) {
IStatus status = request.getStatus();
if(status == null || status.isOK()) {
- for (int i = 0; i < targets.length; i++) {
- ILaunch launch = DebugUIPlugin.getLaunch(targets[i]);
+ for (Object target : targets) {
+ ILaunch launch = DebugUIPlugin.getLaunch(target);
if (launch != null) {
DebugPlugin.getDefault().getLaunchManager().removeLaunch(launch);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsPage.java
index 472c6450d..fe0921f59 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsPage.java
@@ -226,10 +226,10 @@ public class WizardImportBreakpointsPage extends WizardPage implements Listener
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
for (IBreakpoint importedBreakpoint : importedBreakpoints) {
boolean selected = false;
- for (int j = 0; j < selectedMarkers.size(); j++) {
+ for (IMarker selectedMarker : selectedMarkers) {
try {
Map<String, Object> importedMarkerAttributes = importedBreakpoint.getMarker().getAttributes();
- Map<String, Object> selectedMarkerAttributes = selectedMarkers.get(j).getAttributes();
+ Map<String, Object> selectedMarkerAttributes = selectedMarker.getAttributes();
if(importedMarkerAttributes.equals(selectedMarkerAttributes)) {
selected = true;
break;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java
index f0e0df884..177c36dfa 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java
@@ -67,8 +67,8 @@ public class WizardImportBreakpointsSelectionPage extends WizardPage {
}
List<IMarker> markers = new ArrayList<>();
List<IBreakpoint> breakpoints = fTView.getCheckedElements().toList();
- for(int i = 0; i < breakpoints.size(); i++) {
- markers.add(breakpoints.get(i).getMarker());
+ for (IBreakpoint breakpoint : breakpoints) {
+ markers.add(breakpoint.getMarker());
}
return markers;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java
index eba619326..b111152ed 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java
@@ -15,7 +15,6 @@
package org.eclipse.debug.internal.ui.preferences;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
@@ -184,18 +183,17 @@ public class ViewManagementPreferencePage extends PreferencePage implements IWor
@Override
public boolean performOk() {
- Object[] descriptors = fPerspectiveViewer.getCheckedElements();
Set<String> perspectives = new HashSet<>();
- for (int i = 0; i < descriptors.length; i++) {
- perspectives.add( ((IPerspectiveDescriptor)descriptors[i]).getId() );
+ for (Object descriptor : fPerspectiveViewer.getCheckedElements()) {
+ perspectives.add( ((IPerspectiveDescriptor)descriptor).getId() );
}
if (perspectives.equals(ViewContextService.getDefaultEnabledPerspectives())) {
getPreferenceStore().setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES,
IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT);
} else {
StringBuilder buffer= new StringBuilder();
- for (Iterator<String> itr = perspectives.iterator(); itr.hasNext();) {
- buffer.append(itr.next()).append(',');
+ for (String id : perspectives) {
+ buffer.append(id).append(',');
}
getPreferenceStore().setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, buffer.toString());
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
index 073898188..50724c0c2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
@@ -636,9 +636,9 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
public boolean areTreeModelViewerFiltersApplicable(Object parentElement) {
ViewerFilter[] filters = fViewer.getFilters();
if (filters.length > 0) {
- for (int j = 0; j < filters.length; j++) {
- if (filters[j] instanceof TreeModelViewerFilter &&
- ((TreeModelViewerFilter)filters[j]).isApplicable(fViewer, parentElement))
+ for (ViewerFilter filter : filters) {
+ if (filter instanceof TreeModelViewerFilter &&
+ ((TreeModelViewerFilter)filter).isApplicable(fViewer, parentElement))
{
return true;
}
@@ -753,8 +753,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
* @param updates the updates to notify
*/
void updatesComplete(final List<ViewerUpdateMonitor> updates) {
- for (int i = 0; i < updates.size(); i++) {
- ViewerUpdateMonitor update = updates.get(i);
+ for (ViewerUpdateMonitor update : updates) {
notifyUpdate(UPDATE_COMPLETE, update);
if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
DebugUIPlugin.trace("\tEND - " + update); //$NON-NLS-1$
@@ -977,8 +976,8 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
List<ViewerUpdateMonitor> requests = fWaitingRequests.get(path);
if (requests != null) {
- for (int i = 0; i < requests.size(); i++) {
- if (requests.get(i) instanceof ChildrenUpdate) {
+ for (ViewerUpdateMonitor request : requests) {
+ if (request instanceof ChildrenUpdate) {
return true;
}
}
@@ -986,8 +985,8 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
requests = fRequestsInProgress.get(path);
if (requests != null) {
int numChildrenUpdateRequests = 0;
- for (int i = 0; i < requests.size(); i++) {
- if (requests.get(i) instanceof ChildrenUpdate) {
+ for (ViewerUpdateMonitor request : requests) {
+ if (request instanceof ChildrenUpdate) {
if (++numChildrenUpdateRequests > 1) {
return true;
}
@@ -1203,8 +1202,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
TreePath parentPath = path.getParentPath();
List<ViewerUpdateMonitor> requests = fWaitingRequests.get(path);
if (requests != null) {
- for (int i = 0; i < requests.size(); i++) {
- ViewerUpdateMonitor update = requests.get(i);
+ for (ViewerUpdateMonitor update : requests) {
if (update instanceof ChildrenUpdate) {
return true;
}
@@ -1212,8 +1210,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
requests = fWaitingRequests.get(parentPath);
if (requests != null) {
- for (int i = 0; i < requests.size(); i++) {
- ViewerUpdateMonitor update = requests.get(i);
+ for (ViewerUpdateMonitor update : requests) {
if (update.containsUpdate(path)) {
return true;
}
@@ -1221,8 +1218,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
requests = fRequestsInProgress.get(path);
if (requests != null) {
- for (int i = 0; i < requests.size(); i++) {
- ViewerUpdateMonitor update = requests.get(i);
+ for (ViewerUpdateMonitor update : requests) {
if (update instanceof ChildrenUpdate) {
return true;
}
@@ -1230,8 +1226,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
requests = fRequestsInProgress.get(parentPath);
if (requests != null) {
- for (int i = 0; i < requests.size(); i++) {
- ViewerUpdateMonitor update = requests.get(i);
+ for (ViewerUpdateMonitor update : requests) {
if (update.getElement().equals(path.getLastSegment())) {
return true;
}
@@ -1261,8 +1256,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
* @see IModelDelta for a list of masks
*/
protected void updateNodes(IModelDelta[] nodes, int mask) {
- for (int i = 0; i < nodes.length; i++) {
- IModelDelta node = nodes[i];
+ for (IModelDelta node : nodes) {
int flags = node.getFlags() & mask;
if (flags != 0) {
if ((flags & IModelDelta.ADDED) != 0) {
@@ -1809,8 +1803,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
// necessary to check if viewer is disposed
try {
- for (int i = 0; i < jobCompletedUpdates.size(); i++) {
- ViewerUpdateMonitor completedUpdate = jobCompletedUpdates.get(i);
+ for (ViewerUpdateMonitor completedUpdate : jobCompletedUpdates) {
if (!completedUpdate.isCanceled() && !isDisposed()) {
IStatus status = completedUpdate.getStatus();
if (status == null || status.isOK()) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java
index e750002ea..d7d8c5fc9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java
@@ -1128,8 +1128,8 @@ class ViewerStateTracker {
} else {
TreePath[] currentPaths = currentSelection.getPaths();
boolean pathInSelection = false;
- for (int i = 0; i < currentPaths.length; i++) {
- if (currentPaths[i].equals(treePath)) {
+ for (TreePath currentPath : currentPaths) {
+ if (currentPath.equals(treePath)) {
pathInSelection = true;
break;
}
@@ -1152,9 +1152,7 @@ class ViewerStateTracker {
// A child delta has the reveal flag, do not set the
// top element yet.
boolean setTopItem = true;
- IModelDelta[] childDeltas = delta.getChildDeltas();
- for (int i = 0; i < childDeltas.length; i++) {
- IModelDelta childDelta = childDeltas[i];
+ for (IModelDelta childDelta : delta.getChildDeltas()) {
int modelIndex = childDelta.getIndex();
if (modelIndex >= 0 && (childDelta.getFlags() & IModelDelta.REVEAL) != 0) {
setTopItem = false;
@@ -1177,9 +1175,7 @@ class ViewerStateTracker {
if (knowsChildCount) {
int childCount = viewer.getChildCount(treePath);
if (childCount >= 0) {
- ModelDelta[] childDeltas = (ModelDelta[])delta.getChildDeltas();
- for (int i = 0; i < childDeltas.length; i++) {
- ModelDelta childDelta = childDeltas[i];
+ for (ModelDelta childDelta : (ModelDelta[])delta.getChildDeltas()) {
int modelIndex = childDelta.getIndex();
if (modelIndex >= 0 && (childDelta.getFlags() & IModelDelta.REVEAL) != 0) {
if (modelIndex < childCount) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java
index b557dc18f..d8b901e93 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java
@@ -146,8 +146,8 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
}
String[] labels = (String[]) item.getData(VirtualItem.LABEL_KEY);
if(labels != null && labels.length > 0) {
- for (int i = 0; i < labels.length; i++) {
- String text = trimLabel(labels[i]);
+ for (String label : labels) {
+ String text = trimLabel(label);
if (text != null && !text.equals(IInternalDebugCoreConstants.EMPTY_STRING)) {
buffer.append(text+TAB);
}
@@ -221,18 +221,18 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
listener.fSelectionRootDepth = Integer.MAX_VALUE;
TreeItem[] selection = getSelectedItems(clientViewer);
Set<VirtualItem> vSelection = new HashSet<>(selection.length * 4 / 3);
- for (int i = 0; i < selection.length; i++) {
- TreePath parentPath = fClientViewer.getTreePathFromItem(selection[i].getParentItem());
+ for (TreeItem element : selection) {
+ TreePath parentPath = fClientViewer.getTreePathFromItem(element.getParentItem());
listener.fSelectionRootDepth = Math.min(parentPath.getSegmentCount() + 1, listener.fSelectionRootDepth);
VirtualItem parentVItem = virtualViewer.findItem(parentPath);
if (parentVItem != null) {
int index = -1;
- TreeItem parentItem = selection[i].getParentItem();
+ TreeItem parentItem = element.getParentItem();
if (parentItem != null) {
- index = parentItem.indexOf(selection[i]);
+ index = parentItem.indexOf(element);
} else {
- Tree parentTree = selection[i].getParent();
- index = parentTree.indexOf(selection[i]);
+ Tree parentTree = element.getParent();
+ index = parentTree.indexOf(element);
}
index = ((ITreeModelContentProvider)clientViewer.getContentProvider()).viewToModelIndex(parentPath, index);
vSelection.add( parentVItem.getItem(new Index(index)) );
@@ -313,8 +313,8 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
}
VirtualItem[] children = item.getItems();
if (children != null) {
- for (int i = 0; i < children.length; i++) {
- writeItemToBuffer(children[i], itemsToCopy, buffer, indent + 1);
+ for (VirtualItem element : children) {
+ writeItemToBuffer(element, itemsToCopy, buffer, indent + 1);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualFindAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualFindAction.java
index 8913c2c6c..6c005700e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualFindAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualFindAction.java
@@ -134,8 +134,7 @@ public class VirtualFindAction extends Action implements IUpdate {
public FindLabelProvider(VirtualTreeModelViewer viewer, List<VirtualItem> items) {
fVirtualViewer = viewer;
- for (int i = 0; i < items.size(); i++) {
- VirtualItem item = items.get(i);
+ for (VirtualItem item : items) {
fTextCache.put(item, fVirtualViewer.getText(item, 0));
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java
index 3395b071e..88ddb27fe 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java
@@ -41,8 +41,7 @@ public class VirtualTree extends VirtualItem {
@Override
public boolean isItemVisible(VirtualItem item) {
// visible items. For now only mark the selected items as visible.
- for (int i = 0; i < fSelection.length; i++) {
- VirtualItem selectionItem = fSelection[i];
+ for (VirtualItem selectionItem : fSelection) {
while (selectionItem != null) {
if (item.equals(selectionItem)) {
return true;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
index 23cbced2d..691b976f1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
@@ -256,14 +256,13 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
*/
private void doActivation(IWorkbenchPage page, IPerspectiveDescriptor perspective, Set<String> allViewIds, String[] contextIds) {
// note activation of all the relevant contexts
- for (int i = 0; i < contextIds.length; i++) {
- addActivated(contextIds[i]);
+ for (String contextId : contextIds) {
+ addActivated(contextId);
}
// set the active context to be this
setActive(perspective, getId());
// activate the view bindings and bring most relevant views to top
- for (int i = 0; i < fAllViewBindingIds.length; i++) {
- String viewId = fAllViewBindingIds[i];
+ for (String viewId : fAllViewBindingIds) {
ViewBinding binding = fAllViewIdToBindings.get(viewId);
binding.activated(page, perspective);
binding.checkZOrder(page, allViewIds);
@@ -288,8 +287,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
for (DebugContextViewBindings bindings : contexts) {
fAllConetxtIds[pos] = bindings.getId();
pos++;
- for (int i = 0; i < bindings.fViewBindingIds.length; i++) {
- String viewId = bindings.fViewBindingIds[i];
+ for (String viewId : bindings.fViewBindingIds) {
if (bindings == this) {
orderedIds.add(viewId);
}
@@ -314,8 +312,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
if (isActiveContext(getId())) {
setActive(page.getPerspective(), null);
}
- for (int i = 0; i < fViewBindingIds.length; i++) {
- String viewId = fViewBindingIds[i];
+ for (String viewId : fViewBindingIds) {
ViewBinding binding = fAllViewIdToBindings.get(viewId);
binding.deactivated(page, perspective);
}
@@ -355,8 +352,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
* @param alreadyDone views already done
*/
public void saveBindings(Document document, Element root, Set<String> alreadyDone) {
- for (int i = 0; i < fViewBindingIds.length; i++) {
- String viewId = fViewBindingIds[i];
+ for (String viewId : fViewBindingIds) {
if (!alreadyDone.contains(viewId)) {
alreadyDone.add(viewId);
ViewBinding binding = fAllViewIdToBindings.get(viewId);
@@ -581,9 +577,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
}
private void appendPerspectives(Document document, Element parent, Set<String> perpectives, String xmlValue) {
- String[] ids = perpectives.toArray(new String[perpectives.size()]);
- for (int i = 0; i < ids.length; i++) {
- String id = ids[i];
+ for (String id : perpectives.toArray(new String[perpectives.size()])) {
Element element = document.createElement(XML_ELEMENT_PERSPECTIVE);
element.setAttribute(XML_ATTR_ID, id);
element.setAttribute(XML_ATTR_USER_ACTION, xmlValue);
@@ -664,9 +658,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
private void loadContextToViewExtensions() {
fContextIdsToBindings = new HashMap<>();
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), ID_CONTEXT_VIEW_BINDINGS);
- IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- IConfigurationElement element = configurationElements[i];
+ for (IConfigurationElement element : extensionPoint.getConfigurationElements()) {
if ( ELEM_CONTEXT_VIEW_BINDING.equals(element.getName()) ) {
String viewId = element.getAttribute(ATTR_VIEW_ID);
String contextId = element.getAttribute(ATTR_CONTEXT_ID);
@@ -780,9 +772,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
public static Set<String> getDefaultEnabledPerspectives() {
Set<String> perspectives = new HashSet<>(4);
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), ID_CONTEXT_VIEW_BINDINGS);
- IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- IConfigurationElement element = configurationElements[i];
+ for (IConfigurationElement element : extensionPoint.getConfigurationElements()) {
if ( ELEM_PERSPECTIVE.equals(element.getName()) ) {
String perspectiveId = element.getAttribute(ATTR_PERSPECTIVE_ID);
if (perspectiveId != null) {
@@ -816,8 +806,8 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
if (!workbenchContexts.isEmpty()) {
// Quickly check if any contexts need activating
boolean needToActivate = false;
- for (int i = 0; i < workbenchContexts.size(); i++) {
- if (!isActivated(workbenchContexts.get(i))) {
+ for (String workbenchContext : workbenchContexts) {
+ if (!isActivated(workbenchContext)) {
needToActivate = true;
break;
}
@@ -827,8 +817,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
Set<String> allViewIds = getAllContextsViewIDs(workbenchContexts);
// if all contexts already activate and last context is already active context == done
- for (int i = 0; i < workbenchContexts.size(); i++) {
- String contextId = workbenchContexts.get(i);
+ for (String contextId : workbenchContexts) {
if (!isActivated(contextId)) {
activateChain(contextId, getActivePerspective(), allViewIds);
}
@@ -993,17 +982,16 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
}
}
- private Set<String> getAllContextsViewIDs(List<String> contextsIds) {
+ private Set<String> getAllContextsViewIDs(List<String> contextIds) {
if (fWindow == null) {
return Collections.EMPTY_SET; // disposed
}
TreeSet<String> viewIds = new TreeSet<>();
- for (int i = 0; i < contextsIds.size(); i++) {
- DebugContextViewBindings bindings= fContextIdsToBindings.get(contextsIds.get(i));
+ for (String contextId : contextIds) {
+ DebugContextViewBindings bindings= fContextIdsToBindings.get(contextId);
if (bindings != null) {
- String[] bindingViewIds = bindings.getAllViewBindingsIds();
- Collections.addAll(viewIds, bindingViewIds);
+ Collections.addAll(viewIds, bindings.getAllViewBindingsIds());
}
}
return viewIds;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java
index 2dec7323c..c095aa0ee 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java
@@ -56,15 +56,13 @@ public class WorkingSetBreakpointOrganizer extends AbstractBreakpointOrganizerDe
parents.add(res);
}
}
- IWorkingSet[] workingSets = fWorkingSetManager.getWorkingSets();
- for (int i = 0; i < workingSets.length; i++) {
- if (!IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(workingSets[i].getId())) {
- IAdaptable[] elements = workingSets[i].getElements();
- for (int j = 0; j < elements.length; j++) {
- IResource resource = elements[j].getAdapter(IResource.class);
+ for (IWorkingSet workingSet : fWorkingSetManager.getWorkingSets()) {
+ if (!IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(workingSet.getId())) {
+ for (IAdaptable element : workingSet.getElements()) {
+ IResource resource = element.getAdapter(IResource.class);
if (resource != null) {
if (parents.contains(resource)) {
- result.add(new WorkingSetCategory(workingSets[i]));
+ result.add(new WorkingSetCategory(workingSet));
break;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneSelectionProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneSelectionProvider.java
index 691a0714c..158e5102c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneSelectionProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneSelectionProvider.java
@@ -60,8 +60,8 @@ public class ViewPaneSelectionProvider implements ISelectionProvider {
public void fireChanged() {
SelectionChangedEvent evt = new SelectionChangedEvent(this, getSelection());
- for (int i = 0; i < fListeners.size(); i++) {
- fListeners.get(i).selectionChanged(evt);
+ for (ISelectionChangedListener listener : fListeners) {
+ listener.selectionChanged(evt);
}
}
}

Back to the top