Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java138
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java53
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java7
12 files changed, 142 insertions, 179 deletions
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java
index d16b697cf..aed44a3a8 100644
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java
@@ -127,10 +127,9 @@ public class BuilderCoreUtils {
newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, false);
newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, false);
String buildKinds = config.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) null);
- int[] triggers = buildTypesToArray(buildKinds);
boolean isfull = false, isinc = false;
- for (int i = 0; i < triggers.length; i++) {
- switch (triggers[i]) {
+ for (int trigger : buildTypesToArray(buildKinds)) {
+ switch (trigger) {
case IncrementalProjectBuilder.FULL_BUILD:
newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, true);
isfull = true;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
index 62700cfdf..cb9eae835 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
@@ -231,13 +231,13 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
private void registerOrganizersListener(IBreakpointOrganizer[] oldOrganizers, IBreakpointOrganizer[] newOrganizers) {
if (oldOrganizers != null) {
- for (int i = 0; i < oldOrganizers.length; i++) {
- oldOrganizers[i].removePropertyChangeListener(fOrganizersListener);
+ for (IBreakpointOrganizer oldOrganizer : oldOrganizers) {
+ oldOrganizer.removePropertyChangeListener(fOrganizersListener);
}
}
if (newOrganizers != null) {
- for (int i = 0; i < newOrganizers.length; i++) {
- newOrganizers[i].addPropertyChangeListener(fOrganizersListener);
+ for (IBreakpointOrganizer newOrganizer : newOrganizers) {
+ newOrganizer.addPropertyChangeListener(fOrganizersListener);
}
}
}
@@ -434,9 +434,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
DebugUIPlugin.trace("POST BREAKPOINT DELTA (trackSelection)\n"); //$NON-NLS-1$
}
- BreakpointManagerProxy[] proxies = getProxies();
- for (int i = 0; i < proxies.length; i++) {
- proxies[i].postModelChanged(delta, true);
+ for (BreakpointManagerProxy proxy : getProxies()) {
+ proxy.postModelChanged(delta, true);
}
}
}
@@ -460,9 +459,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
if (children[i] instanceof BreakpointContainer) {
BreakpointContainer childContainer = (BreakpointContainer)children[i];
boolean containsBP = false;
- IBreakpoint[] containerBPs = childContainer.getBreakpoints();
- for (int j = 0; j < containerBPs.length; j++) {
- if (breakpoints.contains(containerBPs[j])) {
+ for (IBreakpoint containerBP : childContainer.getBreakpoints()) {
+ if (breakpoints.contains(containerBP)) {
containsBP = true;
break;
}
@@ -492,14 +490,14 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
if (filteredBreakpoints.length > 0) {
synchronized (this) {
ModelDelta delta = new ModelDelta(fInput, 0, IModelDelta.NO_CHANGE, -1);
- for (int i = 0; i < filteredBreakpoints.length; ++i) {
+ for (IBreakpoint filteredBreakpoint : filteredBreakpoints) {
// Avoid adding breakpoints which were already removed. If breakpoints
// are added and removed very fast, the Breakpoint manager can issue
// breakpoint added events after breakpoint removed events! This means
// that such breakpoints would never be removed from the view.
// (Bug 289526)
- if (DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(filteredBreakpoints[i].getMarker()) != null) {
- fContainer.addBreakpoint(filteredBreakpoints[i], delta);
+ if (DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(filteredBreakpoint.getMarker()) != null) {
+ fContainer.addBreakpoint(filteredBreakpoint, delta);
}
}
delta.setChildCount(fContainer.getChildren().length);
@@ -526,8 +524,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
synchronized (this) {
boolean removed = false;
ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- for (int i = 0; i < breakpoints.length; ++i) {
- removed = fContainer.removeBreakpoint(breakpoints[i], delta) || removed;
+ for (IBreakpoint breakpoint : breakpoints) {
+ removed = fContainer.removeBreakpoint(breakpoint, delta) || removed;
}
if (removed) {
@@ -552,8 +550,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
List<IBreakpoint> removed = new ArrayList<>();
List<IBreakpoint> added = new ArrayList<>();
List<IBreakpoint> filteredAsList = Arrays.asList(filteredBreakpoints);
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint bp = breakpoints[i];
+ for (IBreakpoint bp : breakpoints) {
boolean oldContainedBp = fContainer.contains(bp);
boolean newContained = filteredAsList.contains(bp);
if (oldContainedBp && !newContained) {
@@ -568,9 +565,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
if (!removed.isEmpty()) {
breakpointsRemoved(removed.toArray(new IBreakpoint[removed.size()]));
}
- for (int i = 0; i < filteredBreakpoints.length; ++i)
- {
- appendModelDelta(fContainer, delta, IModelDelta.STATE | IModelDelta.CONTENT, filteredBreakpoints[i]); // content flag triggers detail refresh
+ for (IBreakpoint filteredBreakpoint : filteredBreakpoints) {
+ appendModelDelta(fContainer, delta, IModelDelta.STATE | IModelDelta.CONTENT, filteredBreakpoint); // content flag triggers detail refresh
}
if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
@@ -615,22 +611,20 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
IBreakpoint newBreakpoint = null;
Object[] children = container.getChildren();
- Object[] refChildren = refContainer.getChildren();
-
-
- for (int i = 0; i < refChildren.length; ++i) {
- Object element = getElement(children, refChildren[i]);
+
+ for (Object refChildElement : refContainer.getChildren()) {
+ Object element = getElement(children, refChildElement);
// if a child of refContainer doesn't exist in container, than insert it to container
// - if the reference child is a container, than copy the reference child container to container
// - otherwise (Breakpoint), add the breakpoint to container
if (element == null) {
- if (refChildren[i] instanceof BreakpointContainer) {
- BreakpointContainer.addChildContainer(container, (BreakpointContainer) refChildren[i], containerDelta);
- } else if(refChildren[i] instanceof IBreakpoint) {
- BreakpointContainer.addBreakpoint(container, (IBreakpoint) refChildren[i], containerDelta);
+ if (refChildElement instanceof BreakpointContainer) {
+ BreakpointContainer.addChildContainer(container, (BreakpointContainer) refChildElement, containerDelta);
+ } else if(refChildElement instanceof IBreakpoint) {
+ BreakpointContainer.addBreakpoint(container, (IBreakpoint) refChildElement, containerDelta);
if (newBreakpoint == null) {
- newBreakpoint = (IBreakpoint) refChildren[i];
+ newBreakpoint = (IBreakpoint) refChildElement;
}
}
@@ -638,8 +632,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
// of container to the one in the refContainer's child.
} else if (element instanceof BreakpointContainer) {
ModelDelta childDelta = containerDelta.addNode(element, container.getChildIndex(element), IModelDelta.INSTALL, -1);
- BreakpointContainer.copyOrganizers((BreakpointContainer) element, (BreakpointContainer) refChildren[i]);
- newBreakpoint = insertAddedElements((BreakpointContainer) element, (BreakpointContainer) refChildren[i], childDelta);
+ BreakpointContainer.copyOrganizers((BreakpointContainer) element, (BreakpointContainer) refChildElement);
+ newBreakpoint = insertAddedElements((BreakpointContainer) element, (BreakpointContainer) refChildElement, childDelta);
childDelta.setChildCount(((BreakpointContainer) element).getChildren().length);
}
}
@@ -657,38 +651,36 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
* @param containerDelta the delta of the existing container.
*/
private void deleteRemovedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) {
- Object[] children = container.getChildren();
Object[] refChildren = refContainer.getChildren();
// if a child of container doesn't exist in refContainer, than remove it from container
- for (int i = 0; i < children.length; ++i) {
- Object element = getElement(refChildren, children[i]);
+ for (Object childElement : container.getChildren()) {
+ Object element = getElement(refChildren, childElement);
if (element == null) {
- if (children[i] instanceof BreakpointContainer) {
- BreakpointContainer.removeAll((BreakpointContainer) children[i], containerDelta);
+ if (childElement instanceof BreakpointContainer) {
+ BreakpointContainer.removeAll((BreakpointContainer) childElement, containerDelta);
} else {
- BreakpointContainer.removeBreakpoint(container, (IBreakpoint) children[i], containerDelta);
+ BreakpointContainer.removeBreakpoint(container, (IBreakpoint) childElement, containerDelta);
}
} else if (element instanceof BreakpointContainer){
- ModelDelta childDelta = containerDelta.addNode(children[i], IModelDelta.STATE);
- deleteRemovedElements((BreakpointContainer) children[i], (BreakpointContainer) element, childDelta);
+ ModelDelta childDelta = containerDelta.addNode(childElement, IModelDelta.STATE);
+ deleteRemovedElements((BreakpointContainer) childElement, (BreakpointContainer) element, childDelta);
}
}
}
private void deleteAllElements(BreakpointContainer container, ModelDelta containerDelta) {
- Object[] children = container.getChildren();
// Object[] refChildren = refContainer.getChildren();
// if a child of container doesn't exist in refContainer, than
// remove it from container
- for (int i = 0; i < children.length; ++i) {
- if (children[i] instanceof BreakpointContainer) {
- BreakpointContainer.removeAll((BreakpointContainer) children[i], containerDelta);
+ for (Object childElement : container.getChildren()) {
+ if (childElement instanceof BreakpointContainer) {
+ BreakpointContainer.removeAll((BreakpointContainer) childElement, containerDelta);
} else {
- BreakpointContainer.removeBreakpoint(container, (IBreakpoint) children[i], containerDelta);
+ BreakpointContainer.removeBreakpoint(container, (IBreakpoint) childElement, containerDelta);
}
}
}
@@ -703,14 +695,14 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
* @see #deleteRemovedElements
*/
private Object getElement(Object[] collection, Object element) {
- for (int i = 0; i < collection.length; ++i) {
- if (collection[i] instanceof BreakpointContainer && element instanceof BreakpointContainer) {
- if (collection[i].equals(element)) {
- return collection[i];
+ for (Object element2 : collection) {
+ if (element2 instanceof BreakpointContainer && element instanceof BreakpointContainer) {
+ if (element2.equals(element)) {
+ return element2;
}
} else {
- if (collection[i].equals(element)) {
- return collection[i];
+ if (element2.equals(element)) {
+ return element2;
}
}
}
@@ -734,8 +726,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
BreakpointContainer container = new BreakpointContainer(organizers, fComparator);
container.initDefaultContainers(rootDelta);
- for (int i = 0; i < breakpoints.length; ++i) {
- container.addBreakpoint(breakpoints[i], rootDelta);
+ for (IBreakpoint breakpoint : breakpoints) {
+ container.addBreakpoint(breakpoint, rootDelta);
}
return container;
@@ -819,9 +811,9 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
List<IDebugTarget> targets = getDebugTargets(selectionFilter);
ArrayList<IBreakpoint> retVal = new ArrayList<>();
if (targets != null) {
- for (int i = 0; i < breakpoints.length; ++i) {
- if (supportsBreakpoint(targets, breakpoints[i])) {
- retVal.add(breakpoints[i]);
+ for (IBreakpoint breakpoint : breakpoints) {
+ if (supportsBreakpoint(targets, breakpoint)) {
+ retVal.add(breakpoint);
}
}
}
@@ -926,8 +918,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
}
// Dispose the removed input data
- for (int i = 0; i < removed.size(); i++) {
- removed.get(i).dispose();
+ for (InputData inputData : removed) {
+ inputData.dispose();
}
}
@@ -1048,9 +1040,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
@Override
protected IStatus run(IProgressMonitor monitor) {
- InputData[] datas = fInputToData.values().toArray(new InputData[0]);
- for (int i = 0; i < datas.length; i++) {
- datas[i].breakpointsAdded(breakpoints);
+ for (InputData data : fInputToData.values()) {
+ data.breakpointsAdded(breakpoints);
}
return Status.OK_STATUS;
}
@@ -1067,9 +1058,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
@Override
protected IStatus run(IProgressMonitor monitor) {
- InputData[] datas = fInputToData.values().toArray(new InputData[0]);
- for (int i = 0; i < datas.length; i++) {
- datas[i].breakpointsRemoved(breakpoints);
+ for (InputData data : fInputToData.values()) {
+ data.breakpointsRemoved(breakpoints);
}
return Status.OK_STATUS;
}
@@ -1086,9 +1076,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
@Override
protected IStatus run(IProgressMonitor monitor) {
- InputData[] datas = fInputToData.values().toArray(new InputData[0]);
- for (int i = 0; i < datas.length; i++) {
- datas[i].breakpointsChanged(breakpoints);
+ for (InputData data : fInputToData.values()) {
+ data.breakpointsChanged(breakpoints);
}
return Status.OK_STATUS;
}
@@ -1107,9 +1096,9 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
if (parent.contains(breakpoint)) {
if ((containers.length != 0)) {
- for (int i = 0; i < containers.length; ++i) {
- ModelDelta nodeDelta = parentDelta.addNode(containers[i], IModelDelta.STATE);
- appendModelDelta(containers[i], nodeDelta, flags, breakpoint);
+ for (BreakpointContainer container : containers) {
+ ModelDelta nodeDelta = parentDelta.addNode(container, IModelDelta.STATE);
+ appendModelDelta(container, nodeDelta, flags, breakpoint);
}
} else {
parentDelta.addNode(breakpoint, flags);
@@ -1130,14 +1119,13 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
return;
}
- IModelDelta[] childDeltas = parentDelta.getChildDeltas();
- for (int i = 0; i < childDeltas.length; ++i) {
- if (element.equals(childDeltas[i].getElement())) {
- ((ModelDelta) childDeltas[i]).setFlags(childDeltas[i].getFlags() | flags);
+ for (IModelDelta childDelta : parentDelta.getChildDeltas()) {
+ if (element.equals(childDelta.getElement())) {
+ ((ModelDelta) childDelta).setFlags(childDelta.getFlags() | flags);
return;
}
- appendModelDeltaToElement(childDeltas[i], element, flags);
+ appendModelDeltaToElement(childDelta, element, flags);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java
index c0687f085..a28ac491b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java
@@ -15,7 +15,6 @@ package org.eclipse.debug.internal.ui.viewers;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.debug.internal.ui.viewers.provisional.IChildrenRequestMonitor;
@@ -79,8 +78,7 @@ class ChildrenRequestMonitor extends AsynchronousRequestMonitor implements IChil
getModel().setChildren(getNode(), fChildren);
fFirstUpdate = false;
} else {
- for (Iterator<Object> iter = fChildren.iterator(); iter.hasNext();) {
- Object child = iter.next();
+ for (Object child : fChildren) {
getModel().add(getNode(), child);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java
index b77fcc474..00cbf0dbf 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java
@@ -195,8 +195,8 @@ class ChildrenCountUpdate extends ViewerUpdateMonitor implements IChildrenCountU
if (getElementPath().equals(path)) {
return true;
} else if (fBatchedRequests != null) {
- for (int i = 0; i < fBatchedRequests.size(); i++) {
- if (fBatchedRequests.get(i).getElementPath().equals(path)) {
+ for (ViewerUpdateMonitor request : fBatchedRequests) {
+ if (request.getElementPath().equals(path)) {
return true;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java
index ffb00b1b4..e7f83d626 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java
@@ -168,8 +168,8 @@ public class BreakpointManagerProxy extends AbstractModelProxy {
fPendingDeltas.clear();
fFireModelChangedJob = null;
}
- for (int i = 0; i < deltas.length; i++) {
- fireModelChanged( ((DeltaInfo)deltas[i]).fDelta );
+ for (Object pendingDelta : deltas) {
+ fireModelChanged( ((DeltaInfo)pendingDelta).fDelta );
}
return Status.OK_STATUS;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java
index 49e1ef05f..2721701cc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java
@@ -92,9 +92,7 @@ public class BreakpointOrganizerManager {
*/
private void loadOrganizers() {
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS);
- IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- IConfigurationElement element= configurationElements[i];
+ for (IConfigurationElement element : extensionPoint.getConfigurationElements()) {
IBreakpointOrganizer organizer = new BreakpointOrganizerExtension(element);
if (validateOrganizer(organizer)) {
fOrganizers.put(organizer.getIdentifier(), organizer);
@@ -149,9 +147,7 @@ public class BreakpointOrganizerManager {
* Shuts down the organizer manager, disposing organizers.
*/
public void shutdown() {
- IBreakpointOrganizer[] organizers = getOrganizers();
- for (int i = 0; i < organizers.length; i++) {
- IBreakpointOrganizer organizer = organizers[i];
+ for (IBreakpointOrganizer organizer : getOrganizers()) {
organizer.dispose();
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java
index f35696e10..085f82abc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java
@@ -33,8 +33,8 @@ public class BreakpointWorkingSetElementAdapter implements IWorkingSetElementAda
@Override
public IAdaptable[] adaptElements(IWorkingSet ws, IAdaptable[] elements) {
- for (int i = 0; i < elements.length; i++) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(elements[i], IBreakpoint.class);
+ for (IAdaptable element : elements) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(element, IBreakpoint.class);
if (breakpoint != null) {
return selectBreakpoints(elements);
}
@@ -44,8 +44,8 @@ public class BreakpointWorkingSetElementAdapter implements IWorkingSetElementAda
private IAdaptable[] selectBreakpoints(IAdaptable[] elements) {
List<IBreakpoint> breakpoints = new ArrayList<>(elements.length);
- for (int i = 0; i < elements.length; i++) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(elements[i], IBreakpoint.class);
+ for (IAdaptable element : elements) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(element, IBreakpoint.class);
if (breakpoint != null) {
breakpoints.add(breakpoint);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java
index 47c2e2716..d3cc755cf 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java
@@ -168,11 +168,10 @@ public class BreakpointWorkingSetPage extends WizardPage implements IWorkingSetP
@Override
public void finish() {
String workingSetName = fWorkingSetName.getText();
- Object[] adaptable = fTViewer.getCheckedElements().toArray();
ArrayList<IBreakpoint> elements = new ArrayList<>();
//weed out non-breakpoint elements since 3.2
- for(int i = 0; i < adaptable.length; i++) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(adaptable[i], IBreakpoint.class);
+ for (Object adaptableElement : fTViewer.getCheckedElements()) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(adaptableElement, IBreakpoint.class);
if(breakpoint != null) {
elements.add(breakpoint);
}//end if
@@ -206,9 +205,8 @@ public class BreakpointWorkingSetPage extends WizardPage implements IWorkingSetP
}
fFirstCheck= false;
if (errorMessage == null && (fWorkingSet == null || newText.equals(fWorkingSet.getName()) == false)) {
- IWorkingSet[] workingSets= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
- for (int i= 0; i < workingSets.length; i++) {
- if (newText.equals(workingSets[i].getName())) {
+ for (IWorkingSet workingSet : PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets()) {
+ if (newText.equals(workingSet.getName())) {
errorMessage= DebugUIViewsMessages.BreakpointWorkingSetPage_6;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java
index 7672e1aed..b5fe15275 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java
@@ -90,8 +90,8 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
public void setOrganizers(IBreakpointOrganizer[] organizers) {
// remove previous listeners
if (fOrganizers != null) {
- for (int i = 0; i < fOrganizers.length; i++) {
- fOrganizers[i].removePropertyChangeListener(this);
+ for (IBreakpointOrganizer organizer : fOrganizers) {
+ organizer.removePropertyChangeListener(this);
}
}
fOrganizers = organizers;
@@ -100,8 +100,8 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
}
// add listeners
if (fOrganizers != null) {
- for (int i = 0; i < fOrganizers.length; i++) {
- fOrganizers[i].addPropertyChangeListener(this);
+ for (IBreakpointOrganizer organizer : fOrganizers) {
+ organizer.addPropertyChangeListener(this);
}
}
if (!fDisposed) {
@@ -114,10 +114,10 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
reorganize();
if (isShowingGroups() && breakpoints != null) {
// restore expansion
- for (int i = 0; i < fElements.length; i++) {
- BreakpointContainer container = (BreakpointContainer) fElements[i];
- for (int j = 0; j < breakpoints.length; j++) {
- if (container.contains(breakpoints[j])) {
+ for (Object element : fElements) {
+ BreakpointContainer container = (BreakpointContainer) element;
+ for (IBreakpoint breakpoint : breakpoints) {
+ if (container.contains(breakpoint)) {
fViewer.expandToLevel(container, AbstractTreeViewer.ALL_LEVELS);
fViewer.updateCheckedState(container);
break;
@@ -140,8 +140,8 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
public BreakpointContainer[] getRoots(IBreakpoint breakpoint) {
if (isShowingGroups()) {
List<BreakpointContainer> list = new ArrayList<>();
- for (int i = 0; i < fElements.length; i++) {
- BreakpointContainer container = (BreakpointContainer) fElements[i];
+ for (Object element : fElements) {
+ BreakpointContainer container = (BreakpointContainer) element;
if (container.contains(breakpoint)) {
list.add(container);
}
@@ -172,14 +172,12 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
} else {
IBreakpointOrganizer organizer = fOrganizers[0];
Map<IAdaptable, BreakpointContainer> categoriesToContainers = new HashMap<>();
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
+ for (IBreakpoint breakpoint : breakpoints) {
IAdaptable[] categories = organizer.getCategories(breakpoint);
if (categories == null || categories.length == 0) {
categories = OtherBreakpointCategory.getCategories(organizer);
}
- for (int j = 0; j < categories.length; j++) {
- IAdaptable category = categories[j];
+ for (IAdaptable category : categories) {
BreakpointContainer container = categoriesToContainers.get(category);
if (container == null) {
IBreakpointOrganizer[] nesting = null;
@@ -196,12 +194,11 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
// add empty categories
IAdaptable[] emptyCategories = organizer.getCategories();
if (emptyCategories != null) {
- for (int i = 0; i < emptyCategories.length; i++) {
- IAdaptable category = emptyCategories[i];
- BreakpointContainer container = categoriesToContainers.get(category);
+ for (IAdaptable emptyCategory : emptyCategories) {
+ BreakpointContainer container = categoriesToContainers.get(emptyCategory);
if (container == null) {
- container = new BreakpointContainer(category, organizer, null);
- categoriesToContainers.put(category, container);
+ container = new BreakpointContainer(emptyCategory, organizer, null);
+ categoriesToContainers.put(emptyCategory, container);
}
}
}
@@ -234,10 +231,9 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
}
BreakpointContainer[] containers = new BreakpointContainer[categories.length];
int index = 0;
- for (int i = 0; i < fElements.length; i++) {
- BreakpointContainer container = (BreakpointContainer)fElements[i];
- for (int j = 0; j < categories.length; j++) {
- IAdaptable category = categories[j];
+ for (Object element : fElements) {
+ BreakpointContainer container = (BreakpointContainer)element;
+ for (IAdaptable category : categories) {
if (container.getCategory().equals(category)) {
containers[index] = container;
index++;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
index fa3719e8e..31ed62c81 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
@@ -351,19 +351,18 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
} else {
String value = node.getString(KEY_VALUE);
if (value != null) {
- String[] ids = value.split(","); //$NON-NLS-1$
BreakpointOrganizerManager manager = BreakpointOrganizerManager.getDefault();
- List<IBreakpointOrganizer> organziers = new ArrayList<>();
- for (int i = 0; i < ids.length; i++) {
- IBreakpointOrganizer organizer = manager.getOrganizer(ids[i]);
+ List<IBreakpointOrganizer> organizers = new ArrayList<>();
+ for (String id : value.split(",")) { //$NON-NLS-1$
+ IBreakpointOrganizer organizer = manager.getOrganizer(id);
if (organizer != null) {
- organziers.add(organizer);
+ organizers.add(organizer);
}
}
- fOrganizers = organziers.toArray(new IBreakpointOrganizer[organziers.size()]);
+ fOrganizers = organizers.toArray(new IBreakpointOrganizer[organizers.size()]);
- for (int i = 0; i < fOrganizers.length; i++) {
- fOrganizers[i].addPropertyChangeListener(this);
+ for (IBreakpointOrganizer organizer : fOrganizers) {
+ organizer.addPropertyChangeListener(this);
}
}
}
@@ -567,9 +566,8 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
public boolean performPaste(Object target, ISelection selection) {
if (target instanceof IBreakpointContainer && selection instanceof IStructuredSelection) {
IBreakpointContainer container = (IBreakpointContainer) target;
- Object[] objects = ((IStructuredSelection)selection).toArray();
- for (int i = 0; i < objects.length; i++) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(objects[i], IBreakpoint.class);
+ for (Object object : (IStructuredSelection) selection) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(object, IBreakpoint.class);
if (breakpoint != null) {
container.getOrganizer().addBreakpoint(breakpoint, container.getCategory());
}
@@ -680,8 +678,8 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
if (items.length == 0) {
return false;
}
- for (int i = 0; i < items.length; i++) {
- if (getRemovableContainer(items[i]) == null) {
+ for (TreePath item : items) {
+ if (getRemovableContainer(item) == null) {
return false;
}
}
@@ -698,10 +696,10 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
return;
}
Map<IBreakpointContainer, List<IBreakpoint>> containersToBreakpoints = new HashMap<>();
- for (int i = 0; i < paths.length; i++) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(paths[i].getLastSegment(), IBreakpoint.class);
+ for (TreePath path : paths) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(path.getLastSegment(), IBreakpoint.class);
if (breakpoint != null) {
- IBreakpointContainer container = getRemovableContainer(paths[i]);
+ IBreakpointContainer container = getRemovableContainer(path);
if(container != null) {
List<IBreakpoint> list = containersToBreakpoints.get(container);
if (list == null) {
@@ -721,8 +719,8 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
extension.removeBreakpoints(breakpoints, container.getCategory());
} else {
- for (int i = 0; i < breakpoints.length; i++) {
- organizer.removeBreakpoint(breakpoints[i], container.getCategory());
+ for (IBreakpoint breakpoint : breakpoints) {
+ organizer.removeBreakpoint(breakpoint, container.getCategory());
}
}
}
@@ -758,8 +756,8 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
breakpoints.toArray(new IBreakpoint[breakpoints.size()]),
container.getCategory());
} else {
- for (int i = 0; i < breakpoints.size(); i++) {
- organizer.addBreakpoint(breakpoints.get(i), container.getCategory());
+ for (IBreakpoint breakpoint : breakpoints) {
+ organizer.addBreakpoint(breakpoint, container.getCategory());
}
}
// TODO expandToLevel(target.getData(), ALL_LEVELS);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
index 437bfd1dd..bf2e968df 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
@@ -87,10 +87,9 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
*/
public IBreakpoint[] getVisibleBreakpoints() {
IBreakpointManager manager= DebugPlugin.getDefault().getBreakpointManager();
- Object[] elements= ((ITreeContentProvider)getContentProvider()).getElements(manager);
List<IBreakpoint> list = new ArrayList<>();
- for (int i = 0; i < elements.length; i++) {
- TreeItem item = (TreeItem) searchItem(elements[i]);
+ for (Object element : ((ITreeContentProvider)getContentProvider()).getElements(manager)) {
+ TreeItem item = (TreeItem) searchItem(element);
if (item != null) {
collectExpandedBreakpoints(item, list);
}
@@ -112,9 +111,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
return;
}
if (item.getExpanded()) {
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- collectExpandedBreakpoints(items[i], list);
+ for (TreeItem childItem : item.getItems()) {
+ collectExpandedBreakpoints(childItem, list);
}
}
}
@@ -199,8 +197,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
if(items.length == 0) {
return false;
}
- for(int i = 0; i < items.length; i++) {
- if(getRemovableContainer(items[i]) == null) {
+ for (Item item : items) {
+ if(getRemovableContainer(item) == null) {
return false;
}
}
@@ -219,10 +217,10 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
Map<IBreakpointContainer, List<IBreakpoint>> containersToBreakpoints = new HashMap<>();
IBreakpointContainer container = null;
IBreakpoint breakpoint = null;
- for(int i = 0; i < items.length; i++) {
- if(!items[i].isDisposed()) {
- breakpoint = (IBreakpoint)items[i].getData();
- container = getRemovableContainer(items[i]);
+ for (Item item : items) {
+ if(!item.isDisposed()) {
+ breakpoint = (IBreakpoint)item.getData();
+ container = getRemovableContainer(item);
if(container != null) {
List<IBreakpoint> list = containersToBreakpoints.get(container);
if (list == null) {
@@ -242,8 +240,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
extension.removeBreakpoints(breakpoints, container.getCategory());
} else {
- for (int i = 0; i < breakpoints.length; i++) {
- organizer.removeBreakpoint(breakpoints[i], container.getCategory());
+ for (IBreakpoint bp : breakpoints) {
+ organizer.removeBreakpoint(bp, container.getCategory());
}
}
}
@@ -348,9 +346,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
* Sets the initial checked state of the items in the viewer.
*/
private void initializeCheckedState() {
- TreeItem[] items = getTree().getItems();
- for (int i = 0; i < items.length; i++) {
- updateCheckedState(items[i]);
+ for (TreeItem item : getTree().getItems()) {
+ updateCheckedState(item);
}
}
@@ -360,9 +357,7 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
* @param element the element to update
*/
public void updateCheckedState(Object element) {
- Widget[] widgets = searchItems(element);
- for (int i = 0; i < widgets.length; i++) {
- Widget widget = widgets[i];
+ for (Widget widget : searchItems(element)) {
if (widget != null) {
updateCheckedState((TreeItem)widget);
}
@@ -376,9 +371,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
*/
private Widget[] searchItems(Object element) {
ArrayList<TreeItem> list = new ArrayList<>();
- TreeItem[] items = getTree().getItems();
- for (int i = 0; i < items.length; i++) {
- findAllOccurrences(items[i], element, list);
+ for (TreeItem item : getTree().getItems()) {
+ findAllOccurrences(item, element, list);
}
return list.toArray(new Widget[0]);
}
@@ -393,9 +387,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
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);
}
}
@@ -416,8 +409,7 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
} else if (element instanceof IBreakpointContainer) {
IBreakpoint[] breakpoints = ((IBreakpointContainer) element).getBreakpoints();
int enabledChildren= 0;
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
+ for (IBreakpoint breakpoint : breakpoints) {
try {
if (breakpoint.isEnabled()) {
enabledChildren++;
@@ -440,9 +432,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
item.setChecked(true);
}
// Update any children (breakpoints and containers)
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- updateCheckedState(items[i]);
+ for (TreeItem childItem : item.getItems()) {
+ updateCheckedState(childItem);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java
index e9961aab6..57a3276f5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java
@@ -51,10 +51,9 @@ public class ConsoleLineNotifier implements IPatternMatchListener, IPropertyChan
if (console instanceof ProcessConsole) {
fConsole = (ProcessConsole)console;
- IConsoleLineTracker[] lineTrackers = DebugUIPlugin.getDefault().getProcessConsoleManager().getLineTrackers(fConsole.getProcess());
- for (int i = 0; i < lineTrackers.length; i++) {
- lineTrackers[i].init(fConsole);
- addConsoleListener(lineTrackers[i]);
+ for (IConsoleLineTracker lineTracker : DebugUIPlugin.getDefault().getProcessConsoleManager().getLineTrackers(fConsole.getProcess())) {
+ lineTracker.init(fConsole);
+ addConsoleListener(lineTracker);
}
fConsole.addPropertyChangeListener(this);

Back to the top