Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2002-01-11 18:11:58 +0000
committerAndre Weinand2002-01-11 18:11:58 +0000
commit56cd0f822a2a02df5d630699837e1c267254ccef (patch)
treecb5cd0e9de4f27de4b80368d774aaf8b28e08334 /bundles/org.eclipse.compare
parentb90378cabccfb8e770923cb6fc372f4e66163f53 (diff)
downloadeclipse.platform.team-56cd0f822a2a02df5d630699837e1c267254ccef.tar.gz
eclipse.platform.team-56cd0f822a2a02df5d630699837e1c267254ccef.tar.xz
eclipse.platform.team-56cd0f822a2a02df5d630699837e1c267254ccef.zip
optionally flipping sides in DiffNode.getName
Diffstat (limited to 'bundles/org.eclipse.compare')
-rw-r--r--bundles/org.eclipse.compare/buildnotes_compare.html3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java19
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java8
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html3
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java19
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java8
6 files changed, 48 insertions, 12 deletions
diff --git a/bundles/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/buildnotes_compare.html
index 16aca997f..725cf48c3 100644
--- a/bundles/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/buildnotes_compare.html
@@ -15,6 +15,9 @@ Eclipse Build Input January xxx th 2002
<h2>
What's new in this drop</h2>
+Fixed a problem in DiffNode.getName() and the DiffTreeViewer's label provider
+where in certain situations the left and right half of a DiffNode label
+would not match the left and right sides of a corresponding TextMergeViewer.
<h3>
API changes</h3>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
index 7b9ff335d..d5b322afd 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
@@ -178,7 +178,10 @@ public class DiffNode extends DiffContainer implements ITypedElement, ICompareIn
* see ITypedElement.getName
*/
public String getName() {
-
+ return internalGetName(false);
+ }
+
+ String internalGetName(boolean swap) {
String right= null;
if (fRight != null)
right= fRight.getName();
@@ -201,10 +204,18 @@ public class DiffNode extends DiffContainer implements ITypedElement, ICompareIn
if (right.equals(left))
return right;
- String fmt= Utilities.getString("DiffNode.nameFormat"); //$NON-NLS-1$
+ String s1;
+ String s2;
- String s1= right;
- String s2= left;
+ if (swap) {
+ s1= left;
+ s2= right;
+ } else {
+ s1= right;
+ s2= left;
+ }
+
+ String fmt= Utilities.getString("DiffNode.nameFormat"); //$NON-NLS-1$
return MessageFormat.format(fmt, new String[] { s1, s2 });
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
index 1e3b22f7a..cf545282a 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
@@ -93,9 +93,13 @@ public class DiffTreeViewer extends TreeViewer {
class DiffViewerLabelProvider extends LabelProvider {
public String getText(Object element) {
- if (element instanceof IDiffElement) {
+
+ if (element instanceof DiffNode)
+ return ((DiffNode)element).internalGetName(fLeftIsLocal);
+
+ if (element instanceof IDiffElement)
return ((IDiffElement)element).getName();
- }
+
return Utilities.getString(fBundle, "defaultLabel"); //$NON-NLS-1$
}
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 16aca997f..725cf48c3 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
@@ -15,6 +15,9 @@ Eclipse Build Input January xxx th 2002
<h2>
What's new in this drop</h2>
+Fixed a problem in DiffNode.getName() and the DiffTreeViewer's label provider
+where in certain situations the left and right half of a DiffNode label
+would not match the left and right sides of a corresponding TextMergeViewer.
<h3>
API changes</h3>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
index 7b9ff335d..d5b322afd 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
@@ -178,7 +178,10 @@ public class DiffNode extends DiffContainer implements ITypedElement, ICompareIn
* see ITypedElement.getName
*/
public String getName() {
-
+ return internalGetName(false);
+ }
+
+ String internalGetName(boolean swap) {
String right= null;
if (fRight != null)
right= fRight.getName();
@@ -201,10 +204,18 @@ public class DiffNode extends DiffContainer implements ITypedElement, ICompareIn
if (right.equals(left))
return right;
- String fmt= Utilities.getString("DiffNode.nameFormat"); //$NON-NLS-1$
+ String s1;
+ String s2;
- String s1= right;
- String s2= left;
+ if (swap) {
+ s1= left;
+ s2= right;
+ } else {
+ s1= right;
+ s2= left;
+ }
+
+ String fmt= Utilities.getString("DiffNode.nameFormat"); //$NON-NLS-1$
return MessageFormat.format(fmt, new String[] { s1, s2 });
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
index 1e3b22f7a..cf545282a 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java
@@ -93,9 +93,13 @@ public class DiffTreeViewer extends TreeViewer {
class DiffViewerLabelProvider extends LabelProvider {
public String getText(Object element) {
- if (element instanceof IDiffElement) {
+
+ if (element instanceof DiffNode)
+ return ((DiffNode)element).internalGetName(fLeftIsLocal);
+
+ if (element instanceof IDiffElement)
return ((IDiffElement)element).getName();
- }
+
return Utilities.getString(fBundle, "defaultLabel"); //$NON-NLS-1$
}

Back to the top