Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java14
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java26
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java9
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImageDescriptor.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java3
10 files changed, 36 insertions, 43 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
index a856d1d7f..df6cb203b 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
@@ -359,8 +359,7 @@ public abstract class ContentMergeViewer extends ContentViewer
private ILabelProviderListener labelChangeListener = event -> {
Object[] elements = event.getElements();
- for (int i = 0; i < elements.length; i++) {
- Object object = elements[i];
+ for (Object object : elements) {
if (object == getInput())
updateHeader();
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
index 5aea68136..47d7ce017 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
@@ -1991,8 +1991,8 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
disposeCompareFilterActions(false);
if (fSourceViewerDecorationSupport != null) {
- for (Iterator<SourceViewerDecorationSupport> iterator = fSourceViewerDecorationSupport.iterator(); iterator.hasNext();) {
- iterator.next().dispose();
+ for (SourceViewerDecorationSupport sourceViewerDecorationSupport : fSourceViewerDecorationSupport) {
+ sourceViewerDecorationSupport.dispose();
}
fSourceViewerDecorationSupport = null;
}
@@ -3920,8 +3920,8 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
List<ChangeCompareFilterPropertyAction> currentFilterActions = (List<ChangeCompareFilterPropertyAction>) current;
for (CompareFilterDescriptor compareFilterDescriptor : compareFilterDescriptors) {
boolean match = false;
- for (int j = 0; j < currentFilterActions.size(); j++) {
- if (compareFilterDescriptor.getFilterId().equals(currentFilterActions.get(j).getFilterId())) {
+ for (ChangeCompareFilterPropertyAction currentFilterAction : currentFilterActions) {
+ if (compareFilterDescriptor.getFilterId().equals(currentFilterAction.getFilterId())) {
match = true;
break;
}
@@ -3965,8 +3965,8 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fCompareFilterActions);
getCompareConfiguration().setProperty(ChangeCompareFilterPropertyAction.COMPARE_FILTERS_INITIALIZING, null);
} else {
- for (int i = 0; i < fCompareFilterActions.size(); i++) {
- fCompareFilterActions.get(i).setInput(input, ancestor, left, right);
+ for (ChangeCompareFilterPropertyAction action : fCompareFilterActions) {
+ action.setInput(input, ancestor, left, right);
}
}
}
@@ -4570,7 +4570,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
if (rgb == null)
return null;
if (fColors == null)
- fColors= new HashMap<RGB, Color>(20);
+ fColors= new HashMap<>(20);
Color c= fColors.get(rgb);
if (c == null) {
c= new Color(display, rgb);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java
index 9fd561c59..cbf343679 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java
@@ -40,13 +40,13 @@ public class CompareResourceFilter {
public boolean filter(String path0, boolean folder, boolean isArchive) {
if (!folder && fExtraResourceFileFilters != null) {
char[] name= path0.toCharArray();
- for (int i= 0, l= fExtraResourceFileFilters.length; i < l; i++)
- if (match(fExtraResourceFileFilters[i], name, true))
+ for (char[] filter : fExtraResourceFileFilters)
+ if (match(filter, name, true))
return true;
}
if (folder && fExtraResourceFolderFilters != null) {
- for (int i= 0, l= fExtraResourceFolderFilters.length; i < l; i++)
- if (fExtraResourceFolderFilters[i].equals(path0))
+ for (String filter : fExtraResourceFolderFilters)
+ if (filter.equals(path0))
return true;
}
return false;
@@ -81,25 +81,23 @@ public class CompareResourceFilter {
fExtraResourceFolderFilters= null;
} else {
int fileCount= 0, folderCount= 0;
- for (int i= 0, l= filters.length; i < l; i++) {
- char[] f= filters[i];
- if (f.length == 0)
+ for (char[] filter : filters) {
+ if (filter.length == 0)
continue;
- if (f[f.length - 1] == '/')
+ if (filter[filter.length - 1] == '/')
folderCount++;
else
fileCount++;
}
fExtraResourceFileFilters= new char[fileCount][];
fExtraResourceFolderFilters= new String[folderCount];
- for (int i= 0, l= filters.length; i < l; i++) {
- char[] f= filters[i];
- if (f.length == 0)
+ for (char[] filter : filters) {
+ if (filter.length == 0)
continue;
- if (f[f.length - 1] == '/')
- fExtraResourceFolderFilters[--folderCount]= new String(subarray(f, 0, f.length - 1));
+ if (filter[filter.length - 1] == '/')
+ fExtraResourceFolderFilters[--folderCount]= new String(subarray(filter, 0, filter.length - 1));
else
- fExtraResourceFileFilters[--fileCount]= f;
+ fExtraResourceFileFilters[--fileCount]= filter;
}
}
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
index c602c549a..693ca3d1e 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
@@ -237,13 +237,13 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
private static CompareUIPlugin fgComparePlugin;
/** Maps type to icons */
- private static Map<String, Image> fgImages= new Hashtable<String, Image>(10);
+ private static Map<String, Image> fgImages= new Hashtable<>(10);
/** Maps type to ImageDescriptors */
- private static Map<String, ImageDescriptor> fgImageDescriptors= new Hashtable<String, ImageDescriptor>(10);
+ private static Map<String, ImageDescriptor> fgImageDescriptors= new Hashtable<>(10);
/** Maps ImageDescriptors to Images */
- private static Map<ImageDescriptor, Image> fgImages2= new Hashtable<ImageDescriptor, Image>(10);
+ private static Map<ImageDescriptor, Image> fgImages2= new Hashtable<>(10);
- private static List<Image> fgDisposeOnShutdownImages= new ArrayList<Image>();
+ private static List<Image> fgDisposeOnShutdownImages= new ArrayList<>();
private ResourceBundle fResourceBundle;
@@ -1408,8 +1408,8 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
* @return an array of all dirty editor parts.
*/
public static IEditorPart[] getDirtyEditors() {
- Set<IEditorInput> inputs= new HashSet<IEditorInput>();
- List<IEditorPart> result= new ArrayList<IEditorPart>(0);
+ Set<IEditorInput> inputs= new HashSet<>();
+ List<IEditorPart> result= new ArrayList<>(0);
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow[] windows= workbench.getWorkbenchWindows();
for (IWorkbenchWindow window : windows) {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java
index dd13979da..38ba6b8a4 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java
@@ -46,6 +46,7 @@ import org.eclipse.swt.dnd.DropTarget;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.DropTargetListener;
import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -120,10 +121,10 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
event.detail = DND.DROP_NONE;
}
- for (int i = 0; i < event.dataTypes.length; i++) {
- if (resourceTransfer.isSupportedType(event.dataTypes[i])
- || textTransfer.isSupportedType(event.dataTypes[i])) {
- event.currentDataType = event.dataTypes[i];
+ for (TransferData dataType : event.dataTypes) {
+ if (resourceTransfer.isSupportedType(dataType)
+ || textTransfer.isSupportedType(dataType)) {
+ event.currentDataType = dataType;
if (event.detail != DND.DROP_COPY)
event.detail = DND.DROP_NONE;
break;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImageDescriptor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImageDescriptor.java
index f4d70a4e9..e90fdab53 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImageDescriptor.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImageDescriptor.java
@@ -59,10 +59,8 @@ public class DiffImageDescriptor extends CompositeImageDescriptor {
}
private int calculateHash(ImageData baseImageData) {
- byte[] data = baseImageData.data;
int hash = baseImageData.width + baseImageData.height;
- for (int i = 0; i < data.length; i++) {
- byte b = data[i];
+ for (byte b : baseImageData.data) {
hash >>>= 1;
hash ^= b;
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
index 98d1faefb..1728df9f1 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
@@ -853,8 +853,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(new Separator("text")); //$NON-NLS-1$
- for (Iterator<IAction> iterator = textActions.iterator(); iterator.hasNext();) {
- IAction action = iterator.next();
+ for (IAction action : textActions) {
menu.add(action);
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
index 113ae4bdb..2f2bc3b74 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
@@ -580,7 +580,7 @@ public class Utilities {
}
private static Map<IFile, Long> createModificationStampMap(List<IResource> files) {
- Map<IFile, Long> map= new HashMap<IFile, Long>();
+ Map<IFile, Long> map= new HashMap<>();
for (IResource file : files) {
map.put((IFile) file, file.getModificationStamp());
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java
index 8828ab25f..e7d47260d 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java
@@ -1293,8 +1293,7 @@ public class DocumentMerger {
private Diff findNext(char contributor, List<Diff> v, int start, int end, boolean deep) {
if (v == null)
return null;
- for (int i= 0; i < v.size(); i++) {
- Diff diff= v.get(i);
+ for (Diff diff : v) {
Position p= diff.getPosition(contributor);
if (p != null) {
int startOffset= p.getOffset();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
index 88204b43a..0170fadb2 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
@@ -785,8 +785,7 @@ public class Patcher implements IHunkFilter {
}
public boolean hasRejects() {
- for (Iterator<FileDiffResult> iterator = diffResults.values().iterator(); iterator.hasNext();) {
- FileDiffResult result = iterator.next();
+ for (FileDiffResult result : diffResults.values()) {
if (result.hasRejects())
return true;
}

Back to the top