Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2002-05-31 10:49:40 +0000
committerAndre Weinand2002-05-31 10:49:40 +0000
commit2a2a256fd5b8a493d5fdbf77949fe520745dc483 (patch)
treea03dd42aba1d3dc48a08c98d14a3d7c85338066d /bundles/org.eclipse.compare
parent8cec04f242ab6c521aabf09b08a3debf1951f9e4 (diff)
downloadeclipse.platform.team-2a2a256fd5b8a493d5fdbf77949fe520745dc483.tar.gz
eclipse.platform.team-2a2a256fd5b8a493d5fdbf77949fe520745dc483.tar.xz
eclipse.platform.team-2a2a256fd5b8a493d5fdbf77949fe520745dc483.zip
#13190: Compare with Patch does not apply Patch, if single file selectedv20020531
Diffstat (limited to 'bundles/org.eclipse.compare')
-rw-r--r--bundles/org.eclipse.compare/buildnotes_compare.html1
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java21
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html1
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java21
4 files changed, 30 insertions, 14 deletions
diff --git a/bundles/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/buildnotes_compare.html
index 5486b657f..6cfc71800 100644
--- a/bundles/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/buildnotes_compare.html
@@ -31,6 +31,7 @@ Known deficiencies</h2>
<h2>
Problem reports fixed</h2>
<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18116">#18116</a>: Compare view does not inherit Java editor background color<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13190">#13190</a>: Compare with Patch does not apply Patch, if single file selected<br>
<h2>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java
index 783594ac6..14eabc943 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java
@@ -380,14 +380,8 @@ import org.eclipse.compare.structuremergeviewer.*;
IResource target= fPatchWizard.getTarget();
if (target instanceof IFile) {
IFile file= (IFile) target;
- IPath path2= file.getFullPath().removeFirstSegments(1);
- //System.out.println("target: " + path2.toOSString());
- //System.out.println(" path: " + path.toOSString());
- if (path.equals(path2))
+ if (matches(file.getFullPath(), path))
return file;
-// String name= file.getName();
-// if (path.lastSegment().equals(name))
-// return file;
} else if (target instanceof IContainer) {
IContainer c= (IContainer) target;
if (c.exists(path))
@@ -397,6 +391,19 @@ import org.eclipse.compare.structuremergeviewer.*;
}
/**
+ * Returns true if path completely matches the end of fullpath
+ */
+ private boolean matches(IPath fullpath, IPath path) {
+
+ for (IPath p= fullpath; path.segmentCount() <= p.segmentCount();
+ p= p.removeFirstSegments(1)) {
+ if (p.equals(path))
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Updates label and checked state of tree items.
*/
private void updateTree() {
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
index 5486b657f..6cfc71800 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
@@ -31,6 +31,7 @@ Known deficiencies</h2>
<h2>
Problem reports fixed</h2>
<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18116">#18116</a>: Compare view does not inherit Java editor background color<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13190">#13190</a>: Compare with Patch does not apply Patch, if single file selected<br>
<h2>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java
index 783594ac6..14eabc943 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage.java
@@ -380,14 +380,8 @@ import org.eclipse.compare.structuremergeviewer.*;
IResource target= fPatchWizard.getTarget();
if (target instanceof IFile) {
IFile file= (IFile) target;
- IPath path2= file.getFullPath().removeFirstSegments(1);
- //System.out.println("target: " + path2.toOSString());
- //System.out.println(" path: " + path.toOSString());
- if (path.equals(path2))
+ if (matches(file.getFullPath(), path))
return file;
-// String name= file.getName();
-// if (path.lastSegment().equals(name))
-// return file;
} else if (target instanceof IContainer) {
IContainer c= (IContainer) target;
if (c.exists(path))
@@ -397,6 +391,19 @@ import org.eclipse.compare.structuremergeviewer.*;
}
/**
+ * Returns true if path completely matches the end of fullpath
+ */
+ private boolean matches(IPath fullpath, IPath path) {
+
+ for (IPath p= fullpath; path.segmentCount() <= p.segmentCount();
+ p= p.removeFirstSegments(1)) {
+ if (p.equals(path))
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Updates label and checked state of tree items.
*/
private void updateTree() {

Back to the top