Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2020-07-17 19:18:42 +0000
committerAlexander Kurtakov2020-08-06 07:13:58 +0000
commit5cbc294116ce896cc6d4651c579f0b389a1b251b (patch)
treedfc60eb4d3cdb6e0be4761c5eb231da9800b0756
parentcccf85a7fc06aa7df917efa5323fc19294b2fbfa (diff)
downloadeclipse.platform.text-5cbc294116ce896cc6d4651c579f0b389a1b251b.tar.gz
eclipse.platform.text-5cbc294116ce896cc6d4651c579f0b389a1b251b.tar.xz
eclipse.platform.text-5cbc294116ce896cc6d4651c579f0b389a1b251b.zip
Use jdk 5 for-each loop
Replace simple uses of Iterator with a corresponding for-loop. Change-Id: I786236ff2c37a6455015a5b8fab866f1165531c4 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java6
-rw-r--r--org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java6
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/DAG.java14
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java41
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextZoomHandler.java5
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java6
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java23
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/CaseAction.java3
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java9
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieProposalProcessor.java6
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorDescriptor.java9
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorRegistry.java6
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorTargetDescriptor.java3
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnRegistry.java4
14 files changed, 60 insertions, 81 deletions
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java
index 1b74d950b40..0bd6a18bc12 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java
@@ -141,9 +141,9 @@ public class FileTool {
if (srcChildren == null) {
throw new IOException("Content from directory '" + src.getAbsolutePath() + "' can not be listed."); //$NON-NLS-1$ //$NON-NLS-2$
}
- for(int i = 0; i < srcChildren.length; ++i){
- File srcChild= new File(src, srcChildren[i]);
- File dstChild= new File(dst, srcChildren[i]);
+ for (String srcChild2 : srcChildren) {
+ File srcChild= new File(src, srcChild2);
+ File dstChild= new File(dst, srcChild2);
copy(srcChild, dstChild);
}
} else
diff --git a/org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java b/org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java
index f6fb12a0daa..975682bbafe 100644
--- a/org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java
+++ b/org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java
@@ -143,9 +143,9 @@ public class FileTool {
if (srcChildren == null) {
throw new IOException("Content from directory '" + src.getAbsolutePath() + "' can not be listed."); //$NON-NLS-1$ //$NON-NLS-2$
}
- for(int i = 0; i < srcChildren.length; ++i){
- File srcChild= new File(src, srcChildren[i]);
- File dstChild= new File(dst, srcChildren[i]);
+ for (String srcChild2 : srcChildren) {
+ File srcChild= new File(src, srcChild2);
+ File dstChild= new File(dst, srcChild2);
copy(srcChild, dstChild);
}
} else
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/DAG.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/DAG.java
index 91a158f7294..67077dae6b5 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/DAG.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/DAG.java
@@ -14,7 +14,6 @@
package org.eclipse.ui.internal.texteditor.rulers;
import java.util.Collections;
-import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
@@ -148,11 +147,11 @@ public final class DAG<E> {
*/
public void removeVertex(E vertex) {
Set<E> targets= fOut.removeAll(vertex);
- for (Iterator<E> it= targets.iterator(); it.hasNext();)
- fIn.remove(it.next(), vertex);
+ for (E e : targets)
+ fIn.remove(e, vertex);
Set<E> origins= fIn.removeAll(vertex);
- for (Iterator<E> it= origins.iterator(); it.hasNext();)
- fOut.remove(it.next(), vertex);
+ for (E e : origins)
+ fOut.remove(e, vertex);
}
/**
@@ -200,10 +199,9 @@ public final class DAG<E> {
if (start == end)
return true;
- Set<E> children= fOut.get(start);
- for (Iterator<E> it= children.iterator(); it.hasNext();)
+ for (E e : fOut.get(start))
// recursion
- if (hasPath(it.next(), end))
+ if (hasPath(e, end))
return true;
return false;
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
index 3456447c3f3..93f30cf1fac 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
@@ -1739,8 +1739,8 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
*/
@Override
public void dispose() {
- for (Iterator<IContributedRulerColumn> iter= new ArrayList<>(fColumns).iterator(); iter.hasNext();)
- removeColumn(getRuler(), iter.next());
+ for (IContributedRulerColumn iContributedRulerColumn : new ArrayList<>(fColumns))
+ removeColumn(getRuler(), iContributedRulerColumn);
fColumns.clear();
}
}
@@ -3232,8 +3232,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
RulerColumnRegistry registry= RulerColumnRegistry.getDefault();
List<RulerColumnDescriptor> descriptors= registry.getColumnDescriptors();
- for (Iterator<RulerColumnDescriptor> it= descriptors.iterator(); it.hasNext();) {
- final RulerColumnDescriptor descriptor= it.next();
+ for (RulerColumnDescriptor descriptor : descriptors) {
support.setColumnVisible(descriptor, adapter == null || adapter.isEnabled(descriptor));
}
}
@@ -4568,8 +4567,8 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
if (PREFERENCE_RULER_CONTRIBUTIONS.equals(property)) {
String[] difference= StringSetSerializer.getDifference((String) event.getOldValue(), (String) event.getNewValue());
IColumnSupport support= getAdapter(IColumnSupport.class);
- for (int i= 0; i < difference.length; i++) {
- RulerColumnDescriptor desc= RulerColumnRegistry.getDefault().getColumnDescriptor(difference[i]);
+ for (String element : difference) {
+ RulerColumnDescriptor desc= RulerColumnRegistry.getDefault().getColumnDescriptor(element);
if (desc != null && support.isColumnSupported(desc)) {
boolean newState= !support.isColumnVisible(desc);
support.setColumnVisible(desc, newState);
@@ -5291,8 +5290,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
private IAction findContributedAction(String actionID) {
List<IConfigurationElement> actions= new ArrayList<>();
IConfigurationElement[] elements= Platform.getExtensionRegistry().getConfigurationElementsFor(PlatformUI.PLUGIN_ID, "editorActions"); //$NON-NLS-1$
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
+ for (IConfigurationElement element : elements) {
if (TAG_CONTRIBUTION_TYPE.equals(element.getName())) {
IWorkbenchPartSite site = getSite();
if (site == null) {
@@ -5301,9 +5299,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
if (!site.getId().equals(element.getAttribute("targetID"))) //$NON-NLS-1$
continue;
- IConfigurationElement[] children= element.getChildren("action"); //$NON-NLS-1$
- for (int j= 0; j < children.length; j++) {
- IConfigurationElement child= children[j];
+ for (IConfigurationElement child : element.getChildren("action")) { //$NON-NLS-1$
if (actionID.equals(child.getAttribute("actionID"))) //$NON-NLS-1$
actions.add(child);
}
@@ -5472,8 +5468,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
IAction action;
StyledText textWidget= fSourceViewer.getTextWidget();
- for (int i= 0; i < ACTION_MAP.length; i++) {
- IdMapEntry entry= ACTION_MAP[i];
+ for (IdMapEntry entry : ACTION_MAP) {
action= new TextNavigationAction(textWidget, entry.getAction());
action.setActionDefinitionId(entry.getActionId());
setAction(entry.getActionId(), action);
@@ -6038,8 +6033,8 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
menu.add(new Separator(ITextEditorActionConstants.GROUP_REST));
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- for (Iterator<IMenuListener> i= fRulerContextMenuListeners.iterator(); i.hasNext();)
- i.next().menuAboutToShow(menu);
+ for (IMenuListener iMenuListener : fRulerContextMenuListeners)
+ iMenuListener.menuAboutToShow(menu);
addAction(menu, ITextEditorActionConstants.RULER_MANAGE_BOOKMARKS);
addAction(menu, ITextEditorActionConstants.RULER_MANAGE_TASKS);
@@ -6316,12 +6311,11 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
* @since 2.1
*/
protected void editorSaved() {
- INavigationLocation[] locations= getSite().getPage().getNavigationHistory().getLocations();
IEditorInput input= getEditorInput();
- for (int i= 0; i < locations.length; i++) {
- if (locations[i] instanceof TextSelectionNavigationLocation) {
- if(input.equals(locations[i].getInput())) {
- TextSelectionNavigationLocation location= (TextSelectionNavigationLocation) locations[i];
+ for (INavigationLocation location2 : getSite().getPage().getNavigationHistory().getLocations()) {
+ if (location2 instanceof TextSelectionNavigationLocation) {
+ if(input.equals(location2.getInput())) {
+ TextSelectionNavigationLocation location= (TextSelectionNavigationLocation) location2;
location.partSaved(this);
}
}
@@ -7282,11 +7276,10 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
*/
protected final void updateIndentPrefixes() {
SourceViewerConfiguration configuration= getSourceViewerConfiguration();
- String[] types= configuration.getConfiguredContentTypes(fSourceViewer);
- for (int i= 0; i < types.length; i++) {
- String[] prefixes= configuration.getIndentPrefixes(fSourceViewer, types[i]);
+ for (String type : configuration.getConfiguredContentTypes(fSourceViewer)) {
+ String[] prefixes= configuration.getIndentPrefixes(fSourceViewer, type);
if (prefixes != null && prefixes.length > 0)
- fSourceViewer.setIndentPrefixes(prefixes, types[i]);
+ fSourceViewer.setIndentPrefixes(prefixes, type);
}
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextZoomHandler.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextZoomHandler.java
index d159f716a61..3782c91a543 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextZoomHandler.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextZoomHandler.java
@@ -147,9 +147,8 @@ abstract class AbstractTextZoomHandler extends AbstractHandler {
// but those aren't visible at that time. So we're recreating the font hierarchy
fgFontToDefault= new HashMap<>();
fgDefaultToFonts= new HashMap<>();
- IConfigurationElement[] themeElements= Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.ui.themes"); //$NON-NLS-1$
- for (int i= 0; i < themeElements.length; i++) {
- IConfigurationElement extension= themeElements[i];
+ for (IConfigurationElement extension : Platform.getExtensionRegistry()
+ .getConfigurationElementsFor("org.eclipse.ui.themes")) { //$NON-NLS-1$
if ("fontDefinition".equals(extension.getName())) { //$NON-NLS-1$
String fontId= extension.getAttribute("id"); //$NON-NLS-1$
String defaultsTo= extension.getAttribute("defaultsTo"); //$NON-NLS-1$
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java
index 00ff12d5508..5004fe31d1c 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java
@@ -1072,9 +1072,9 @@ public class AnnotationPreference {
if (!getAnnotationType().equals(preference.getAnnotationType()))
return;
- for (int i= 0; i < ATTRIBUTES.length; i++) {
- if (!hasValue(ATTRIBUTES[i]))
- setValue(ATTRIBUTES[i], preference.getValue(ATTRIBUTES[i]));
+ for (Object element : ATTRIBUTES) {
+ if (!hasValue(element))
+ setValue(element, preference.getValue(element));
}
if (fAnnotationImageProvider == null)
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java
index 5d26c8c64d7..e17dc443761 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java
@@ -168,8 +168,7 @@ public class BasicTextEditorActionContributor extends EditorActionBarContributor
fHippieCompletion.setActionDefinitionId(ITextEditorActionDefinitionIds.HIPPIE_COMPLETION);
fStatusFields= new HashMap<>(3);
- for (int i= 0; i < STATUS_FIELD_DEFS.length; i++) {
- StatusFieldDef fieldDef= STATUS_FIELD_DEFS[i];
+ for (StatusFieldDef fieldDef : STATUS_FIELD_DEFS) {
fStatusFields.put(fieldDef, new StatusLineContributionItem(fieldDef.category, fieldDef.visible, fieldDef.widthInChars));
}
}
@@ -209,16 +208,16 @@ public class BasicTextEditorActionContributor extends EditorActionBarContributor
if (fActiveEditorPart instanceof ITextEditorExtension) {
ITextEditorExtension extension= (ITextEditorExtension) fActiveEditorPart;
- for (int i= 0; i < STATUS_FIELD_DEFS.length; i++)
- extension.setStatusField(null, STATUS_FIELD_DEFS[i].category);
+ for (StatusFieldDef element : STATUS_FIELD_DEFS)
+ extension.setStatusField(null, element.category);
}
fActiveEditorPart= part;
ITextEditor editor= (part instanceof ITextEditor) ? (ITextEditor) part : null;
IActionBars actionBars= getActionBars();
- for (int i= 0; i < ACTIONS.length; i++)
- actionBars.setGlobalActionHandler(ACTIONS[i], getAction(editor, ACTIONS[i]));
+ for (String element : ACTIONS)
+ actionBars.setGlobalActionHandler(element, getAction(editor, element));
actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.SHOW_WHITESPACE_CHARACTERS, getAction(editor, ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS));
actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.BLOCK_SELECTION_MODE, getAction(editor, ITextEditorActionConstants.BLOCK_SELECTION_MODE));
if (editor instanceof AbstractTextEditor && ((AbstractTextEditor)editor).isWordWrapSupported())
@@ -231,12 +230,12 @@ public class BasicTextEditorActionContributor extends EditorActionBarContributor
fGotoLine.setAction(getAction(editor, ITextEditorActionConstants.GOTO_LINE));
fHippieCompletion.setAction(getAction(editor, ITextEditorActionConstants.HIPPIE_COMPLETION));
- for (int i= 0; i < STATUS_FIELD_DEFS.length; i++) {
+ for (StatusFieldDef element : STATUS_FIELD_DEFS) {
if (fActiveEditorPart instanceof ITextEditorExtension) {
- StatusLineContributionItem statusField= fStatusFields.get(STATUS_FIELD_DEFS[i]);
- statusField.setActionHandler(getAction(editor, STATUS_FIELD_DEFS[i].actionId));
+ StatusLineContributionItem statusField= fStatusFields.get(element);
+ statusField.setActionHandler(getAction(editor, element.actionId));
ITextEditorExtension extension= (ITextEditorExtension) fActiveEditorPart;
- extension.setStatusField(statusField, STATUS_FIELD_DEFS[i].category);
+ extension.setStatusField(statusField, element.category);
}
}
}
@@ -302,8 +301,8 @@ public class BasicTextEditorActionContributor extends EditorActionBarContributor
@Override
public void contributeToStatusLine(IStatusLineManager statusLineManager) {
super.contributeToStatusLine(statusLineManager);
- for (int i= 0; i < STATUS_FIELD_DEFS.length; i++)
- statusLineManager.add(fStatusFields.get(STATUS_FIELD_DEFS[i]));
+ for (StatusFieldDef element : STATUS_FIELD_DEFS)
+ statusLineManager.add(fStatusFields.get(element));
}
@Override
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/CaseAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/CaseAction.java
index e84b6b84aa9..9d91c18bd6d 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/CaseAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/CaseAction.java
@@ -87,8 +87,7 @@ public class CaseAction extends TextEditorAction {
IRegion[] ranges= JFaceTextUtil.getCoveredRanges(viewer, selection);
if (ranges.length > 1 && viewer instanceof ITextViewerExtension)
((ITextViewerExtension) viewer).getRewriteTarget().beginCompoundChange();
- for (int i= 0; i < ranges.length; i++) {
- IRegion region= ranges[i];
+ for (IRegion region : ranges) {
String target= document.get(region.getOffset(), region.getLength());
String replacement= (fToUpper ? target.toUpperCase() : target.toLowerCase());
if (!target.equals(replacement)) {
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
index 82178e05e51..34d26c736c5 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
@@ -468,9 +468,8 @@ class FindReplaceDialog extends Dialog {
if ((button.getStyle() & SWT.RADIO) != 0) {
Composite buttonParent= button.getParent();
if (buttonParent != null) {
- Control[] children= buttonParent.getChildren();
- for (int i= 0; i < children.length; i++)
- ((Button)children[i]).setSelection(false);
+ for (Control child : buttonParent.getChildren())
+ ((Button)child).setSelection(false);
}
button.setSelection(true);
} else {
@@ -1639,8 +1638,8 @@ class FindReplaceDialog extends Dialog {
*/
private void updateCombo(Combo combo, List<String> content) {
combo.removeAll();
- for (int i= 0; i < content.size(); i++) {
- combo.add(content.get(i).toString());
+ for (String element : content) {
+ combo.add(element.toString());
}
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieProposalProcessor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieProposalProcessor.java
index 46ef069e906..774a80d85f5 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieProposalProcessor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieProposalProcessor.java
@@ -18,7 +18,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -213,11 +212,8 @@ public final class HippieProposalProcessor implements IContentAssistProcessor {
if (prefix == null || prefix.isEmpty())
return NO_PROPOSALS;
- List<String> suggestions= getSuggestions(viewer, offset, prefix);
-
List<ICompletionProposal> result= new ArrayList<>();
- for (Iterator<String> it= suggestions.iterator(); it.hasNext();) {
- String string= it.next();
+ for (String string : getSuggestions(viewer, offset, prefix)) {
if (!string.isEmpty())
result.add(createProposal(string, prefix, offset));
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorDescriptor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorDescriptor.java
index 718c64c0d7e..525081d05f5 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorDescriptor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorDescriptor.java
@@ -136,9 +136,9 @@ public final class HyperlinkDetectorDescriptor {
return false;
String targetId= getTargetId();
- for (int i= 0; i < targets.length; i++) {
- if (targetId.equals(targets[i].getId())) {
- fTarget= targets[i];
+ for (HyperlinkDetectorTargetDescriptor target : targets) {
+ if (targetId.equals(target.getId())) {
+ fTarget= target;
return true;
}
}
@@ -225,8 +225,7 @@ public final class HyperlinkDetectorDescriptor {
private static HyperlinkDetectorDescriptor[] createDescriptors(IConfigurationElement[] elements) {
HyperlinkDetectorTargetDescriptor[] targets= HyperlinkDetectorTargetDescriptor.getContributedHyperlinkDetectorTargets();
List<HyperlinkDetectorDescriptor> result= new ArrayList<>(elements.length);
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
+ for (IConfigurationElement element : elements) {
if (HYPERLINK_DETECTOR_ELEMENT.equals(element.getName())) {
HyperlinkDetectorDescriptor desc= new HyperlinkDetectorDescriptor(element);
if (desc.isValid(targets))
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorRegistry.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorRegistry.java
index 7bbb8ac2373..7fc26a5c6ec 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorRegistry.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorRegistry.java
@@ -162,9 +162,9 @@ public final class HyperlinkDetectorRegistry {
initHyperlinkDetectorDescriptors();
List<HyperlinkDetectorDelegate> result= new ArrayList<>();
- for (int i= 0; i < fHyperlinkDetectorDescriptors.length; i++) {
- if (targetId.equals(fHyperlinkDetectorDescriptors[i].getTargetId())) {
- HyperlinkDetectorDelegate detector= new HyperlinkDetectorDelegate(fHyperlinkDetectorDescriptors[i]);
+ for (HyperlinkDetectorDescriptor fHyperlinkDetectorDescriptor : fHyperlinkDetectorDescriptors) {
+ if (targetId.equals(fHyperlinkDetectorDescriptor.getTargetId())) {
+ HyperlinkDetectorDelegate detector= new HyperlinkDetectorDelegate(fHyperlinkDetectorDescriptor);
result.add(detector);
detector.setContext(context);
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorTargetDescriptor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorTargetDescriptor.java
index 2c797fc9df1..a500c1b9495 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorTargetDescriptor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorTargetDescriptor.java
@@ -127,8 +127,7 @@ public final class HyperlinkDetectorTargetDescriptor {
private static HyperlinkDetectorTargetDescriptor[] createDescriptors(IConfigurationElement[] elements) {
List<HyperlinkDetectorTargetDescriptor> result= new ArrayList<>(elements.length);
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
+ for (IConfigurationElement element : elements) {
if (TARGET_ELEMENT.equals(element.getName())) {
HyperlinkDetectorTargetDescriptor desc= new HyperlinkDetectorTargetDescriptor(element);
if (desc.isValid())
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnRegistry.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnRegistry.java
index fcb6c18616b..4ef98542417 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnRegistry.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnRegistry.java
@@ -19,7 +19,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
@@ -152,8 +151,7 @@ public final class RulerColumnRegistry {
List<RulerColumnDescriptor> descriptors= new ArrayList<>();
Map<String, RulerColumnDescriptor> descriptorMap= new HashMap<>();
- for (Iterator<IConfigurationElement> iter= elements.iterator(); iter.hasNext();) {
- IConfigurationElement element= iter.next();
+ for (IConfigurationElement element : elements) {
try {
RulerColumnDescriptor desc= new RulerColumnDescriptor(element, this);
String id= desc.getId();

Back to the top