Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchammer2019-11-12 21:32:15 +0000
committerKarsten Thoms2019-12-10 15:39:01 +0000
commit0dfb589593e911582f232afb028866cf213e458d (patch)
treef467e44de3d7f5d85df8fe25f004c392fbaefa9f /org.eclipse.debug.ui/ui/org
parent0c32a78b8fd287cbabb8ae666c8d4334fbc53912 (diff)
downloadeclipse.platform.debug-0dfb589593e911582f232afb028866cf213e458d.tar.gz
eclipse.platform.debug-0dfb589593e911582f232afb028866cf213e458d.tar.xz
eclipse.platform.debug-0dfb589593e911582f232afb028866cf213e458d.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: Ibbb60232f6a15f80f8975ca5f9056104be5351ba 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/GroupBreakpointsByAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java78
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java118
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java9
10 files changed, 100 insertions, 154 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java
index cf304ff3a..1d1b1d1fe 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java
@@ -61,9 +61,8 @@ public class GroupBreakpointsByAction extends AbstractBreakpointsViewAction impl
@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);
}
@@ -121,9 +120,7 @@ public class GroupBreakpointsByAction extends AbstractBreakpointsViewAction impl
public List<IAction> getActions(int accel) {
List<IAction> actions = new ArrayList<>();
- IBreakpointOrganizer[] organizers = BreakpointOrganizerManager.getDefault().getOrganizers();
- for (int i = 0; i < organizers.length; i++) {
- IBreakpointOrganizer organizer = organizers[i];
+ for (IBreakpointOrganizer organizer : BreakpointOrganizerManager.getDefault().getOrganizers()) {
IAction action = new GroupBreakpointsAction(organizer, fView);
addAccel(accel, action, organizer.getLabel());
accel++;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java
index 5635b98fe..26a3730e9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java
@@ -148,13 +148,13 @@ public class GroupBreakpointsByDialog extends TrayDialog {
*/
private void initializeContent() {
IBreakpointOrganizer[] organizers= BreakpointOrganizerManager.getDefault().getOrganizers();
- for (int i = 0; i < organizers.length; i++) {
- fAvailableOrganizersProvider.addAvailable(organizers[i]);
+ for (IBreakpointOrganizer organizer : organizers) {
+ fAvailableOrganizersProvider.addAvailable(organizer);
}
organizers = fView.getBreakpointOrganizers();
if (organizers != null) {
- for (int i = 0; i < organizers.length; i++) {
- fSelectedOrganizersProvider.addSelected(organizers[i]);
+ for (IBreakpointOrganizer organizer : organizers) {
+ fSelectedOrganizersProvider.addSelected(organizer);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java
index 67bad5c5f..3f539be90 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java
@@ -16,7 +16,6 @@ package org.eclipse.debug.internal.ui.importexport.launchconfigurations;
import java.io.File;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -169,13 +168,12 @@ public class ImportLaunchConfigurationsWizardPage extends WizardResourceImportPa
settings.put(OVERWRITE, fOverwrite.getSelection());
settings.put(OLD_PATH, fFromDirectory.getText().trim());
boolean overwrite = fOverwrite.getSelection();
- List<?> items = getSelectedResources();
File config, newconfig = null;
boolean owall = false, nowall = false;
MessageDialog dialog = null;
final List<File> filesToImport = new ArrayList<>();
- for (Iterator<?> iter = items.iterator(); iter.hasNext();) {
- config = (File) ((DebugFileSystemElement) iter.next()).getFileSystemObject();
+ for (Object resource : getSelectedResources()) {
+ config = (File) ((DebugFileSystemElement) resource).getFileSystemObject();
newconfig = new File(new Path(LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH.toOSString()).append(config.getName()).toOSString());
if(newconfig.exists() & !overwrite) {
if(nowall) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java
index 60c8125bd..0ae099c40 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java
@@ -215,10 +215,10 @@ public class FilterTransform {
return childIndex;
}
int offset = 0;
- for (int i = 0; i < filteredIndexes.length; i++) {
- if (childIndex == filteredIndexes[i] ) {
+ for (int filteredIndex : filteredIndexes) {
+ if (childIndex == filteredIndex ) {
return -1;
- } else if (childIndex > filteredIndexes[i]) {
+ } else if (childIndex > filteredIndex) {
offset++;
} else {
break;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java
index b05729bfa..6bce2166f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java
@@ -115,8 +115,8 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat
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/model/InternalTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
index b3cca22bc..c7c4325a5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
@@ -239,8 +239,7 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
protected void disposeCellEditors() {
CellEditor[] cellEditors = getCellEditors();
if (cellEditors != null) {
- for (int i = 0; i < cellEditors.length; i++) {
- CellEditor editor = cellEditors[i];
+ for (CellEditor editor : cellEditors) {
if (editor != null) {
editor.dispose();
}
@@ -568,8 +567,8 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
* @param columnIds the identifiers of the columns to reset
*/
public void resetColumnSizes(String[] columnIds) {
- for (int i = 0; i < columnIds.length; i++) {
- fColumnSizes.remove(columnIds[i]);
+ for (String columnId : columnIds) {
+ fColumnSizes.remove(columnId);
}
}
@@ -617,9 +616,9 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
} else {
Widget[] items = findItems(element);
if (items.length != 0) {
- for (int i = 0; i < items.length; i++) {
- if (items[i] instanceof TreeItem) {
- contentProvider.preserveState(getTreePathFromItem((TreeItem)items[i]));
+ for (Widget item : items) {
+ if (item instanceof TreeItem) {
+ contentProvider.preserveState(getTreePathFromItem((TreeItem)item));
} else {
contentProvider.preserveState(TreePath.EMPTY);
}
@@ -679,11 +678,11 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
final TreeColumn[] columns = tree.getColumns();
String[] visibleColumnIds = getVisibleColumns();
// remove all listeners before disposing - see bug 223233
- for (int i = 0; i < columns.length; i++) {
- columns[i].removeControlListener(fListener);
+ for (TreeColumn column : columns) {
+ column.removeControlListener(fListener);
}
- for (int i = 0; i < columns.length; i++) {
- columns[i].dispose();
+ for (TreeColumn column : columns) {
+ column.dispose();
}
PresentationContext presentationContext = (PresentationContext) getPresentationContext();
if (presentation != null) {
@@ -744,23 +743,21 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
}
private void initColumns(int widthHint, int treeWidgetWidth, String[] visibleColumnIds) {
- TreeColumn[] columns = getTree().getColumns();
- for (int i = 0; i < columns.length; i++) {
- TreeColumn treeColumn = columns[i];
- Object colData = treeColumn.getData();
+ for (TreeColumn column : getTree().getColumns()) {
+ Object colData = column.getData();
String columnId = colData instanceof String ? (String) colData : null;
Integer width = fColumnSizes.get(colData);
if (width == null) {
int ans = getInitialColumnWidth(columnId, treeWidgetWidth, visibleColumnIds);
if (ans == -1) {
- treeColumn.setWidth(widthHint);
+ column.setWidth(widthHint);
} else {
- treeColumn.setWidth(ans);
+ column.setWidth(ans);
}
} else {
- treeColumn.setWidth(width.intValue());
+ column.setWidth(width.intValue());
}
- treeColumn.addControlListener(fListener);
+ column.addControlListener(fListener);
}
}
@@ -790,15 +787,15 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
return presentation.getInitialColumns();
} else {
String[] available = presentation.getAvailableColumns();
- for (int i = 0; i < columns.length; i++) {
+ for (String column : columns) {
boolean columnAvailable = false;
- for (int j = 0; j < available.length; j++) {
- if (columns[i].equals(available[j])) {
+ for (String element : available) {
+ if (column.equals(element)) {
columnAvailable = true;
}
}
- if (!columnAvailable || presentation.getHeader(columns[i]) == null) {
+ if (!columnAvailable || presentation.getHeader(column) == null) {
// We found a column ID which is not in current list of available column IDs.
// Or the presentation cannot return a header title for the given column.
// Clear out saved column data for given column presentation.
@@ -839,11 +836,9 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
*/
protected void persistColumnSizes() {
Tree tree = getTree();
- TreeColumn[] columns = tree.getColumns();
- for (int i = 0; i < columns.length; i++) {
- TreeColumn treeColumn = columns[i];
- Object id = treeColumn.getData();
- fColumnSizes.put(id, Integer.valueOf(treeColumn.getWidth()));
+ for (TreeColumn column : tree.getColumns()) {
+ Object id = column.getData();
+ fColumnSizes.put(id, Integer.valueOf(column.getWidth()));
}
}
@@ -924,27 +919,21 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
* @param memento the {@link IMemento} to read from
*/
public void initState(IMemento memento) {
- IMemento[] mementos = memento.getChildren(COLUMN_SIZES);
- for (int i = 0; i < mementos.length; i++) {
- IMemento child = mementos[i];
+ for (IMemento child : memento.getChildren(COLUMN_SIZES)) {
String id = child.getID();
Integer size = child.getInteger(SIZE);
if (size != null) {
fColumnSizes.put(id, size);
}
}
- mementos = memento.getChildren(SHOW_COLUMNS);
- for (int i = 0; i < mementos.length; i++) {
- IMemento child = mementos[i];
+ for (IMemento child : memento.getChildren(SHOW_COLUMNS)) {
String id = child.getID();
Boolean bool = Boolean.valueOf(child.getString(SHOW_COLUMNS));
if (!bool.booleanValue()) {
fShowColumns.put(id, bool);
}
}
- mementos = memento.getChildren(VISIBLE_COLUMNS);
- for (int i = 0; i < mementos.length; i++) {
- IMemento child = mementos[i];
+ for (IMemento child : memento.getChildren(VISIBLE_COLUMNS)) {
String id = child.getID();
Integer integer = child.getInteger(SIZE);
if (integer != null) {
@@ -956,9 +945,7 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
fVisibleColumns.put(id, columns);
}
}
- mementos = memento.getChildren(COLUMN_ORDER);
- for (int i = 0; i < mementos.length; i++) {
- IMemento child = mementos[i];
+ for (IMemento child : memento.getChildren(COLUMN_ORDER)) {
String id = child.getID();
Integer integer = child.getInteger(SIZE);
if (integer != null) {
@@ -1133,9 +1120,9 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
if (items.length == 1) {
return items[0];
}
- for (int i = 0; i < items.length; i++) {
- if (getTreePathFromItem((Item)items[i]).equals(path)) {
- return items[i];
+ for (Widget item : items) {
+ if (getTreePathFromItem((Item)item).equals(path)) {
+ return item;
}
}
return null;
@@ -1354,9 +1341,8 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
public boolean getElementChildrenRealized(TreePath parentPath) {
Widget parentItem = findItem(parentPath);
if (parentItem != null) {
- Item[] children = getChildren(parentItem);
- for (int i = 0; i < children.length; i++) {
- if (children[i].getData() == null) {
+ for (Item element : getChildren(parentItem)) {
+ if (element.getData() == null) {
return false;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java
index 351f5d5ed..f11f18c96 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java
@@ -250,17 +250,14 @@ public class InternalVirtualTreeModelViewer extends Viewer
itemsToDisassociate = findItems(element);
}
- VirtualItem[] parentItems = findItems(parentElementOrTreePath);
- for (int i = 0; i < parentItems.length; i++) {
- VirtualItem parentItem = parentItems[i];
+ for (VirtualItem parentItem : findItems(parentElementOrTreePath)) {
if (index < parentItem.getItemCount()) {
VirtualItem item = parentItem.getItem(new Index(index));
selection = adjustSelectionForReplace(selectedItems, selection, item, element, parentItem.getData());
// disassociate any different item that represents the
// same element under the same parent (the tree)
- for (int j = 0; j < itemsToDisassociate.length; j++) {
- VirtualItem itemToDisassociate = itemsToDisassociate[j];
- if (itemToDisassociate != item && itemsToDisassociate[j].getParent() == parentItem) {
+ for (VirtualItem itemToDisassociate : itemsToDisassociate) {
+ if (itemToDisassociate != item && itemToDisassociate.getParent() == parentItem) {
disassociate(itemToDisassociate);
itemToDisassociate.getParent().clear(itemToDisassociate.getIndex());
}
@@ -268,9 +265,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
//Object oldData = item.getData();
associate(element, item);
doUpdate(item);
- VirtualItem[] children = item.getItems();
- for (int j = 0; j < children.length; j++) {
- children[j].setNeedsDataUpdate();
+ for (VirtualItem childitem : item.getItems()) {
+ childitem.setNeedsDataUpdate();
}
}
}
@@ -312,9 +308,7 @@ public class InternalVirtualTreeModelViewer extends Viewer
final List<TreePath> oldSelection = new LinkedList<>(Arrays.asList(((TreeSelection) getSelection()).getPaths()));
preservingSelection(() -> {
TreePath removedPath = null;
- VirtualItem[] parentItems = findItems(parentOrTreePath);
- for (int i = 0; i < parentItems.length; i++) {
- VirtualItem parentItem = parentItems[i];
+ for (VirtualItem parentItem : findItems(parentOrTreePath)) {
if (parentItem.isDisposed()) {
continue;
}
@@ -361,12 +355,9 @@ public class InternalVirtualTreeModelViewer extends Viewer
return;
}
- VirtualItem[] items = findItems(elementOrPath);
- if (items.length > 0) {
- for (int j = 0; j < items.length; j++) {
- disassociate(items[j]);
- items[j].getParent().remove(items[j].getIndex());
- }
+ for (VirtualItem item : findItems(elementOrPath)) {
+ disassociate(item);
+ item.getParent().remove(item.getIndex());
}
}
@@ -377,8 +368,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
// Don't do anything - we are not seeing an instance of bug 185673
return selection;
}
- for (int i = 0; i < selectedItems.length; i++) {
- if (item == selectedItems[i]) {
+ for (VirtualItem selectedItem : selectedItems) {
+ if (item == selectedItem) {
// The current item was selected, but its data is null.
// The data will be replaced by the given element, so to keep
// it selected, we have to add it to the selection.
@@ -501,9 +492,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
@Override
public void refresh(Object element) {
- VirtualItem[] items = findItems(element);
- for (int i = 0; i < items.length; i++) {
- refresh(items[i]);
+ for (VirtualItem item : findItems(element)) {
+ refresh(item);
validate();
}
}
@@ -517,9 +507,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
virtualLazyUpdateHasChildren(item);
}
- VirtualItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- items[i].setNeedsDataUpdate();
+ for (VirtualItem childItem : item.getItems()) {
+ childItem.setNeedsDataUpdate();
}
}
refreshStruct(item);
@@ -627,16 +616,14 @@ public class InternalVirtualTreeModelViewer extends Viewer
@Override
public void setChildCount(final Object elementOrTreePath, final int count) {
preservingSelection(() -> {
- VirtualItem[] items = findItems(elementOrTreePath);
- for (int i = 0; i < items.length; i++) {
- VirtualItem[] children = items[i].getItems();
- for (int j = 0; j < children.length; j++) {
- if (children[j].getData() != null && children[j].getIndex().intValue() >= count) {
- disassociate(children[j]);
+ for (VirtualItem item : findItems(elementOrTreePath)) {
+ for (VirtualItem element : item.getItems()) {
+ if (element.getData() != null && element.getIndex().intValue() >= count) {
+ disassociate(element);
}
}
- items[i].setItemCount(count);
+ item.setItemCount(count);
}
});
validate();
@@ -645,15 +632,11 @@ public class InternalVirtualTreeModelViewer extends Viewer
@Override
public void setHasChildren(final Object elementOrTreePath, final boolean hasChildren) {
preservingSelection(() -> {
- VirtualItem[] items = findItems(elementOrTreePath);
- for (int i = 0; i < items.length; i++) {
- VirtualItem item = items[i];
-
+ for (VirtualItem item : findItems(elementOrTreePath)) {
if (!hasChildren) {
- VirtualItem[] children = item.getItems();
- for (int j = 0; j < children.length; j++) {
- if (children[j].getData() != null) {
- disassociate(children[j]);
+ for (VirtualItem element : item.getItems()) {
+ if (element.getData() != null) {
+ disassociate(element);
}
}
}
@@ -826,10 +809,9 @@ public class InternalVirtualTreeModelViewer extends Viewer
item.setData(null);
// Disassociate the children
- VirtualItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- if (items[i].getData() != null) {
- disassociate(items[i]);
+ for (VirtualItem childItem : item.getItems()) {
+ if (childItem.getData() != null) {
+ disassociate(childItem);
}
}
}
@@ -864,10 +846,10 @@ public class InternalVirtualTreeModelViewer extends Viewer
if (selection instanceof ITreeSelection) {
TreePath[] paths = ((ITreeSelection) selection).getPaths();
List<VirtualItem> newSelection = new ArrayList<>(paths.length);
- for (int i = 0; i < paths.length; ++i) {
+ for (TreePath path : paths) {
// Use internalExpand since item may not yet be created. See
// 1G6B1AR.
- VirtualItem item = findItem(paths[i]);
+ VirtualItem item = findItem(path);
if (item != null) {
newSelection.add(item);
}
@@ -895,9 +877,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
@Override
public void update(Object element) {
- VirtualItem[] items = findItems(element);
- for (int i = 0; i < items.length; i++) {
- doUpdate(items[i]);
+ for (VirtualItem item : findItems(element)) {
+ doUpdate(item);
}
}
@@ -914,13 +895,13 @@ public class InternalVirtualTreeModelViewer extends Viewer
VirtualItem[] items = fTree.getSelection();
ArrayList<TreePath> list = new ArrayList<>(items.length);
Map<VirtualItem, TreePath> map = new LinkedHashMap<>(items.length * 4 / 3);
- for (int i = 0; i < items.length; i++) {
+ for (VirtualItem item : items) {
TreePath path = null;
- if (items[i].getData() != null) {
- path = getTreePathFromItem(items[i]);
+ if (item.getData() != null) {
+ path = getTreePathFromItem(item);
list.add(path);
}
- map.put(items[i], path);
+ map.put(item, path);
}
return new TreeSelection(list.toArray(new TreePath[list.size()]));
}
@@ -963,9 +944,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
@Override
public void setExpandedState(Object elementOrTreePath, boolean expanded) {
- VirtualItem[] items = findItems(elementOrTreePath);
- for (int i = 0; i < items.length; i++) {
- items[i].setExpanded(expanded);
+ for (VirtualItem item : findItems(elementOrTreePath)) {
+ item.setExpanded(expanded);
}
validate();
}
@@ -994,11 +974,10 @@ public class InternalVirtualTreeModelViewer extends Viewer
}
if (level == ALL_LEVELS || level > 1) {
- VirtualItem[] children = item.getItems();
int newLevel = (level == ALL_LEVELS ? ALL_LEVELS
: level - 1);
- for (int i = 0; i < children.length; i++) {
- expandToLevel(children[i], newLevel);
+ for (VirtualItem element : item.getItems()) {
+ expandToLevel(element, newLevel);
}
}
}
@@ -1315,18 +1294,14 @@ public class InternalVirtualTreeModelViewer extends Viewer
* @param memento Memento to read state from.
*/
public void initState(IMemento memento) {
- IMemento[] mementos = memento.getChildren(SHOW_COLUMNS);
- for (int i = 0; i < mementos.length; i++) {
- IMemento child = mementos[i];
+ for (IMemento child : memento.getChildren(SHOW_COLUMNS)) {
String id = child.getID();
Boolean bool = Boolean.valueOf(child.getString(SHOW_COLUMNS));
if (!bool.booleanValue()) {
fShowColumns.put(id, bool);
}
}
- mementos = memento.getChildren(VISIBLE_COLUMNS);
- for (int i = 0; i < mementos.length; i++) {
- IMemento child = mementos[i];
+ for (IMemento child : memento.getChildren(VISIBLE_COLUMNS)) {
String id = child.getID();
Integer integer = child.getInteger(SIZE);
if (integer != null) {
@@ -1451,7 +1426,6 @@ public class InternalVirtualTreeModelViewer extends Viewer
Set<VirtualItem> set = new HashSet<>();
Collections.addAll(set, selection);
- VirtualItem[] items = null;
VirtualItem parent = findItem(path);
if (parent != null) {
@@ -1468,9 +1442,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
delta.setFlags(delta.getFlags() | IModelDelta.SELECT);
}
- items = parent.getItems();
- for (int i = 0; i < items.length; i++) {
- doSaveElementState(path, delta, items[i], set, flagsToSave);
+ for (VirtualItem item : parent.getItems()) {
+ doSaveElementState(path, delta, item, set, flagsToSave);
}
return true;
} else {
@@ -1499,9 +1472,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
int numChildren = ((TreeModelContentProvider)getContentProvider()).viewToModelCount(elementPath, item.getItemCount());
ModelDelta childDelta = delta.addNode(element, modelIndex, flags, numChildren);
if (expanded) {
- VirtualItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- doSaveElementState(elementPath, childDelta, items[i], set, flagsToSave);
+ for (VirtualItem childItem : item.getItems()) {
+ doSaveElementState(elementPath, childDelta, childItem, set, flagsToSave);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java
index b5317ed7a..8c899d4c5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java
@@ -65,8 +65,7 @@ public class ExpressionManagerModelProxy extends AbstractModelProxy implements I
public void expressionsMoved(IExpression[] expressions, int index){
int count = getElementsCount();
ModelDelta delta = new ModelDelta(getExpressionManager(), -1, IModelDelta.NO_CHANGE, count);
- for (int i = 0; i < expressions.length; i++) {
- IExpression expression = expressions[i];
+ for (IExpression expression : expressions) {
delta.addNode(expression, IModelDelta.REMOVED);
}
for (int i = 0; i < expressions.length; i++) {
@@ -111,8 +110,7 @@ public class ExpressionManagerModelProxy extends AbstractModelProxy implements I
private void updateExpressions(IExpression[] expressions, int flags) {
ModelDelta delta = new ModelDelta(getExpressionManager(), IModelDelta.NO_CHANGE);
- for (int i = 0; i < expressions.length; i++) {
- IExpression expression = expressions[i];
+ for (IExpression expression : expressions) {
delta.addNode(expression, flags);
}
fireModelChanged(delta);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java
index 06c3bfbb1..b443af00e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java
@@ -108,9 +108,8 @@ public class FormatTableRenderingDialog extends TrayDialog
Label rowLabel = new Label(composite, SWT.NONE);
rowLabel.setText(DebugUIMessages.FormatTableRenderingAction_2);
fRowControl = new Combo(composite, SWT.READ_ONLY);
- for (int i=0; i<fRowSizes.length; i++)
- {
- fRowControl.add(String.valueOf(fRowSizes[i]));
+ for (int size : fRowSizes) {
+ fRowControl.add(String.valueOf(size));
}
fRowControl.addSelectionListener(new SelectionListener() {
@@ -140,9 +139,8 @@ public class FormatTableRenderingDialog extends TrayDialog
Label columnLabel = new Label(composite, SWT.NONE);
columnLabel.setText(DebugUIMessages.FormatTableRenderingAction_4);
fColumnControl = new Combo(composite, SWT.READ_ONLY);
- for (int i=0; i<fColumnSizes.length; i++)
- {
- fColumnControl.add(String.valueOf(fColumnSizes[i]));
+ for (int size : fColumnSizes) {
+ fColumnControl.add(String.valueOf(size));
}
fColumnControl.addSelectionListener(new SelectionListener() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java
index 244d2d55f..f49774165 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java
@@ -110,9 +110,7 @@ public class InspectPopupDialog extends DebugPopup {
if (view != null) {
// copy over properties
IPresentationContext copy = ((TreeModelViewer)view.getViewer()).getPresentationContext();
- String[] properties = copy.getProperties();
- for (int i = 0; i < properties.length; i++) {
- String key = properties[i];
+ for (String key : copy.getProperties()) {
fContext.setProperty(key, copy.getProperty(key));
}
}
@@ -140,9 +138,8 @@ public class InspectPopupDialog extends DebugPopup {
if (view != null) {
StructuredViewer structuredViewer = (StructuredViewer) view.getViewer();
if (structuredViewer != null) {
- ViewerFilter[] filters = structuredViewer.getFilters();
- for (int i = 0; i < filters.length; i++) {
- fViewer.addFilter(filters[i]);
+ for (ViewerFilter filter : structuredViewer.getFilters()) {
+ fViewer.addFilter(filter);
}
}
}

Back to the top