Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationHighlighter.java8
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java7
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java9
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java8
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java8
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java12
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingReconcileStrategy.java11
7 files changed, 33 insertions, 30 deletions
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationHighlighter.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationHighlighter.java
index 954c1abc7..76fbd83d5 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationHighlighter.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationHighlighter.java
@@ -16,6 +16,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
@@ -117,10 +118,9 @@ public class AnnotationHighlighter extends Highlighter {
IAnnotationModelExtension ame= (IAnnotationModelExtension) fModel;
ame.replaceAnnotations(new Annotation[0], annotationToPositionMap);
} else {
- for (Iterator<Annotation> elements= annotationToPositionMap.keySet().iterator(); elements.hasNext();) {
- Annotation element= elements.next();
- Position p= annotationToPositionMap.get(element);
- fModel.addAnnotation(element, p);
+ Set<Entry<Annotation, Position>> entrySet = annotationToPositionMap.entrySet();
+ for (Entry<Annotation, Position> entry : entrySet) {
+ fModel.addAnnotation(entry.getKey(), entry.getValue());
}
}
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java
index a2c665c87..b18f9dacc 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java
@@ -15,6 +15,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
@@ -71,10 +72,8 @@ public class EditorAccessHighlighter extends Highlighter {
}
}
}
- for (Iterator<IAnnotationModel> maps= mapsByAnnotationModel.keySet().iterator(); maps.hasNext();) {
- IAnnotationModel model= maps.next();
- Map<Annotation, Position> positionMap= mapsByAnnotationModel.get(model);
- addAnnotations(model, positionMap);
+ for (Entry<IAnnotationModel, HashMap<Annotation, Position>> entry : mapsByAnnotationModel.entrySet()) {
+ addAnnotations(entry.getKey(), entry.getValue());
}
}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java b/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
index 45e6e9ccc..f0f24411a 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
@@ -18,6 +18,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.regex.PatternSyntaxException;
import org.eclipse.core.runtime.Assert;
@@ -655,10 +656,10 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
if (fDocumentPartitioners != null) {
fDocumentPartitioningChangedEvent= new DocumentPartitioningChangedEvent(this);
- Iterator<String> e= fDocumentPartitioners.keySet().iterator();
- while (e.hasNext()) {
- String partitioning= e.next();
- IDocumentPartitioner partitioner= fDocumentPartitioners.get(partitioning);
+ for (Entry<String, IDocumentPartitioner> entry : fDocumentPartitioners.entrySet()) {
+
+ String partitioning= entry.getKey();
+ IDocumentPartitioner partitioner= entry.getValue();
if (partitioner instanceof IDocumentPartitionerExtension3) {
IDocumentPartitionerExtension3 extension= (IDocumentPartitionerExtension3) partitioner;
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java
index f297f2c0f..b02307032 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java
@@ -13,9 +13,9 @@ package org.eclipse.text.edits;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.Assert;
@@ -420,9 +420,9 @@ public final class MoveSourceEdit extends TextEdit {
}
private static void restorePositions(Map<TextEdit, TextEdit> editMap) {
- for (Iterator<TextEdit> iter= editMap.keySet().iterator(); iter.hasNext();) {
- TextEdit marker= iter.next();
- TextEdit edit= editMap.get(marker);
+ for (Entry<TextEdit, TextEdit> entry: editMap.entrySet()) {
+ TextEdit marker = entry.getKey();
+ TextEdit edit= entry.getValue();
if (marker.isDeleted()) {
edit.markAsDeleted();
} else {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java
index 4531693e9..4da7156e7 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java
@@ -16,6 +16,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
@@ -411,10 +412,9 @@ class QuickDiffConfigurationBlock implements IPreferenceConfigurationBlock {
}
private void initializeFields() {
- Iterator<Button> e= fCheckBoxes.keySet().iterator();
- while (e.hasNext()) {
- Button b= e.next();
- String key= fCheckBoxes.get(b);
+ for (Entry<Button, String> entry : fCheckBoxes.entrySet()) {
+ Button b = entry.getKey();
+ String key= entry.getValue();
b.setSelection(fStore.getBoolean(key));
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
index b44c54bbd..1a928e905 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
@@ -17,6 +17,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.swt.SWT;
@@ -864,14 +865,15 @@ class SelectResourcesBlock implements ICheckStateListener, ISelectionChangedList
Set<Object> selectedNodes= new HashSet<>();
checkedStateStore= new HashMap<>();
- //Update the store before the hierarchy to prevent updating parents
+ // Update the store before the hierarchy to prevent updating parents
// before all of the children are done
- Iterator<IContainer> keyIterator= items.keySet().iterator();
- while (keyIterator.hasNext()) {
- Object key= keyIterator.next();
+
+ for (Entry<IContainer, List<Object>> entry : items.entrySet()) {
+ Object key = entry.getKey();
primeHierarchyForSelection(key, selectedNodes);
- checkedStateStore.put(key, items.get(key));
+ checkedStateStore.put(key, entry.getValue());
}
+
// Update the checked tree items. Since each tree item has a selected
// item, all the tree items will be gray checked.
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingReconcileStrategy.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingReconcileStrategy.java
index 92ec1cfe3..6dd4ee3c3 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingReconcileStrategy.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingReconcileStrategy.java
@@ -15,6 +15,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -100,11 +101,11 @@ public class SpellingReconcileStrategy implements IReconcilingStrategy, IReconci
if (fAnnotationModel instanceof IAnnotationModelExtension)
((IAnnotationModelExtension)fAnnotationModel).replaceAnnotations(annotationsToRemove, fAddAnnotations);
else {
- for (int i= 0; i < annotationsToRemove.length; i++)
- fAnnotationModel.removeAnnotation(annotationsToRemove[i]);
- for (iter= fAddAnnotations.keySet().iterator(); iter.hasNext();) {
- Annotation annotation= iter.next();
- fAnnotationModel.addAnnotation(annotation, fAddAnnotations.get(annotation));
+ for (Annotation element : annotationsToRemove) {
+ fAnnotationModel.removeAnnotation(element);
+ }
+ for (Entry<Annotation, Position> entry : fAddAnnotations.entrySet()) {
+ fAnnotationModel.addAnnotation(entry.getKey(), entry.getValue());
}
}
}

Back to the top