Skip to content
Commits on Source (7)
......@@ -13,3 +13,4 @@ Snap.*
# maven
/*/*/target/
/bundles/org.eclipse.core.net/fragments/*/target/
/target/
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.compare.core
Bundle-Version: 3.6.500.qualifier
Bundle-Version: 3.6.600.qualifier
Bundle-Activator: org.eclipse.compare.internal.core.ComparePlugin
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)"
......
......@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.platform.team</artifactId>
<groupId>eclipse.platform.team</groupId>
<version>4.12.0-SNAPSHOT</version>
<version>4.13.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.compare</groupId>
<artifactId>org.eclipse.compare.core</artifactId>
<version>3.6.500-SNAPSHOT</version>
<version>3.6.600-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
......@@ -18,7 +18,6 @@ import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
......@@ -102,8 +101,8 @@ public class FileDiffResult implements IFilePatchResult {
this.fBeforeLines = new ArrayList<>(getLines(content, false));
this.fAfterLines = this.fMatches ? new ArrayList<>() : this.fBeforeLines;
IHunk[] hunks = this.fDiff.getHunks();
for (int i = 0; i < hunks.length; i++) {
Hunk hunk = (Hunk) hunks[i];
for (IHunk h : hunks) {
Hunk hunk = (Hunk) h;
hunk.setCharset(getCharset());
HunkResult result = getHunkResult(hunk);
result.setMatches(false);
......@@ -118,8 +117,8 @@ public class FileDiffResult implements IFilePatchResult {
// Check to see if we have at least one hunk that matches
this.fMatches = false;
IHunk[] hunks = this.fDiff.getHunks();
for (int i = 0; i < hunks.length; i++) {
Hunk hunk = (Hunk) hunks[i];
for (IHunk h : hunks) {
Hunk hunk = (Hunk) h;
HunkResult result = getHunkResult(hunk);
if (result.isOK()) {
this.fMatches = true;
......@@ -161,8 +160,8 @@ public class FileDiffResult implements IFilePatchResult {
}
int shift= 0;
IHunk[] hunks = this.fDiff.getHunks();
for (int i = 0; i < hunks.length; i++) {
Hunk hunk = (Hunk) hunks[i];
for (IHunk h : hunks) {
Hunk hunk = (Hunk) h;
hunk.setCharset(getCharset());
HunkResult result = getHunkResult(hunk);
result.setShift(shift);
......@@ -184,8 +183,7 @@ public class FileDiffResult implements IFilePatchResult {
public boolean containsProblems() {
if (this.fDiffProblem)
return true;
for (Iterator<HunkResult> iterator = this.fHunkResults.values().iterator(); iterator.hasNext();) {
HunkResult result = iterator.next();
for (HunkResult result : this.fHunkResults.values()) {
if (!result.isOK())
return true;
}
......@@ -263,8 +261,8 @@ public class FileDiffResult implements IFilePatchResult {
public List<Hunk> getFailedHunks() {
List<Hunk> failedHunks = new ArrayList<>();
IHunk[] hunks = this.fDiff.getHunks();
for (int i = 0; i < hunks.length; i++) {
HunkResult result = this.fHunkResults.get(hunks[i]);
for (IHunk hunk : hunks) {
HunkResult result = this.fHunkResults.get(hunk);
if (result != null && !result.isOK())
failedHunks.add(result.getHunk());
}
......@@ -287,8 +285,8 @@ public class FileDiffResult implements IFilePatchResult {
// return hunk results in the same order as hunks are placed in file diff
List<HunkResult> results = new ArrayList<>();
IHunk[] hunks = this.fDiff.getHunks();
for (int i = 0; i < hunks.length; i++) {
HunkResult result = this.fHunkResults.get(hunks[i]);
for (IHunk hunk : hunks) {
HunkResult result = this.fHunkResults.get(hunk);
if (result != null) {
results.add(result);
}
......
......@@ -223,8 +223,7 @@ public class FilePatch2 implements IFilePatch2 {
adjustedNewPath = new Path(null, this.fProject.getName()).append(this.fNewPath);
}
FilePatch2 diff = create(adjustedOldPath, 0, adjustedNewPath, 0);
for (Iterator<Hunk> iterator = this.fHunks.iterator(); iterator.hasNext();) {
Hunk hunk = iterator.next();
for (Hunk hunk : this.fHunks) {
// Creating the hunk adds it to the parent diff
new Hunk(diff, hunk);
}
......
......@@ -92,8 +92,7 @@ public class Hunk implements IHunk {
*/
public String getContent() {
StringBuilder sb= new StringBuilder();
for (int i= 0; i < this.fLines.length; i++) {
String line= this.fLines[i];
for (String line : this.fLines) {
sb.append(line.substring(0, LineReader.length(line)));
sb.append('\n');
}
......@@ -183,8 +182,7 @@ public class Hunk implements IHunk {
List<String> contextLines = new ArrayList<>();
boolean contextLinesMatched = true;
boolean precedingLinesChecked = false;
for (int i= 0; i < this.fLines.length; i++) {
String s = this.fLines[i];
for (String s : this.fLines) {
Assert.isTrue(s.length() > 0);
String line = s.substring(1);
char controlChar = s.charAt(0);
......@@ -332,8 +330,7 @@ public class Hunk implements IHunk {
boolean precedingLinesChecked = false;
String lineDelimiter = getLineDelimiter(lines);
for (int i= 0; i < this.fLines.length; i++) {
String s= this.fLines[i];
for (String s : this.fLines) {
Assert.isTrue(s.length() > 0);
String line= s.substring(1);
char controlChar= s.charAt(0);
......@@ -463,8 +460,7 @@ public class Hunk implements IHunk {
public String getContents(boolean isAfterState, boolean reverse) {
StringBuilder result= new StringBuilder();
for (int i= 0; i<this.fLines.length; i++) {
String line= this.fLines[i];
for (String line : this.fLines) {
String rest= line.substring(1);
char c = line.charAt(0);
if (c == ' ') {
......
......@@ -254,8 +254,8 @@ public class HunkResult {
private boolean isEnabled(PatchConfiguration configuration) {
IHunkFilter[] filters = configuration.getHunkFilters();
for (int i = 0; i < filters.length; i++) {
if (!filters[i].select(this.fHunk)) {
for (IHunkFilter filter : filters) {
if (!filter.select(this.fHunk)) {
return false;
}
}
......
......@@ -159,8 +159,7 @@ public class PatchReader {
private String readUnifiedDiff(List<FilePatch2> diffs, LineReader lr, String line, String diffArgs, String fileName, DiffProject diffProject) throws IOException {
List<FilePatch2> newDiffs= new ArrayList<>();
String nextLine= readUnifiedDiff(newDiffs, lr, line, diffArgs, fileName);
for (Iterator<FilePatch2> iter= newDiffs.iterator(); iter.hasNext();) {
FilePatch2 diff= iter.next();
for (FilePatch2 diff : newDiffs) {
diffProject.add(diff);
diffs.add(diff);
}
......@@ -595,10 +594,10 @@ public class PatchReader {
private long extractDate(String[] args, int n) {
if (n < args.length) {
String line= args[n];
for (int i= 0; i < this.fDateFormats.length; i++) {
this.fDateFormats[i].setLenient(true);
for (DateFormat dateFormat : this.fDateFormats) {
dateFormat.setLenient(true);
try {
Date date= this.fDateFormats[i].parse(line);
Date date = dateFormat.parse(line);
return date.getTime();
} catch (ParseException ex) {
// silently ignored
......@@ -696,8 +695,7 @@ public class PatchReader {
if (!isWorkspacePatch() || this.fDiffs.length == 0)
return this.fDiffs;
List<FilePatch2> result = new ArrayList<>();
for (int i = 0; i < this.fDiffs.length; i++) {
FilePatch2 diff = this.fDiffs[i];
for (FilePatch2 diff : this.fDiffs) {
result.add(diff.asRelativeDiff());
}
return result.toArray(new FilePatch2[result.size()]);
......
......@@ -94,8 +94,8 @@ public class PatchBuilder {
IPath newPath, long newDate, IHunk[] hunks) {
reorder(hunks);
FilePatch2 fileDiff = new FilePatch2(oldPath, oldDate, newPath, newDate);
for (int i = 0; i < hunks.length; i++) {
fileDiff.add((Hunk) hunks[i]);
for (IHunk hunk : hunks) {
fileDiff.add((Hunk) hunk);
}
return fileDiff;
}
......@@ -165,9 +165,9 @@ public class PatchBuilder {
private static int getHunkLength(String[] lines, boolean old) {
int length = 0;
for (int i = 0; i < lines.length; i++) {
if (lines[i].length() > 0) {
switch (lines[i].charAt(0)) {
for (String line : lines) {
if (line.length() > 0) {
switch (line.charAt(0)) {
case ' ':
length++;
break;
......@@ -190,9 +190,9 @@ public class PatchBuilder {
}
private static boolean checkForPrefix(char prefix, String[] lines) {
for (int i = 0; i < lines.length; i++) {
if (lines[i].length() > 0) {
if (lines[i].charAt(0) == prefix) {
for (String line : lines) {
if (line.length() > 0) {
if (line.charAt(0) == prefix) {
return true;
}
}
......@@ -210,8 +210,8 @@ public class PatchBuilder {
private static IHunk[] removeHunks(IHunk[] hunks, IHunk[] toRemove) {
int removed = 0;
for (int i = 0; i < hunks.length; i++) {
for (int j = 0; j < toRemove.length; j++) {
if (toRemove[j] == hunks[i]) {
for (IHunk r : toRemove) {
if (r == hunks[i]) {
hunks[i] = null;
removed++;
}
......@@ -229,8 +229,8 @@ public class PatchBuilder {
private static void reorder(IHunk[] hunks) {
Arrays.sort(hunks, new HunkComparator());
int shift = 0;
for (int i = 0; i < hunks.length; i++) {
Hunk hunk = (Hunk) hunks[i];
for (IHunk h : hunks) {
Hunk hunk = (Hunk) h;
int start = hunk.getStart(false) + shift;
hunk.setStart(start, true);
shift += hunk.getLength(true) - hunk.getLength(false);
......
......@@ -294,9 +294,7 @@ public final class RangeDifferencer {
int mstart= 0;
int ystart= 0;
for (int i= 0; i < in.length; i++) {
RangeDifference es= in[i];
for (RangeDifference es : in) {
rd= factory.createRangeDifference(RangeDifference.NOCHANGE, mstart, es.rightStart() - mstart, ystart, es.leftStart() - ystart);
if (rd.maxLength() != 0)
out.add(rd);
......@@ -375,9 +373,7 @@ public final class RangeDifferencer {
int ystart= 0;
int astart= 0;
for (int i= 0; i < in.length; i++) {
RangeDifference es= in[i];
for (RangeDifference es : in) {
rd= factory.createRangeDifference(RangeDifference.NOCHANGE, mstart, es.rightStart() - mstart, ystart, es.leftStart() - ystart, astart, es.ancestorStart() - astart);
if (rd.maxLength() > 0)
out.add(rd);
......
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.compare.win32;singleton:=true
Bundle-Version: 1.2.500.qualifier
Bundle-Version: 1.2.600.qualifier
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Eclipse-PlatformFilter: (osgi.os=win32)
......
......@@ -14,14 +14,18 @@
<parent>
<artifactId>eclipse.platform.team</artifactId>
<groupId>eclipse.platform.team</groupId>
<version>4.12.0-SNAPSHOT</version>
<version>4.13.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<groupId>org.eclipse.compare</groupId>
<artifactId>org.eclipse.compare.win32</artifactId>
<version>1.2.500-SNAPSHOT</version>
<version>1.2.600-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<skipAPIAnalysis>true</skipAPIAnalysis>
</properties>
<build>
<plugins>
<!-- tycho is not able to automatically determine os/ws/arch of this bundle -->
......
......@@ -159,7 +159,7 @@ public class WordMergeViewer extends AbstractMergeViewer implements IFlushable,
String dPath;
String ePath;
if (relPath.indexOf("/") >= 0) { //$NON-NLS-1$
if (relPath.contains("/")) { //$NON-NLS-1$
String path= relPath.substring(1);
dPath= 'd' + path;
ePath= 'e' + path;
......@@ -438,8 +438,8 @@ public class WordMergeViewer extends AbstractMergeViewer implements IFlushable,
private void firePropertyChange(String property, Object oldValue, Object newValue) {
Object[] allListeners = listeners.getListeners();
final PropertyChangeEvent event = new PropertyChangeEvent(this, property, oldValue, newValue);
for (int i = 0; i < allListeners.length; i++) {
final IPropertyChangeListener listener = (IPropertyChangeListener)allListeners[i];
for (Object allListener : allListeners) {
final IPropertyChangeListener listener = (IPropertyChangeListener) allListener;
SafeRunner.run(new SafeRunnable() {
public void run() throws Exception {
listener.propertyChange(event);
......
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.compare; singleton:=true
Bundle-Version: 3.7.600.qualifier
Bundle-Version: 3.7.700.qualifier
Bundle-Activator: org.eclipse.compare.internal.CompareUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
......
......@@ -17,7 +17,6 @@ package org.eclipse.compare;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
......@@ -254,8 +253,7 @@ public class CompareConfiguration {
@Override
public void dispose() {
for (Iterator<ICompareInputLabelProvider> iterator = labelProviders.values().iterator(); iterator.hasNext();) {
ICompareInputLabelProvider lp = iterator.next();
for (ICompareInputLabelProvider lp : labelProviders.values()) {
lp.removeListener(this);
}
if (defaultLabelProvider != null)
......@@ -413,8 +411,8 @@ public class CompareConfiguration {
PropertyChangeEvent event= null;
Object[] listeners= fListeners.getListeners();
if (listeners != null) {
for (int i= 0; i < listeners.length; i++) {
IPropertyChangeListener l= (IPropertyChangeListener) listeners[i];
for (Object listener : listeners) {
IPropertyChangeListener l = (IPropertyChangeListener) listener;
if (event == null)
event= new PropertyChangeEvent(this, propertyName, oldValue, newValue);
l.propertyChange(event);
......
......@@ -308,8 +308,9 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
@Override
public void open(OpenEvent event) {
Object[] listeners= fOpenListener.getListeners();
for (int i= 0; i < listeners.length; i++)
((IOpenListener) listeners[i]).open(event);
for (Object listener : listeners) {
((IOpenListener) listener).open(event);
}
}
@Override
......
......@@ -15,6 +15,7 @@ package org.eclipse.compare;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
......@@ -466,8 +467,7 @@ public class EditionSelectionDialog extends ResizableDialog {
if (sco != null) {
Object[] children= sco.getChildren();
if (children != null)
for (int i= 0; i < children.length; i++)
current.add(children[i]);
Collections.addAll(current, children);
}
final IStructureCreator sc= structureCreator;
......@@ -489,8 +489,8 @@ public class EditionSelectionDialog extends ResizableDialog {
if (sco2 != null) {
Object[] children= sco2.getChildren();
if (children != null) {
for (int i2= 0; i2 < children.length; i2++) {
ITypedElement child= (ITypedElement) children[i2];
for (Object c : children) {
ITypedElement child = (ITypedElement) c;
if (!current.contains(child))
sendPair(new Pair(sc, edition, child));
}
......@@ -637,11 +637,11 @@ public class EditionSelectionDialog extends ResizableDialog {
}
private boolean hasDoubleQuotes(String string) {
return string.indexOf("''") != -1; //$NON-NLS-1$
return string.contains("''"); //$NON-NLS-1$
}
private boolean hasVariable(String string) {
return string.indexOf("{0}") != -1; //$NON-NLS-1$
return string.contains("{0}"); //$NON-NLS-1$
}
/**
......
......@@ -135,8 +135,8 @@ public class ResourceNode extends BufferedContent
if (fResource instanceof IContainer) {
try {
IResource members[]= ((IContainer)fResource).members();
for (int i= 0; i < members.length; i++) {
IStructureComparator child= createChild(members[i]);
for (IResource member : members) {
IStructureComparator child = createChild(member);
if (child != null)
fChildren.add(child);
}
......
......@@ -1398,9 +1398,9 @@ public abstract class ContentMergeViewer extends ContentViewer
}
if (source != null) {
Saveable[] saveables = source.getSaveables();
for (int i = 0; i < saveables.length; i++) {
if (saveables[i] instanceof ISavingSaveable) {
ISavingSaveable saveable = (ISavingSaveable) saveables[i];
for (Saveable s : saveables) {
if (s instanceof ISavingSaveable) {
ISavingSaveable saveable = (ISavingSaveable) s;
if (saveable.isSaving())
return true;
}
......