Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchammer2019-11-13 19:36:18 +0000
committerKarsten Thoms2019-12-10 16:22:47 +0000
commit7e491a84242e34c659e13ba6c85014a76afea8e2 (patch)
treed83a12c531740642c20ea41890b19d63d1f3572a /org.eclipse.debug.ui/ui/org
parent0dfb589593e911582f232afb028866cf213e458d (diff)
downloadeclipse.platform.debug-7e491a84242e34c659e13ba6c85014a76afea8e2.tar.gz
eclipse.platform.debug-7e491a84242e34c659e13ba6c85014a76afea8e2.tar.xz
eclipse.platform.debug-7e491a84242e34c659e13ba6c85014a76afea8e2.zip
Use jdk 5 for-each loop
Replace simple uses of Iterator with a corresponding for-loop. Also add missing braces on loops as necessary. Change-Id: I6bef6d52ae3ebad62598d6ab3ce74d00638d3d83 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/actions/breakpointGroups/RemoveFromWorkingSetAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerViewer.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ModelNode.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/TableUpdatePolicy.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java29
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/RenderingsUtil.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java3
17 files changed, 77 insertions, 101 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java
index 8f39efebf..93c99f7b5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java
@@ -47,8 +47,8 @@ public class RemoveFromWorkingSetAction extends BreakpointSelectionAction {
@Override
public void run() {
if (fBreakpoints != null) {
- for (int i = 0; i < fBreakpoints.length; i++) {
- fBreakpoints[i].container.getOrganizer().removeBreakpoint(fBreakpoints[i].breakpoint, fBreakpoints[i].container.getCategory());
+ for (BreakpointSetElement breakpoint : fBreakpoints) {
+ breakpoint.container.getOrganizer().removeBreakpoint(breakpoint.breakpoint, breakpoint.container.getCategory());
}
}
}
@@ -73,10 +73,7 @@ public class RemoveFromWorkingSetAction extends BreakpointSelectionAction {
if (selection instanceof ITreeSelection) {
ITreeSelection tSel = (ITreeSelection)selection;
- TreePath[] paths = tSel.getPaths();
- for (int i = 0; i < paths.length; i++) {
- TreePath path = paths[i];
-
+ for (TreePath path : tSel.getPaths()) {
// We can remove Breakpoints from their working set if any of their parents is a non "Other" breakpoint working set
IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(path.getLastSegment(), IBreakpoint.class);
if (breakpoint != null) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
index a4acc0685..e2aeb3b70 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
@@ -135,8 +135,8 @@ public class RemoveBreakpointAction extends AbstractSelectionActionDelegate {
Shell shell= getView() != null ? getView().getSite().getShell() : null;
DebugUITools.deleteBreakpoints(breakpoints, shell, pmonitor);
- for (int i = 0; i < sets.length; i++) {
- PlatformUI.getWorkbench().getWorkingSetManager().removeWorkingSet(sets[i]);
+ for (IWorkingSet set : sets) {
+ PlatformUI.getWorkbench().getWorkingSetManager().removeWorkingSet(set);
}
return Status.OK_STATUS;
} catch (CoreException e) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
index a1bd7991f..89872dcb5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
@@ -323,9 +323,9 @@ public class MemoryBlockContentAdapter extends AsynchronousContentAdapter {
// fill buffer with memory returned by debug adapter
int j = prefillNumBytes; // counter for memoryBuffer
- for (int i = 0; i < memory.length; i++) {
+ for (byte element : memory) {
MemoryByte tmp = new MemoryByte();
- tmp.setValue(memory[i]);
+ tmp.setValue(element);
tmp.setReadable(true);
tmp.setWritable(true);
tmp.setEndianessKnown(false);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerViewer.java
index b69e76c96..55d9c2b03 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerViewer.java
@@ -100,9 +100,9 @@ public class SourceContainerViewer extends TreeViewer {
*/
public void setEntries(ISourceContainer[] entries) {
fEntries.clear();
- for (int i = 0; i < entries.length; i++) {
- if(entries[i] != null) {
- fEntries.add(entries[i]);
+ for (ISourceContainer entry : entries) {
+ if(entry != null) {
+ fEntries.add(entry);
}
}
if (getInput() == null) {
@@ -141,9 +141,9 @@ public class SourceContainerViewer extends TreeViewer {
if (!sel.isEmpty()) {
index = fEntries.indexOf(sel.getFirstElement());
}
- for (int i = 0; i < entries.length; i++) {
- if (!fEntries.contains(entries[i])) {
- fEntries.add(index, entries[i]);
+ for (ISourceContainer entry : entries) {
+ if (!fEntries.contains(entry)) {
+ fEntries.add(index, entry);
index++;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ModelNode.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ModelNode.java
index 5888a294b..348e9b7e6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ModelNode.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ModelNode.java
@@ -64,8 +64,8 @@ public class ModelNode {
fDisposed = true;
ModelNode[] childrenNodes = getChildrenNodes();
if (childrenNodes != null) {
- for (int i = 0; i < childrenNodes.length; i++) {
- childrenNodes[i].dispose();
+ for (ModelNode node : childrenNodes) {
+ node.dispose();
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/TableUpdatePolicy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/TableUpdatePolicy.java
index 83c471574..9d9c067c5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/TableUpdatePolicy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/TableUpdatePolicy.java
@@ -57,8 +57,7 @@ public class TableUpdatePolicy extends org.eclipse.debug.internal.ui.viewers.Abs
}
protected void updateNodes(IModelDelta[] nodes) {
- for (int i = 0; i < nodes.length; i++) {
- IModelDelta node = nodes[i];
+ for (IModelDelta node : nodes) {
int flags = node.getFlags();
if ((flags & IModelDelta.STATE) != 0) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java
index be08f7380..451ca18c4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java
@@ -158,10 +158,9 @@ public class ModelDelta implements IModelDelta {
return node;
}
} else if (nodeOrNodes instanceof ModelDelta[]) {
- ModelDelta[] nodes = (ModelDelta[])nodeOrNodes;
- for (int i = 0; i < nodes.length; i++) {
- if (index == nodes[i].getIndex()) {
- return nodes[i];
+ for (ModelDelta node : (ModelDelta[])nodeOrNodes) {
+ if (index == node.getIndex()) {
+ return node;
}
}
}
@@ -175,8 +174,8 @@ public class ModelDelta implements IModelDelta {
}
// Create a map with capacity for all child nodes.
fNodesMap = new HashMap<>(fNodesList.size() * 4 / 3);
- for (int i = 0; i < fNodesList.size(); i++) {
- mapNode( fNodesList.get(i) );
+ for (ModelDelta node : fNodesList) {
+ mapNode( node );
}
}
@@ -358,9 +357,8 @@ public class ModelDelta implements IModelDelta {
buf.append(" Child Count: "); //$NON-NLS-1$
buf.append(delta.getChildCount());
buf.append('\n');
- IModelDelta[] nodes = delta.getChildDeltas();
- for (int i = 0; i < nodes.length; i++) {
- appendDetail(indent + " ", buf, nodes[i]); //$NON-NLS-1$
+ for (IModelDelta node : delta.getChildDeltas()) {
+ appendDetail(indent + " ", buf, node); //$NON-NLS-1$
}
}
@@ -376,9 +374,8 @@ public class ModelDelta implements IModelDelta {
protected void doAccept(IModelDeltaVisitor visitor, int depth) {
if (visitor.visit(this, depth)) {
- IModelDelta[] childDeltas = getChildDeltas();
- for (int i = 0; i < childDeltas.length; i++) {
- ((ModelDelta)childDeltas[i]).doAccept(visitor, depth+1);
+ for (IModelDelta node : getChildDeltas()) {
+ ((ModelDelta)node).doAccept(visitor, depth+1);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java
index 7fed0f718..05b3897fc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java
@@ -190,39 +190,34 @@ public class PresentationContext implements IPresentationContext {
public void initProperties(IMemento memento) {
IMemento presentationMemento = null;
- IMemento[] mementos = memento.getChildren(PRESENTATION_CONTEXT_PROPERTIES);
- for (int i = 0; i < mementos.length; i++) {
- if (getId().equals(mementos[i].getID())) {
- presentationMemento = mementos[i];
+ for (IMemento childMemento : memento.getChildren(PRESENTATION_CONTEXT_PROPERTIES)) {
+ if (getId().equals(childMemento.getID())) {
+ presentationMemento = childMemento;
break;
}
}
if (presentationMemento != null) {
- IMemento[] stringProperties = presentationMemento.getChildren(STRING);
- for (int i = 0; i < stringProperties.length; i++) {
- fProperties.put(stringProperties[i].getID(), stringProperties[i].getString(STRING));
+ for (IMemento stringProperty : presentationMemento.getChildren(STRING)) {
+ fProperties.put(stringProperty.getID(), stringProperty.getString(STRING));
}
- IMemento[] integerMementos = presentationMemento.getChildren(INTEGER);
- for (int i = 0; i < integerMementos.length; i++) {
- fProperties.put(integerMementos[i].getID(), integerMementos[i].getInteger(INTEGER));
+ for (IMemento integerMemento : presentationMemento.getChildren(INTEGER)) {
+ fProperties.put(integerMemento.getID(), integerMemento.getInteger(INTEGER));
}
- IMemento[] booleanMementos = presentationMemento.getChildren(BOOLEAN);
- for (int i = 0; i < booleanMementos.length; i++) {
- fProperties.put(booleanMementos[i].getID(), booleanMementos[i].getBoolean(BOOLEAN));
+ for (IMemento booleanMemento : presentationMemento.getChildren(BOOLEAN)) {
+ fProperties.put(booleanMemento.getID(), booleanMemento.getBoolean(BOOLEAN));
}
- IMemento[] persistableMementos = presentationMemento.getChildren(PERSISTABLE);
- for (int i = 0; i < persistableMementos.length; i++) {
- String factoryID = persistableMementos[i].getString(PERSISTABLE);
+ for (IMemento persistableMemento : presentationMemento.getChildren(PERSISTABLE)) {
+ String factoryID = persistableMemento.getString(PERSISTABLE);
if (factoryID != null) {
IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryID);
if (factory != null) {
- Object element = factory.createElement(persistableMementos[i]);
+ Object element = factory.createElement(persistableMemento);
if (element != null) {
- fProperties.put(persistableMementos[i].getID(), element);
+ fProperties.put(persistableMemento.getID(), element);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
index 4f510b26e..9c7b3c7d6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
@@ -505,8 +505,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
*/
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
+ for (DebugEvent event : events) {
if (event.getSource().equals(getProcess())) {
if (event.getKind() == DebugEvent.TERMINATE) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java
index 3fb4622e7..d96b9c5f1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java
@@ -139,10 +139,8 @@ public class ProcessConsoleManager implements ILaunchListener {
}
protected void removeLaunch(ILaunch launch) {
- IProcess[] processes= launch.getProcesses();
- for (int i= 0; i < processes.length; i++) {
- IProcess iProcess = processes[i];
- removeProcess(iProcess);
+ for (IProcess process : launch.getProcesses()) {
+ removeProcess(process);
}
if (fProcesses != null) {
fProcesses.remove(launch);
@@ -171,9 +169,7 @@ public class ProcessConsoleManager implements ILaunchListener {
*/
public IConsole getConsole(IProcess process) {
IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
- IConsole[] consoles = manager.getConsoles();
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
+ for (IConsole console : manager.getConsoles()) {
if (console instanceof ProcessConsole) {
ProcessConsole pc = (ProcessConsole)console;
if (pc.getProcess().equals(process)) {
@@ -236,9 +232,8 @@ public class ProcessConsoleManager implements ILaunchListener {
launchManager.addLaunchListener(this);
//set up the docs for launches already registered
- ILaunch[] launches= launchManager.getLaunches();
- for (int i = 0; i < launches.length; i++) {
- launchAdded(launches[i]);
+ for (ILaunch launch : launchManager.getLaunches()) {
+ launchAdded(launch);
}
}
@@ -250,9 +245,7 @@ public class ProcessConsoleManager implements ILaunchListener {
public void shutdown() {
Job.getJobManager().cancel(ProcessConsoleManager.class);
ILaunchManager launchManager= DebugPlugin.getDefault().getLaunchManager();
- ILaunch[] launches = launchManager.getLaunches();
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
+ for (ILaunch launch : launchManager.getLaunches()) {
removeLaunch(launch);
}
launchManager.removeLaunchListener(this);
@@ -272,9 +265,7 @@ public class ProcessConsoleManager implements ILaunchListener {
if (fColorProviders == null) {
fColorProviders = new HashMap<>();
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_CONSOLE_COLOR_PROVIDERS);
- IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement extension = elements[i];
+ for (IConfigurationElement extension : extensionPoint.getConfigurationElements()) {
fColorProviders.put(extension.getAttribute("processType"), extension); //$NON-NLS-1$
}
}
@@ -311,9 +302,7 @@ public class ProcessConsoleManager implements ILaunchListener {
synchronized (fLineTrackersLock) { // can't use fLineTrackers as lock as it is null here
fLineTrackers = new HashMap<>();
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_CONSOLE_LINE_TRACKERS);
- IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement extension = elements[i];
+ for (IConfigurationElement extension : extensionPoint.getConfigurationElements()) {
String processType = extension.getAttribute("processType"); //$NON-NLS-1$
List<IConfigurationElement> list = fLineTrackers.get(processType);
if (list == null) {
@@ -359,8 +348,7 @@ public class ProcessConsoleManager implements ILaunchListener {
IProcess[] old = fProcesses.get(launch);
IProcess[] curr = launch.getProcesses();
if (old != null) {
- for (int i = 0; i < old.length; i++) {
- IProcess process = old[i];
+ for (IProcess process : old) {
if (!contains(curr, process)) {
if (removed == null) {
removed = new ArrayList<>();
@@ -382,8 +370,7 @@ public class ProcessConsoleManager implements ILaunchListener {
* @return whether the given object is contained in the list
*/
private boolean contains(Object[] list, Object object) {
- for (int i = 0; i < list.length; i++) {
- Object object2 = list[i];
+ for (Object object2 : list) {
if (object2.equals(object)) {
return true;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
index d524b0381..f3ca1e23b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
@@ -204,8 +204,7 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
+ for (DebugEvent event : events) {
if (event.getSource().equals(getProcess())) {
Runnable r = () -> {
if (fTerminate != null) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
index 53347de57..9f4b8a6d0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
@@ -170,8 +170,8 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite2 {
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);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java
index 109b3ea0d..8b728ccb9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java
@@ -59,8 +59,9 @@ public class MemoryViewUtil {
*/
static public boolean isValidSelection(ISelection selection) {
- if (!(selection instanceof IStructuredSelection))
+ if (!(selection instanceof IStructuredSelection)) {
return false;
+ }
// only single selection is allowed for this action
if (selection.isEmpty() || ((IStructuredSelection) selection).size() > 1) {
@@ -78,8 +79,9 @@ public class MemoryViewUtil {
*/
public static boolean isValidContext(Object elem) {
// if not debug element
- if (!(elem instanceof IAdaptable))
+ if (!(elem instanceof IAdaptable)) {
return false;
+ }
IMemoryBlockRetrieval memRetrieval = ((IAdaptable) elem).getAdapter(IMemoryBlockRetrieval.class);
@@ -97,8 +99,9 @@ public class MemoryViewUtil {
}
// not valid if the debug target is already terminated
- if (debugTarget != null && (debugTarget.isTerminated() || debugTarget.isDisconnected()))
+ if (debugTarget != null && (debugTarget.isTerminated() || debugTarget.isDisconnected())) {
return false;
+ }
if (memRetrieval != null && memRetrieval.supportsStorageRetrieval()) {
return true;
@@ -121,8 +124,9 @@ public class MemoryViewUtil {
public IStatus runInUIThread(IProgressMonitor monitor) {
// open error for the exception
String detail = IInternalDebugCoreConstants.EMPTY_STRING;
- if (e != null)
+ if (e != null) {
detail = e.getMessage();
+ }
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
@@ -151,25 +155,27 @@ public class MemoryViewUtil {
* @return true if the edit event is valid for activating the cell editor
*/
public static boolean isValidEditEvent(int event) {
- for (int i = 0; i < MemoryViewUtil.ignoreKeyEvents.length; i++) {
- if (event == MemoryViewUtil.ignoreKeyEvents[i])
+ for (int ignoredKeyKevent : MemoryViewUtil.ignoreKeyEvents) {
+ if (event == ignoredKeyKevent) {
return false;
+ }
}
return true;
}
public static BigInteger alignToBoundary(BigInteger integer, int numberOfUnitsPerLine) {
BigInteger[] result = integer.divideAndRemainder(BigInteger.valueOf(numberOfUnitsPerLine));
- integer = integer.subtract(result[1]);
- return integer;
+ return integer.subtract(result[1]);
}
public static void addHistory(String expression) {
- if (!MEMORY_BLOCKS_HISTORY.contains(expression))
+ if (!MEMORY_BLOCKS_HISTORY.contains(expression)) {
MEMORY_BLOCKS_HISTORY.add(0, expression);
+ }
- if (MEMORY_BLOCKS_HISTORY.size() > 5)
+ if (MEMORY_BLOCKS_HISTORY.size() > 5) {
MEMORY_BLOCKS_HISTORY.remove(MEMORY_BLOCKS_HISTORY.size() - 1);
+ }
}
public static String[] getHistory() {
@@ -194,8 +200,9 @@ public class MemoryViewUtil {
// if memory block extension, retrieval must be queired throught its
// interface
- if (object instanceof IMemoryBlockExtension)
+ if (object instanceof IMemoryBlockExtension) {
return ((IMemoryBlockExtension) object).getMemoryBlockRetrieval();
+ }
// check if the object can adapt to a memory block retrieval
if (object instanceof IAdaptable) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/RenderingsUtil.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/RenderingsUtil.java
index b39ea5133..9382579d1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/RenderingsUtil.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/RenderingsUtil.java
@@ -509,9 +509,8 @@ public class RenderingsUtil {
StringBuilder strBuffer = new StringBuilder();
char charArray[];
- for (int i=0; i<byteArray.length;i ++)
- {
- charArray = RenderingsUtil.convertByteToCharArray(byteArray[i]);
+ for (byte element : byteArray) {
+ charArray = RenderingsUtil.convertByteToCharArray(element);
strBuffer.append(charArray);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
index 58df27051..7a3d3b72b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
@@ -405,10 +405,9 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
// fill buffer with memory returned by debug adapter
int j = prefillNumBytes; // counter for memoryBuffer
- for (int i=0; i<memory.length; i++)
- {
+ for (byte element : memory) {
MemoryByte tmp = new MemoryByte();
- tmp.setValue(memory[i]);
+ tmp.setValue(element);
tmp.setReadable(true);
tmp.setWritable(true);
tmp.setEndianessKnown(false);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java
index fcf6627e9..60c14b0a9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java
@@ -241,9 +241,8 @@ public class RulerBreakpointTypesActionDelegate implements IEditorActionDelegate
@Override
public void menuShown(MenuEvent e) {
Menu m = (Menu)e.widget;
- MenuItem[] items = m.getItems();
- for (int i=0; i < items.length; i++) {
- items[i].dispose();
+ for (MenuItem item : m.getItems()) {
+ item.dispose();
}
fillMenu(m);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java
index 8a6b7ad75..c1bc665d7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java
@@ -67,8 +67,7 @@ public class RunToLineHandler implements IDebugEventSetListener, IBreakpointMana
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event= events[i];
+ for (DebugEvent event : events) {
Object source= event.getSource();
if (source instanceof IThread && event.getKind() == DebugEvent.SUSPEND &&
event.getDetail() == DebugEvent.BREAKPOINT) {

Back to the top