Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Brandys2009-03-04 10:45:42 -0500
committerSzymon Brandys2009-03-04 10:45:42 -0500
commite6467254256b516d676c269500b0f9881a8acd44 (patch)
tree7a9e395ef7025ccaaf40dcf7c06f6ad6286a179e
parent3e8e9d75895a0532ce6d765b140f68480b38cca4 (diff)
downloadeclipse.platform.team-e6467254256b516d676c269500b0f9881a8acd44.tar.gz
eclipse.platform.team-e6467254256b516d676c269500b0f9881a8acd44.tar.xz
eclipse.platform.team-e6467254256b516d676c269500b0f9881a8acd44.zip
Bug 267020 - [Apply Patch] Rename FileDiffWrapper to FilePatch and FileDiff to FilePatch2
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/DiffProject.java10
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java10
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FilePatch2.java (renamed from bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiff.java)14
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/Hunk.java28
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/PatchReader.java30
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/patch/PatchBuilder.java10
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/FilePatch.java (renamed from bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/FileDiffWrapper.java)10
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java8
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java10
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileDiffNode.java10
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java80
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java6
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java6
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/UnmatchedHunkTypedElement.java4
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java4
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java44
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java12
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/FileDiffResultTest.java4
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java6
19 files changed, 153 insertions, 153 deletions
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/DiffProject.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/DiffProject.java
index 158e00cac..4570c01d1 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/DiffProject.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/DiffProject.java
@@ -35,7 +35,7 @@ public class DiffProject {
* Add the file diff to this project.
* @param diff the file diff.
*/
- public void add(FileDiff diff) {
+ public void add(FilePatch2 diff) {
fDiffs.add(diff);
if (diff.getProject() != this)
diff.setProject(this);
@@ -53,7 +53,7 @@ public class DiffProject {
* Remove the file diff from this project.
* @param diff the diff to be removed
*/
- public void remove(FileDiff diff) {
+ public void remove(FilePatch2 diff) {
fDiffs.remove(diff);
}
@@ -62,7 +62,7 @@ public class DiffProject {
* @param diff a file diff
* @return whether this project contains the given diff
*/
- public boolean contains(FileDiff diff) {
+ public boolean contains(FilePatch2 diff) {
return fDiffs.contains(diff);
}
@@ -70,7 +70,7 @@ public class DiffProject {
* Return the file diffs associated with this project.
* @return the file diffs associated with this project
*/
- public FileDiff[] getFileDiffs() {
- return (FileDiff[]) fDiffs.toArray(new FileDiff[fDiffs.size()]);
+ public FilePatch2[] getFileDiffs() {
+ return (FilePatch2[]) fDiffs.toArray(new FilePatch2[fDiffs.size()]);
}
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java
index 53f0a9a83..755e99b44 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiffResult.java
@@ -32,7 +32,7 @@ import org.eclipse.osgi.util.NLS;
public class FileDiffResult implements IFilePatchResult {
- private FileDiff fDiff;
+ private FilePatch2 fDiff;
private boolean fMatches= false;
private boolean fDiffProblem;
private String fErrorMessage;
@@ -41,7 +41,7 @@ public class FileDiffResult implements IFilePatchResult {
private final PatchConfiguration configuration;
private String charset;
- public FileDiffResult(FileDiff diff, PatchConfiguration configuration) {
+ public FileDiffResult(FilePatch2 diff, PatchConfiguration configuration) {
super();
fDiff = diff;
this.configuration = configuration;
@@ -73,7 +73,7 @@ public class FileDiffResult implements IFilePatchResult {
charset = Utilities.getCharset(content);
//If this diff is an addition, make sure that it doesn't already exist
boolean exists = targetExists(content);
- if (fDiff.getDiffType(getConfiguration().isReversed()) == FileDiff.ADDITION) {
+ if (fDiff.getDiffType(getConfiguration().isReversed()) == FilePatch2.ADDITION) {
if ((!exists || isEmpty(content)) && canCreateTarget(content)) {
fMatches= true;
} else {
@@ -220,7 +220,7 @@ public class FileDiffResult implements IFilePatchResult {
monitor = new NullProgressMonitor();
fBeforeLines = new ArrayList(lines);
// TODO: What about deletions?
- if (fDiff.getDiffType(getConfiguration().isReversed()) == FileDiff.ADDITION) {
+ if (fDiff.getDiffType(getConfiguration().isReversed()) == FilePatch2.ADDITION) {
// Additions don't need to adjust the fuzz factor
// TODO: What about the after lines?
return -1;
@@ -268,7 +268,7 @@ public class FileDiffResult implements IFilePatchResult {
return failedHunks;
}
- public FileDiff getDiff() {
+ public FilePatch2 getDiff() {
return fDiff;
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiff.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FilePatch2.java
index 8aa4e2c1f..87e70356f 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FileDiff.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/FilePatch2.java
@@ -27,7 +27,7 @@ import org.eclipse.core.runtime.Path;
* A file diff represents a set of hunks that were associated with the
* same path in a patch file.
*/
-public class FileDiff implements IFilePatch2 {
+public class FilePatch2 implements IFilePatch2 {
/**
* Difference constant (value 1) indicating one side was added.
@@ -56,7 +56,7 @@ public class FileDiff implements IFilePatch2 {
* @param newPath the path of the after state
* @param newDate the timestamp of the after state
*/
- public FileDiff(IPath oldPath, long oldDate, IPath newPath, long newDate) {
+ public FilePatch2(IPath oldPath, long oldDate, IPath newPath, long newDate) {
fOldPath= oldPath;
this.oldDate = oldDate;
fNewPath= newPath;
@@ -74,7 +74,7 @@ public class FileDiff implements IFilePatch2 {
/**
* Set the project of this diff to the given project.
* This method should only be called from
- * {@link DiffProject#add(FileDiff)}
+ * {@link DiffProject#add(FilePatch2)}
* @param diffProject the parent project
*/
void setProject(DiffProject diffProject) {
@@ -206,7 +206,7 @@ public class FileDiff implements IFilePatch2 {
return getStrippedPath(configuration.getPrefixSegmentStripCount(), configuration.isReversed());
}
- public FileDiff asRelativeDiff() {
+ public FilePatch2 asRelativeDiff() {
if (fProject == null)
return this;
IPath adjustedOldPath = null;
@@ -217,7 +217,7 @@ public class FileDiff implements IFilePatch2 {
if (fNewPath != null) {
adjustedNewPath = new Path(null, fProject.getName()).append(fNewPath);
}
- FileDiff diff = create(adjustedOldPath, 0, adjustedNewPath, 0);
+ FilePatch2 diff = create(adjustedOldPath, 0, adjustedNewPath, 0);
for (Iterator iterator = fHunks.iterator(); iterator.hasNext();) {
Hunk hunk = (Hunk) iterator.next();
// Creating the hunk adds it to the parent diff
@@ -226,9 +226,9 @@ public class FileDiff implements IFilePatch2 {
return diff;
}
- protected FileDiff create(IPath oldPath, long oldDate, IPath newPath,
+ protected FilePatch2 create(IPath oldPath, long oldDate, IPath newPath,
long newDate) {
- return new FileDiff(oldPath, oldDate, newPath, newDate);
+ return new FilePatch2(oldPath, oldDate, newPath, newDate);
}
public void setHeader(String header) {
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/Hunk.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/Hunk.java
index f0b7e01c9..665612b8a 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/Hunk.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/Hunk.java
@@ -24,14 +24,14 @@ import org.eclipse.core.runtime.Assert;
*/
public class Hunk implements IHunk {
- private FileDiff fParent;
+ private FilePatch2 fParent;
private int fOldStart, fOldLength;
private int fNewStart, fNewLength;
private String[] fLines;
private int hunkType;
private String charset = null;
- public static Hunk createHunk(FileDiff parent, int[] oldRange, int[] newRange, List lines, boolean hasLineAdditions, boolean hasLineDeletions, boolean hasContextLines) {
+ public static Hunk createHunk(FilePatch2 parent, int[] oldRange, int[] newRange, List lines, boolean hasLineAdditions, boolean hasLineDeletions, boolean hasContextLines) {
int oldStart = 0;
int oldLength = 0;
int newStart = 0;
@@ -46,18 +46,18 @@ public class Hunk implements IHunk {
else
newStart= 0;
newLength= newRange[1];
- int hunkType = FileDiff.CHANGE;
+ int hunkType = FilePatch2.CHANGE;
if (!hasContextLines) {
if (hasLineAdditions && !hasLineDeletions) {
- hunkType = FileDiff.ADDITION;
+ hunkType = FilePatch2.ADDITION;
} else if (!hasLineAdditions && hasLineDeletions) {
- hunkType = FileDiff.DELETION;
+ hunkType = FilePatch2.DELETION;
}
}
return new Hunk(parent, hunkType, oldStart, oldLength, newStart, newLength, (String[]) lines.toArray(new String[lines.size()]));
}
- public Hunk(FileDiff parent, int hunkType, int oldStart, int oldLength,
+ public Hunk(FilePatch2 parent, int hunkType, int oldStart, int oldLength,
int newStart, int newLength, String[] lines) {
fParent = parent;
if (fParent != null) {
@@ -71,7 +71,7 @@ public class Hunk implements IHunk {
fLines = lines;
}
- public Hunk(FileDiff parent, Hunk toCopy) {
+ public Hunk(FilePatch2 parent, Hunk toCopy) {
this(parent, toCopy.hunkType, toCopy.fOldStart, toCopy.fOldLength, toCopy.fNewStart, toCopy.fNewLength, toCopy.fLines);
}
@@ -129,10 +129,10 @@ public class Hunk implements IHunk {
public int getHunkType(boolean reverse) {
if (reverse) {
- if (hunkType == FileDiff.ADDITION)
- return FileDiff.DELETION;
- if (hunkType == FileDiff.DELETION)
- return FileDiff.ADDITION;
+ if (hunkType == FilePatch2.ADDITION)
+ return FilePatch2.DELETION;
+ if (hunkType == FilePatch2.DELETION)
+ return FilePatch2.ADDITION;
}
return hunkType;
}
@@ -153,10 +153,10 @@ public class Hunk implements IHunk {
/**
* Set the parent of this hunk. This method
- * should only be invoked from {@link FileDiff#add(Hunk)}
+ * should only be invoked from {@link FilePatch2#add(Hunk)}
* @param diff the parent of this hunk
*/
- void setParent(FileDiff diff) {
+ void setParent(FilePatch2 diff) {
if (fParent == diff)
return;
if (fParent != null)
@@ -164,7 +164,7 @@ public class Hunk implements IHunk {
fParent = diff;
}
- public FileDiff getParent() {
+ public FilePatch2 getParent() {
return fParent;
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/PatchReader.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/PatchReader.java
index ebca0942b..60cf2ba9e 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/PatchReader.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/PatchReader.java
@@ -53,7 +53,7 @@ public class PatchReader {
private boolean fIsWorkspacePatch;
private DiffProject[] fDiffProjects;
- private FileDiff[] fDiffs;
+ private FilePatch2[] fDiffs;
// API for writing new multi-project patch format
public static final String MULTIPROJECTPATCH_HEADER= "### Eclipse Workspace Patch"; //$NON-NLS-1$
@@ -152,19 +152,19 @@ public class PatchReader {
lr.close();
fDiffProjects= (DiffProject[]) diffProjects.values().toArray(new DiffProject[diffProjects.size()]);
- fDiffs = (FileDiff[]) diffs.toArray(new FileDiff[diffs.size()]);
+ fDiffs = (FilePatch2[]) diffs.toArray(new FilePatch2[diffs.size()]);
}
- protected FileDiff createFileDiff(IPath oldPath, long oldDate,
+ protected FilePatch2 createFileDiff(IPath oldPath, long oldDate,
IPath newPath, long newDate) {
- return new FileDiff(oldPath, oldDate, newPath, newDate);
+ return new FilePatch2(oldPath, oldDate, newPath, newDate);
}
private String readUnifiedDiff(List diffs, LineReader lr, String line, String diffArgs, String fileName, DiffProject diffProject) throws IOException {
List newDiffs= new ArrayList();
String nextLine= readUnifiedDiff(newDiffs, lr, line, diffArgs, fileName);
for (Iterator iter= newDiffs.iterator(); iter.hasNext();) {
- FileDiff diff= (FileDiff) iter.next();
+ FilePatch2 diff= (FilePatch2) iter.next();
diffProject.add(diff);
diffs.add(diff);
}
@@ -195,13 +195,13 @@ public class PatchReader {
} else if (line.startsWith("--- ")) { //$NON-NLS-1$
line= readUnifiedDiff(diffs, lr, line, diffArgs, fileName);
if (!headerLines.isEmpty())
- setHeader((FileDiff)diffs.get(diffs.size() - 1), headerLines);
+ setHeader((FilePatch2)diffs.get(diffs.size() - 1), headerLines);
diffArgs= fileName= null;
reread= true;
} else if (line.startsWith("*** ")) { //$NON-NLS-1$
line= readContextDiff(diffs, lr, line, diffArgs, fileName);
if (!headerLines.isEmpty())
- setHeader((FileDiff)diffs.get(diffs.size() - 1), headerLines);
+ setHeader((FilePatch2)diffs.get(diffs.size() - 1), headerLines);
diffArgs= fileName= null;
reread= true;
}
@@ -215,10 +215,10 @@ public class PatchReader {
lr.close();
- fDiffs = (FileDiff[]) diffs.toArray(new FileDiff[diffs.size()]);
+ fDiffs = (FilePatch2[]) diffs.toArray(new FilePatch2[diffs.size()]);
}
- private void setHeader(FileDiff diff, List headerLines) {
+ private void setHeader(FilePatch2 diff, List headerLines) {
String header = LineReader.createString(false, headerLines);
diff.setHeader(header);
headerLines.clear();
@@ -238,7 +238,7 @@ public class PatchReader {
String[] newArgs= split(line.substring(4));
- FileDiff diff = createFileDiff(extractPath(oldArgs, 0, fileName),
+ FilePatch2 diff = createFileDiff(extractPath(oldArgs, 0, fileName),
extractDate(oldArgs, 1), extractPath(newArgs, 0, fileName),
extractDate(newArgs, 1));
diffs.add(diff);
@@ -344,7 +344,7 @@ public class PatchReader {
String[] newArgs= split(line.substring(4));
- FileDiff diff = createFileDiff(extractPath(oldArgs, 0, fileName),
+ FilePatch2 diff = createFileDiff(extractPath(oldArgs, 0, fileName),
extractDate(oldArgs, 1), extractPath(newArgs, 0, fileName),
extractDate(newArgs, 1));
diffs.add(diff);
@@ -657,19 +657,19 @@ public class PatchReader {
return fDiffProjects;
}
- public FileDiff[] getDiffs() {
+ public FilePatch2[] getDiffs() {
return fDiffs;
}
- public FileDiff[] getAdjustedDiffs() {
+ public FilePatch2[] getAdjustedDiffs() {
if (!isWorkspacePatch() || fDiffs.length == 0)
return fDiffs;
List result = new ArrayList();
for (int i = 0; i < fDiffs.length; i++) {
- FileDiff diff = fDiffs[i];
+ FilePatch2 diff = fDiffs[i];
result.add(diff.asRelativeDiff());
}
- return (FileDiff[]) result.toArray(new FileDiff[result.size()]);
+ return (FilePatch2[]) result.toArray(new FilePatch2[result.size()]);
}
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/patch/PatchBuilder.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/patch/PatchBuilder.java
index 0c39ea950..34f76c56a 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/patch/PatchBuilder.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare.core/src/org/eclipse/compare/patch/PatchBuilder.java
@@ -13,7 +13,7 @@ package org.eclipse.compare.patch;
import java.util.Arrays;
import java.util.Comparator;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.Hunk;
import org.eclipse.core.runtime.IPath;
@@ -90,7 +90,7 @@ public class PatchBuilder {
public static IFilePatch2 createFilePatch(IPath oldPath, long oldDate,
IPath newPath, long newDate, IHunk[] hunks) {
reorder(hunks);
- FileDiff fileDiff = new FileDiff(oldPath, oldDate, newPath, newDate);
+ FilePatch2 fileDiff = new FilePatch2(oldPath, oldDate, newPath, newDate);
for (int i = 0; i < hunks.length; i++) {
fileDiff.add((Hunk) hunks[i]);
}
@@ -152,12 +152,12 @@ public class PatchBuilder {
boolean hasLineAdditions = checkForPrefix(ADDITION_PREFIX, lines);
boolean hasLineDeletions = checkForPrefix(REMOVAL_PREFIX, lines);
if (hasLineAdditions && !hasLineDeletions) {
- return FileDiff.ADDITION;
+ return FilePatch2.ADDITION;
} else if (!hasLineAdditions && hasLineDeletions) {
- return FileDiff.DELETION;
+ return FilePatch2.DELETION;
}
}
- return FileDiff.CHANGE;
+ return FilePatch2.CHANGE;
}
private static int getHunkLength(String[] lines, boolean old) {
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/FileDiffWrapper.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/FilePatch.java
index 4d454176f..5841f269e 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/FileDiffWrapper.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/FilePatch.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.compare.internal.patch;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.patch.IFilePatch;
import org.eclipse.compare.patch.IFilePatchResult;
import org.eclipse.compare.patch.PatchConfiguration;
@@ -18,9 +18,9 @@ import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-public class FileDiffWrapper extends FileDiff implements IFilePatch {
+public class FilePatch extends FilePatch2 implements IFilePatch {
- public FileDiffWrapper(IPath oldPath, long oldDate, IPath newPath,
+ public FilePatch(IPath oldPath, long oldDate, IPath newPath,
long newDate) {
super(oldPath, oldDate, newPath, newDate);
}
@@ -39,9 +39,9 @@ public class FileDiffWrapper extends FileDiff implements IFilePatch {
: null, configuration, monitor);
}
- protected FileDiff create(IPath oldPath, long oldDate, IPath newPath,
+ protected FilePatch2 create(IPath oldPath, long oldDate, IPath newPath,
long newDate) {
- return new FileDiffWrapper(oldPath, oldDate, newPath, newDate);
+ return new FilePatch(oldPath, oldDate, newPath, newDate);
}
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
index 0da38432f..9b51fb3c8 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,7 +22,7 @@ import java.io.StringReader;
import org.eclipse.compare.internal.ICompareContextIds;
import org.eclipse.compare.internal.Utilities;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -189,7 +189,7 @@ import com.ibm.icu.text.MessageFormat;
// Read in the patch
readInPatch();
- FileDiff[] diffs= patcher.getDiffs();
+ FilePatch2[] diffs= patcher.getDiffs();
if (diffs == null || diffs.length == 0) {
String format= PatchMessages.InputPatchPage_NoDiffsFound_format;
String message= MessageFormat.format(format, new String[] { fPatchSource });
@@ -792,7 +792,7 @@ import com.ibm.icu.text.MessageFormat;
return false;
}
- FileDiff[] diffs= patcher.getDiffs();
+ FilePatch2[] diffs= patcher.getDiffs();
if (diffs == null || diffs.length == 0)
return false;
return true;
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java
index 28cd43e9d..f68109d49 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java
@@ -15,7 +15,7 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.*;
import org.eclipse.compare.internal.*;
import org.eclipse.compare.internal.core.patch.DiffProject;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.FileDiffResult;
import org.eclipse.compare.internal.core.patch.HunkResult;
import org.eclipse.compare.patch.PatchConfiguration;
@@ -206,7 +206,7 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
getViewer().refresh();
}
- private void processDiffs(FileDiff[] diffs) {
+ private void processDiffs(FilePatch2[] diffs) {
for (int i = 0; i < diffs.length; i++) {
processDiff(diffs[i], getRoot());
}
@@ -216,15 +216,15 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
//create diffProject nodes
for (int i = 0; i < diffProjects.length; i++) {
PatchProjectDiffNode projectNode = new PatchProjectDiffNode(getRoot(), diffProjects[i], getPatcher().getConfiguration());
- FileDiff[] diffs = diffProjects[i].getFileDiffs();
+ FilePatch2[] diffs = diffProjects[i].getFileDiffs();
for (int j = 0; j < diffs.length; j++) {
- FileDiff fileDiff = diffs[j];
+ FilePatch2 fileDiff = diffs[j];
processDiff(fileDiff, projectNode);
}
}
}
- private void processDiff(FileDiff diff, DiffNode parent) {
+ private void processDiff(FilePatch2 diff, DiffNode parent) {
FileDiffResult diffResult = getPatcher().getDiffResult(diff);
PatchFileDiffNode node = PatchFileDiffNode.createDiffNode(parent, diffResult);
HunkResult[] hunkResults = diffResult.getHunkResults();
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileDiffNode.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileDiffNode.java
index 15cfa5a22..8149140ea 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileDiffNode.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileDiffNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,7 +11,7 @@
package org.eclipse.compare.internal.patch;
import org.eclipse.compare.*;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.FileDiffResult;
import org.eclipse.compare.patch.PatchConfiguration;
import org.eclipse.compare.structuremergeviewer.*;
@@ -36,13 +36,13 @@ public class PatchFileDiffNode extends PatchDiffNode implements IContentChangeLi
private static int convertFileDiffTypeToDifferencerType(int fileDiffKind) {
int kind;
switch (fileDiffKind) {
- case FileDiff.ADDITION:
+ case FilePatch2.ADDITION:
kind = Differencer.ADDITION;
break;
- case FileDiff.DELETION:
+ case FilePatch2.DELETION:
kind = Differencer.DELETION;
break;
- case FileDiff.CHANGE:
+ case FilePatch2.CHANGE:
kind = Differencer.CHANGE;
break;
default:
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
index 3f8574618..0217db414 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
@@ -28,7 +28,7 @@ import java.util.Set;
import org.eclipse.compare.internal.core.Messages;
import org.eclipse.compare.internal.core.patch.DiffProject;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.FileDiffResult;
import org.eclipse.compare.internal.core.patch.Hunk;
import org.eclipse.compare.internal.core.patch.PatchReader;
@@ -77,7 +77,7 @@ public class Patcher implements IHunkFilter {
// private static final int NORMAL= 2;
// private static final int UNIFIED= 3;
- private FileDiff[] fDiffs;
+ private FilePatch2[] fDiffs;
private IResource fTarget;
// patch options
private Set disabledElements = new HashSet();
@@ -98,13 +98,13 @@ public class Patcher implements IHunkFilter {
* Returns an array of Diffs after a sucessfull call to <code>parse</code>.
* If <code>parse</code> hasn't been called returns <code>null</code>.
*/
- public FileDiff[] getDiffs() {
+ public FilePatch2[] getDiffs() {
if (fDiffs == null)
- return new FileDiff[0];
+ return new FilePatch2[0];
return fDiffs;
}
- public IPath getPath(FileDiff diff) {
+ public IPath getPath(FilePatch2 diff) {
return diff.getStrippedPath(getStripPrefixSegments(), isReversed());
}
@@ -177,9 +177,9 @@ public class Patcher implements IHunkFilter {
public void parse(BufferedReader reader) throws IOException {
PatchReader patchReader = new PatchReader() {
- protected FileDiff createFileDiff(IPath oldPath, long oldDate,
+ protected FilePatch2 createFileDiff(IPath oldPath, long oldDate,
IPath newPath, long newDate) {
- return new FileDiffWrapper(oldPath, oldDate, newPath, newDate);
+ return new FilePatch(oldPath, oldDate, newPath, newDate);
}
};
patchReader.parse(reader);
@@ -191,11 +191,11 @@ public class Patcher implements IHunkFilter {
}
public void countLines() {
- FileDiff[] fileDiffs = getDiffs();
+ FilePatch2[] fileDiffs = getDiffs();
for (int i = 0; i < fileDiffs.length; i++) {
int addedLines = 0;
int removedLines = 0;
- FileDiff fileDiff = fileDiffs[i];
+ FilePatch2 fileDiff = fileDiffs[i];
for (int j = 0; j < fileDiff.getHunkCount(); j++) {
IHunk hunk = fileDiff.getHunks()[j];
String[] lines = ((Hunk) hunk).getLines();
@@ -239,10 +239,10 @@ public class Patcher implements IHunkFilter {
list.add(singleFile);
else {
for (i= 0; i < fDiffs.length; i++) {
- FileDiff diff= fDiffs[i];
+ FilePatch2 diff= fDiffs[i];
if (isEnabled(diff)) {
switch (diff.getDiffType(isReversed())) {
- case FileDiff.CHANGE:
+ case FilePatch2.CHANGE:
list.add(createPath(container, getPath(diff)));
break;
}
@@ -263,7 +263,7 @@ public class Patcher implements IHunkFilter {
int workTicks= WORK_UNIT;
- FileDiff diff= fDiffs[i];
+ FilePatch2 diff= fDiffs[i];
if (isEnabled(diff)) {
IPath path= getPath(diff);
@@ -278,18 +278,18 @@ public class Patcher implements IHunkFilter {
int type= diff.getDiffType(isReversed());
switch (type) {
- case FileDiff.ADDITION:
+ case FilePatch2.ADDITION:
// patch it and collect rejected hunks
List result= apply(diff, file, true, failed);
if (result != null)
store(LineReader.createString(isPreserveLineDelimeters(), result), file, new SubProgressMonitor(pm, workTicks));
workTicks-= WORK_UNIT;
break;
- case FileDiff.DELETION:
+ case FilePatch2.DELETION:
file.delete(true, true, new SubProgressMonitor(pm, workTicks));
workTicks-= WORK_UNIT;
break;
- case FileDiff.CHANGE:
+ case FilePatch2.CHANGE:
// patch it and collect rejected hunks
result= apply(diff, file, false, failed);
if (result != null)
@@ -333,7 +333,7 @@ public class Patcher implements IHunkFilter {
return pp;
}
- List apply(FileDiff diff, IFile file, boolean create, List failedHunks) {
+ List apply(FilePatch2 diff, IFile file, boolean create, List failedHunks) {
FileDiffResult result = getDiffResult(diff);
List lines = LineReader.load(file, create);
result.patch(lines, null);
@@ -437,7 +437,7 @@ public class Patcher implements IHunkFilter {
}
- public IFile getTargetFile(FileDiff diff) {
+ public IFile getTargetFile(FilePatch2 diff) {
IPath path = diff.getStrippedPath(getStripPrefixSegments(), isReversed());
return existsInTarget(path);
}
@@ -481,21 +481,21 @@ public class Patcher implements IHunkFilter {
int length= 99;
if (fDiffs!=null)
for (int i= 0; i<fDiffs.length; i++) {
- FileDiff diff= fDiffs[i];
+ FilePatch2 diff= fDiffs[i];
length= Math.min(length, diff.segmentCount());
}
return length;
}
- public void addDiff(FileDiff newDiff){
- FileDiff[] temp = new FileDiff[fDiffs.length + 1];
+ public void addDiff(FilePatch2 newDiff){
+ FilePatch2[] temp = new FilePatch2[fDiffs.length + 1];
System.arraycopy(fDiffs,0, temp, 0, fDiffs.length);
temp[fDiffs.length] = newDiff;
fDiffs = temp;
}
- public void removeDiff(FileDiff diffToRemove){
- FileDiff[] temp = new FileDiff[fDiffs.length - 1];
+ public void removeDiff(FilePatch2 diffToRemove){
+ FilePatch2[] temp = new FilePatch2[fDiffs.length - 1];
int counter = 0;
for (int i = 0; i < fDiffs.length; i++) {
if (fDiffs[i] != diffToRemove){
@@ -508,20 +508,20 @@ public class Patcher implements IHunkFilter {
public void setEnabled(Object element, boolean enabled) {
if (element instanceof DiffProject)
setEnabledProject((DiffProject) element, enabled);
- if (element instanceof FileDiff)
- setEnabledFile((FileDiff)element, enabled);
+ if (element instanceof FilePatch2)
+ setEnabledFile((FilePatch2)element, enabled);
if (element instanceof Hunk)
setEnabledHunk((Hunk) element, enabled);
}
private void setEnabledProject(DiffProject projectDiff, boolean enabled) {
- FileDiff[] diffFiles = projectDiff.getFileDiffs();
+ FilePatch2[] diffFiles = projectDiff.getFileDiffs();
for (int i = 0; i < diffFiles.length; i++) {
setEnabledFile(diffFiles[i], enabled);
}
}
- private void setEnabledFile(FileDiff fileDiff, boolean enabled) {
+ private void setEnabledFile(FilePatch2 fileDiff, boolean enabled) {
IHunk[] hunks = fileDiff.getHunks();
for (int i = 0; i < hunks.length; i++) {
setEnabledHunk((Hunk) hunks[i], enabled);
@@ -531,14 +531,14 @@ public class Patcher implements IHunkFilter {
private void setEnabledHunk(Hunk hunk, boolean enabled) {
if (enabled) {
disabledElements.remove(hunk);
- FileDiff file = hunk.getParent();
+ FilePatch2 file = hunk.getParent();
disabledElements.remove(file);
DiffProject project = file.getProject();
if (project != null)
disabledElements.remove(project);
} else {
disabledElements.add(hunk);
- FileDiff file = hunk.getParent();
+ FilePatch2 file = hunk.getParent();
if (disabledElements.containsAll(Arrays.asList(file.getHunks()))) {
disabledElements.add(file);
DiffProject project = file.getProject();
@@ -575,12 +575,12 @@ public class Patcher implements IHunkFilter {
public int guessFuzzFactor(IProgressMonitor monitor) {
try {
monitor.beginTask(Messages.Patcher_2, IProgressMonitor.UNKNOWN);
- FileDiff[] diffs= getDiffs();
+ FilePatch2[] diffs= getDiffs();
if (diffs==null||diffs.length<=0)
return -1;
int fuzz= -1;
for (int i= 0; i<diffs.length; i++) {
- FileDiff d= diffs[i];
+ FilePatch2 d= diffs[i];
IFile file= getTargetFile(d);
if (file != null && file.exists()) {
List lines= LineReader.load(file, false);
@@ -601,15 +601,15 @@ public class Patcher implements IHunkFilter {
refresh(getDiffs());
}
- protected void refresh(FileDiff[] diffs) {
+ protected void refresh(FilePatch2[] diffs) {
for (int i = 0; i < diffs.length; i++) {
- FileDiff diff = diffs[i];
+ FilePatch2 diff = diffs[i];
FileDiffResult result = getDiffResult(diff);
((WorkspaceFileDiffResult)result).refresh();
}
}
- public FileDiffResult getDiffResult(FileDiff diff) {
+ public FileDiffResult getDiffResult(FilePatch2 diff) {
FileDiffResult result = (FileDiffResult)diffResults.get(diff);
if (result == null) {
result = new WorkspaceFileDiffResult(diff, getConfiguration());
@@ -628,7 +628,7 @@ public class Patcher implements IHunkFilter {
* @param diff the diff
* @return the project that contains the diff
*/
- public DiffProject getProject(FileDiff diff) {
+ public DiffProject getProject(FilePatch2 diff) {
return diff.getProject();
}
@@ -656,7 +656,7 @@ public class Patcher implements IHunkFilter {
* @param diff the file diff
* @param contents the contents for the file diff
*/
- public void cacheContents(FileDiff diff, byte[] contents) {
+ public void cacheContents(FilePatch2 diff, byte[] contents) {
contentCache.put(diff, contents);
}
@@ -665,9 +665,9 @@ public class Patcher implements IHunkFilter {
* given file diff.
* @param diff the file diff
* @return whether contents have been cached for the file diff
- * @see #cacheContents(FileDiff, byte[])
+ * @see #cacheContents(FilePatch2, byte[])
*/
- public boolean hasCachedContents(FileDiff diff) {
+ public boolean hasCachedContents(FilePatch2 diff) {
return contentCache.containsKey(diff);
}
@@ -677,7 +677,7 @@ public class Patcher implements IHunkFilter {
* @param diff the file diff
* @return the content lines that are cached for the file diff
*/
- public List getCachedLines(FileDiff diff) {
+ public List getCachedLines(FilePatch2 diff) {
byte[] contents = (byte[])contentCache.get(diff);
if (contents != null) {
BufferedReader reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(contents)));
@@ -693,7 +693,7 @@ public class Patcher implements IHunkFilter {
* @return the contents that are cached for the given diff or
* <code>null</code>
*/
- public byte[] getCachedContents(FileDiff diff) {
+ public byte[] getCachedContents(FilePatch2 diff) {
return (byte[])contentCache.get(diff);
}
@@ -732,7 +732,7 @@ public class Patcher implements IHunkFilter {
mergedHunks.remove(hunk);
}
- public IProject getTargetProject(FileDiff diff) {
+ public IProject getTargetProject(FilePatch2 diff) {
DiffProject dp = getProject(diff);
if (dp != null)
return Utilities.getProject(dp);
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java
index 49db581a9..c28684f2b 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java
@@ -19,7 +19,7 @@ import org.eclipse.compare.CompareUI;
import org.eclipse.compare.internal.ComparePreferencePage;
import org.eclipse.compare.internal.CompareUIPlugin;
import org.eclipse.compare.internal.ICompareUIConstants;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.Hunk;
import org.eclipse.compare.patch.IHunk;
import org.eclipse.core.runtime.Assert;
@@ -705,7 +705,7 @@ public class PreviewPatchPage2 extends WizardPage {
&& (removedLinesRegex == null || "".equals(removedLinesRegex))) { //$NON-NLS-1$
fPatcher.countLines();
- FileDiff[] fileDiffs = fPatcher.getDiffs();
+ FilePatch2[] fileDiffs = fPatcher.getDiffs();
for (int i = 0; i < fileDiffs.length; i++) {
added += fileDiffs[i].getAddedLines();
removed += fileDiffs[i].getRemovedLines();
@@ -716,7 +716,7 @@ public class PreviewPatchPage2 extends WizardPage {
Pattern addedPattern = Pattern.compile(addedLinesRegex);
Pattern removedPattern = Pattern.compile(removedLinesRegex);
- FileDiff[] fileDiffs = fPatcher.getDiffs();
+ FilePatch2[] fileDiffs = fPatcher.getDiffs();
for (int i = 0; i < fileDiffs.length; i++) {
IHunk[] hunks = fileDiffs[i].getHunks();
for (int j = 0; j < hunks.length; j++) {
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java
index 3a515616f..3efc37027 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java
@@ -13,7 +13,7 @@ package org.eclipse.compare.internal.patch;
import java.util.ArrayList;
import org.eclipse.compare.internal.core.patch.DiffProject;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.Hunk;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.Assert;
@@ -148,7 +148,7 @@ class RetargetPatchElementDialog extends Dialog {
} else if (fSelectedNode instanceof PatchFileDiffNode) {
PatchFileDiffNode node = (PatchFileDiffNode) fSelectedNode;
//copy over all hunks to new target resource
- FileDiff diff = node.getDiffResult().getDiff();
+ FilePatch2 diff = node.getDiffResult().getDiff();
return NLS.bind(PatchMessages.RetargetPatchElementDialog_0, fPatcher.getPath(diff));
} else if (fSelectedNode instanceof HunkDiffNode) {
HunkDiffNode node = (HunkDiffNode) fSelectedNode;
@@ -167,7 +167,7 @@ class RetargetPatchElementDialog extends Dialog {
} else if (fSelectedNode instanceof PatchFileDiffNode && fSelectedResource instanceof IFile) {
PatchFileDiffNode node = (PatchFileDiffNode) fSelectedNode;
//copy over all hunks to new target resource
- FileDiff diff = node.getDiffResult().getDiff();
+ FilePatch2 diff = node.getDiffResult().getDiff();
fPatcher.retargetDiff(diff, (IFile)fSelectedResource);
} else if (fSelectedNode instanceof HunkDiffNode && fSelectedResource instanceof IFile) {
HunkDiffNode node = (HunkDiffNode) fSelectedNode;
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/UnmatchedHunkTypedElement.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/UnmatchedHunkTypedElement.java
index e0e33b62e..09eb69c83 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/UnmatchedHunkTypedElement.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/UnmatchedHunkTypedElement.java
@@ -21,7 +21,7 @@ import org.eclipse.compare.IEditableContent;
import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.internal.CompareUIPlugin;
import org.eclipse.compare.internal.ContentChangeNotifier;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.HunkResult;
import org.eclipse.compare.patch.PatchConfiguration;
import org.eclipse.core.resources.IFile;
@@ -79,7 +79,7 @@ public class UnmatchedHunkTypedElement extends HunkTypedElement implements ICont
changeNotifier.fireContentChanged();
}
- private FileDiff getDiff() {
+ private FilePatch2 getDiff() {
return getHunkResult().getDiffResult().getDiff();
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java
index abaaa48cb..81711f1ea 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java
@@ -12,7 +12,7 @@ package org.eclipse.compare.internal.patch;
import java.util.List;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.FileDiffResult;
import org.eclipse.compare.patch.PatchConfiguration;
import org.eclipse.core.resources.IFile;
@@ -21,7 +21,7 @@ import org.eclipse.core.resources.IStorage;
public class WorkspaceFileDiffResult extends FileDiffResult {
- public WorkspaceFileDiffResult(FileDiff diff,
+ public WorkspaceFileDiffResult(FilePatch2 diff,
PatchConfiguration configuration) {
super(diff, configuration);
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java
index 4bed69672..0699d116c 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java
@@ -18,7 +18,7 @@ import java.util.Map;
import org.eclipse.compare.internal.core.Messages;
import org.eclipse.compare.internal.core.patch.DiffProject;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.Hunk;
import org.eclipse.compare.internal.core.patch.PatchReader;
import org.eclipse.compare.patch.IHunk;
@@ -91,7 +91,7 @@ public class WorkspacePatcher extends Patcher {
return;
}
- FileDiff[] diffs = getDiffs();
+ FilePatch2[] diffs = getDiffs();
if (pm != null) {
String message= Messages.WorkspacePatcher_0;
pm.beginTask(message, diffs.length * WORK_UNIT);
@@ -101,7 +101,7 @@ public class WorkspacePatcher extends Patcher {
int workTicks= WORK_UNIT;
- FileDiff diff= diffs[i];
+ FilePatch2 diff= diffs[i];
if (isAccessible(diff)) {
IFile file= getTargetFile(diff);
IPath path= file.getProjectRelativePath();
@@ -113,18 +113,18 @@ public class WorkspacePatcher extends Patcher {
int type= diff.getDiffType(isReversed());
switch (type) {
- case FileDiff.ADDITION :
+ case FilePatch2.ADDITION :
// patch it and collect rejected hunks
List result= apply(diff, file, true, failed);
if (result != null)
store(LineReader.createString(isPreserveLineDelimeters(), result), file, new SubProgressMonitor(pm, workTicks));
workTicks -= WORK_UNIT;
break;
- case FileDiff.DELETION :
+ case FilePatch2.DELETION :
file.delete(true, true, new SubProgressMonitor(pm, workTicks));
workTicks -= WORK_UNIT;
break;
- case FileDiff.CHANGE :
+ case FilePatch2.CHANGE :
// patch it and collect rejected hunks
result= apply(diff, file, false, failed);
if (result != null)
@@ -164,7 +164,7 @@ public class WorkspacePatcher extends Patcher {
}
}
- private boolean isAccessible(FileDiff diff) {
+ private boolean isAccessible(FilePatch2 diff) {
return isEnabled(diff) && Utilities.getProject(diff.getProject()).isAccessible();
}
@@ -176,9 +176,9 @@ public class WorkspacePatcher extends Patcher {
*/
public IFile[] getTargetFiles(DiffProject project) {
List files= new ArrayList();
- FileDiff[] diffs = project.getFileDiffs();
+ FilePatch2[] diffs = project.getFileDiffs();
for (int i = 0; i < diffs.length; i++) {
- FileDiff diff = diffs[i];
+ FilePatch2 diff = diffs[i];
if (isEnabled(diff)) {
files.add(getTargetFile(diff));
}
@@ -186,7 +186,7 @@ public class WorkspacePatcher extends Patcher {
return (IFile[]) files.toArray(new IFile[files.size()]);
}
- public IFile getTargetFile(FileDiff diff) {
+ public IFile getTargetFile(FilePatch2 diff) {
IPath path = diff.getStrippedPath(getStripPrefixSegments(), isReversed());
DiffProject project = getProject(diff);
if (project != null)
@@ -194,7 +194,7 @@ public class WorkspacePatcher extends Patcher {
return super.getTargetFile(diff);
}
- private IPath getFullPath(FileDiff diff) {
+ private IPath getFullPath(FilePatch2 diff) {
IPath path = diff.getStrippedPath(getStripPrefixSegments(), isReversed());
DiffProject project = getProject(diff);
if (project != null)
@@ -238,8 +238,8 @@ public class WorkspacePatcher extends Patcher {
}
protected Object getElementParent(Object element) {
- if (element instanceof FileDiff && fDiffProjects != null) {
- FileDiff diff = (FileDiff) element;
+ if (element instanceof FilePatch2 && fDiffProjects != null) {
+ FilePatch2 diff = (FilePatch2) element;
for (int i = 0; i < fDiffProjects.length; i++) {
DiffProject project = fDiffProjects[i];
if (project.contains(diff))
@@ -257,7 +257,7 @@ public class WorkspacePatcher extends Patcher {
return (IPath)retargetedDiffs.get(object);
}
- public void retargetDiff(FileDiff diff, IFile file) {
+ public void retargetDiff(FilePatch2 diff, IFile file) {
retargetedDiffs.put(diff, diff.getPath(false));
IHunk[] hunks = diff.getHunks();
@@ -266,16 +266,16 @@ public class WorkspacePatcher extends Patcher {
diff.getProject().remove(diff);
}
removeDiff(diff);
- FileDiff newDiff = getDiffForFile(file);
+ FilePatch2 newDiff = getDiffForFile(file);
for (int i = 0; i < hunks.length; i++) {
Hunk hunk = (Hunk) hunks[i];
newDiff.add(hunk);
}
}
- private FileDiff getDiffForFile(IFile file) {
+ private FilePatch2 getDiffForFile(IFile file) {
DiffProject diffProject = null;
- FileDiff[] diffsToCheck;
+ FilePatch2[] diffsToCheck;
if (isWorkspacePatch()){
// Check if the diff project already exists for the file
IProject project = file.getProject();
@@ -296,7 +296,7 @@ public class WorkspacePatcher extends Patcher {
}
// Check to see if a diff already exists for the file
for (int i = 0; i < diffsToCheck.length; i++) {
- FileDiff fileDiff = diffsToCheck[i];
+ FilePatch2 fileDiff = diffsToCheck[i];
if (isDiffForFile(fileDiff, file)) {
return fileDiff;
}
@@ -304,7 +304,7 @@ public class WorkspacePatcher extends Patcher {
// Create a new diff for the file
IPath path = getDiffPath(file);
- FileDiff newDiff = new FileDiff(path, 0, path, 0);
+ FilePatch2 newDiff = new FilePatch2(path, 0, path, 0);
if (diffProject != null){
diffProject.add(newDiff);
}
@@ -320,7 +320,7 @@ public class WorkspacePatcher extends Patcher {
return file.getFullPath().removeFirstSegments(getTarget().getFullPath().segmentCount());
}
- private boolean isDiffForFile(FileDiff fileDiff, IFile file) {
+ private boolean isDiffForFile(FilePatch2 fileDiff, IFile file) {
return getFullPath(fileDiff).equals(file.getFullPath());
}
@@ -335,13 +335,13 @@ public class WorkspacePatcher extends Patcher {
}
public void retargetHunk(Hunk hunk, IFile file) {
- FileDiff newDiff = getDiffForFile(file);
+ FilePatch2 newDiff = getDiffForFile(file);
newDiff.add(hunk);
}
public void retargetProject(DiffProject project, IProject targetProject) {
retargetedDiffs.put(project, Utilities.getProject(project).getFullPath());
- FileDiff[] diffs = project.getFileDiffs();
+ FilePatch2[] diffs = project.getFileDiffs();
DiffProject selectedProject = getDiffProject(targetProject);
if (selectedProject == null)
selectedProject = addDiffProjectForProject(targetProject);
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java
index 19ab83c53..0ce507cbb 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java
@@ -16,9 +16,9 @@ import java.io.IOException;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.internal.ComparePreferencePage;
import org.eclipse.compare.internal.CompareUIPlugin;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.PatchReader;
-import org.eclipse.compare.internal.patch.FileDiffWrapper;
+import org.eclipse.compare.internal.patch.FilePatch;
import org.eclipse.compare.internal.patch.PatchWizard;
import org.eclipse.compare.internal.patch.PatchWizardDialog;
import org.eclipse.compare.internal.patch.Utilities;
@@ -206,18 +206,18 @@ public class ApplyPatchOperation implements Runnable {
BufferedReader reader = Utilities.createReader(storage);
try {
PatchReader patchReader = new PatchReader() {
- protected FileDiff createFileDiff(IPath oldPath, long oldDate,
+ protected FilePatch2 createFileDiff(IPath oldPath, long oldDate,
IPath newPath, long newDate) {
- return new FileDiffWrapper(oldPath, oldDate, newPath,
+ return new FilePatch(oldPath, oldDate, newPath,
newDate);
}
};
patchReader.parse(reader);
- FileDiff[] fileDiffs = patchReader.getAdjustedDiffs();
+ FilePatch2[] fileDiffs = patchReader.getAdjustedDiffs();
IFilePatch[] filePatch = new IFilePatch[fileDiffs.length];
for (int i = 0; i < fileDiffs.length; i++) {
- filePatch[i] = (FileDiffWrapper) fileDiffs[i];
+ filePatch[i] = (FilePatch) fileDiffs[i];
}
return filePatch;
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/FileDiffResultTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/FileDiffResultTest.java
index aba379831..e0d2db849 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/FileDiffResultTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/FileDiffResultTest.java
@@ -18,7 +18,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import org.eclipse.compare.internal.Utilities;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.FileDiffResult;
import org.eclipse.compare.internal.core.patch.Hunk;
import org.eclipse.compare.internal.patch.Patcher;
@@ -216,7 +216,7 @@ public class FileDiffResultTest extends WorkspaceTest {
/**
* A mock FileDiff class.
*/
- private class MyFileDiff extends FileDiff {
+ private class MyFileDiff extends FilePatch2 {
protected MyFileDiff() {
super(null, 0, null, 0);
add(Hunk.createHunk(this, new int[] { 0, 0 }, new int[] { 0, 0 },
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java
index db17b2189..615df7752 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java
@@ -36,7 +36,7 @@ import junit.framework.Assert;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
-import org.eclipse.compare.internal.core.patch.FileDiff;
+import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.FileDiffResult;
import org.eclipse.compare.internal.core.patch.LineReader;
import org.eclipse.compare.internal.patch.WorkspacePatcher;
@@ -456,7 +456,7 @@ public class PatchTest extends TestCase {
e.printStackTrace();
}
- FileDiff[] diffs= patcher.getDiffs();
+ FilePatch2[] diffs= patcher.getDiffs();
Assert.assertEquals(diffs.length, 1);
FileDiffResult diffResult = patcher.getDiffResult(diffs[0]);
@@ -513,7 +513,7 @@ public class PatchTest extends TestCase {
}
//Sort the diffs by project
- FileDiff[] diffs= patcher.getDiffs();
+ FilePatch2[] diffs= patcher.getDiffs();
//Iterate through all of the original files, apply the diffs that belong to the file and compare
//with the corresponding outcome file

Back to the top