Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-06-14 18:01:57 +0000
committerPaul Pazderski2019-06-15 15:17:08 +0000
commit1e85f9c9c33e8d3b31e6dbe2d1ce40182a041857 (patch)
tree7552c5a980252e5ed0a5e4c04bd4ff34d824a028 /bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
parent3a934d23cb1afac1bb9cc7302248ee2c3f126ed3 (diff)
downloadeclipse.platform.team-1e85f9c9c33e8d3b31e6dbe2d1ce40182a041857.tar.gz
eclipse.platform.team-1e85f9c9c33e8d3b31e6dbe2d1ce40182a041857.tar.xz
eclipse.platform.team-1e85f9c9c33e8d3b31e6dbe2d1ce40182a041857.zip
Use jdk 5 for-each loopI20190616-1800I20190615-1800
Replace simple uses of Iterator with a corresponding for-each loop. Also add missing braces on loops as necessary. Change-Id: I8cee98245fb49892d80949d1dcda89c9bf72f3e4 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Diffstat (limited to 'bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java24
1 files changed, 10 insertions, 14 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
index bb2bffbd6..08935bb8a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
@@ -357,8 +357,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
@Override
public void participantsAdded(final ISynchronizeParticipant[] participants) {
- for (int i = 0; i < participants.length; i++) {
- ISynchronizeParticipant participant = participants[i];
+ for (ISynchronizeParticipant participant : participants) {
if (isAvailable() && select(TeamUI.getSynchronizeManager().get(participant.getId(), participant.getSecondaryId()))) {
SynchronizeViewWorkbenchPart part = new SynchronizeViewWorkbenchPart(participant, getSite());
fParticipantToPart.put(participant, part);
@@ -372,8 +371,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
public void participantsRemoved(final ISynchronizeParticipant[] participants) {
if (isAvailable()) {
Runnable r = () -> {
- for (int i = 0; i < participants.length; i++) {
- ISynchronizeParticipant participant = participants[i];
+ for (ISynchronizeParticipant participant : participants) {
if (isAvailable()) {
SynchronizeViewWorkbenchPart part = (SynchronizeViewWorkbenchPart)fParticipantToPart.get(participant);
if (part != null) {
@@ -612,8 +610,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
// create pages
List<ISynchronizeParticipantReference> participants = new ArrayList<>();
ISynchronizeParticipantReference[] refs = manager.getSynchronizeParticipants();
- for (int i = 0; i < refs.length; i++) {
- ISynchronizeParticipantReference ref =refs[i];
+ for (ISynchronizeParticipantReference ref : refs) {
if(select(ref)) {
participants.add(ref);
}
@@ -718,8 +715,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
if (saveables.length == 0)
return;
monitor.beginTask(null, 100* saveables.length);
- for (int i = 0; i < saveables.length; i++) {
- Saveable saveable = saveables[i];
+ for (Saveable saveable : saveables) {
try {
saveable.doSave(Policy.subMonitorFor(monitor, 100));
} catch (CoreException e) {
@@ -739,8 +735,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
@Override
public boolean isDirty() {
Saveable[] saveables = getSaveables();
- for (int i = 0; i < saveables.length; i++) {
- Saveable saveable = saveables[i];
+ for (Saveable saveable : saveables) {
if (saveable.isDirty())
return true;
}
@@ -1014,10 +1009,11 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
IEditorPart editor = p.findEditor(input);
if (editor == null) {
IEditorReference[] er = p.getEditorReferences();
- for (int i = 0; i < er.length; i++)
- if (er[i].getId().equals(
- "org.eclipse.compare.CompareEditor") && matches(er[i], input)) //$NON-NLS-1$
- editor = er[i].getEditor(false);
+ for (IEditorReference e : er) {
+ if (e.getId().equals("org.eclipse.compare.CompareEditor") && matches(e, input)) { //$NON-NLS-1$
+ editor = e.getEditor(false);
+ }
+ }
}
return editor;
}

Back to the top