Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2001-07-23 11:11:17 -0400
committerAndre Weinand2001-07-23 11:11:17 -0400
commitd79cb6c6d6cf3d813fc3d1c3d197de551123a133 (patch)
treed0c07a2122a85aa2d0ea5cf22deabfd95e19fd19 /bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer
parentbb7c6283de459b000f603c3f2164740e34a7a8e2 (diff)
downloadeclipse.platform.team-d79cb6c6d6cf3d813fc3d1c3d197de551123a133.tar.gz
eclipse.platform.team-d79cb6c6d6cf3d813fc3d1c3d197de551123a133.tar.xz
eclipse.platform.team-d79cb6c6d6cf3d813fc3d1c3d197de551123a133.zip
input for R0.9 NL
Diffstat (limited to 'bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java25
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties9
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java30
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java13
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java13
6 files changed, 54 insertions, 48 deletions
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 9ffd3b18c..a25a0033f 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
@@ -4,11 +4,14 @@
*/
package org.eclipse.compare.structuremergeviewer;
+import java.text.MessageFormat;
+
import org.eclipse.swt.graphics.Image;
import org.eclipse.jface.util.ListenerList;
import org.eclipse.compare.*;
+import org.eclipse.compare.internal.Utilities;
/**
* Diff node are used as the compare result of the differencing engine.
@@ -187,7 +190,7 @@ public class DiffNode extends DiffContainer implements ITypedElement, ICompareIn
if (s1 == null && s2 == null) {
if (fAncestor != null)
return fAncestor.getName();
- return "<no name>";
+ return Utilities.getString("DiffNode.noName"); //$NON-NLS-1$
}
if (s1 == null)
@@ -197,10 +200,9 @@ public class DiffNode extends DiffContainer implements ITypedElement, ICompareIn
if (s1.equals(s2))
return s1;
- StringBuffer sb= new StringBuffer(s1);
- sb.append(" / ");
- sb.append(s2);
- return sb.toString();
+
+ String fmt= Utilities.getString("DiffNode.nameFormat"); //$NON-NLS-1$
+ return MessageFormat.format(fmt, new String[] { s1, s2 });
}
/* (non Javadoc)
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 cdb8d5f5a..9096c3dde 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
@@ -91,7 +91,7 @@ public class DiffTreeViewer extends TreeViewer {
public String getText(Object element) {
if (element instanceof IDiffElement)
return ((IDiffElement)element).getName();
- return "<null>";
+ return Utilities.getString(fBundle, "defaultLabel"); //$NON-NLS-1$
}
public Image getImage(Object element) {
@@ -174,14 +174,14 @@ public class DiffTreeViewer extends TreeViewer {
};
tree.setData(INavigatable.NAVIGATOR_PROPERTY, nav);
- fLeftIsLocal= Utilities.getBoolean(configuration, "LEFT_IS_LOCAL", false);
+ fLeftIsLocal= Utilities.getBoolean(configuration, "LEFT_IS_LOCAL", false); //$NON-NLS-1$
tree.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle());
Composite parent= tree.getParent();
- fBundle= ResourceBundle.getBundle("org.eclipse.compare.structuremergeviewer.DiffTreeViewerResources");
+ fBundle= ResourceBundle.getBundle("org.eclipse.compare.structuremergeviewer.DiffTreeViewerResources"); //$NON-NLS-1$
// register for notification with the CompareConfiguration
fCompareConfiguration= configuration;
@@ -225,9 +225,9 @@ public class DiffTreeViewer extends TreeViewer {
if (tbm != null) {
tbm.removeAll();
- tbm.add(new Separator("merge"));
- tbm.add(new Separator("modes"));
- tbm.add(new Separator("navigation"));
+ tbm.add(new Separator("merge")); //$NON-NLS-1$
+ tbm.add(new Separator("modes")); //$NON-NLS-1$
+ tbm.add(new Separator("navigation")); //$NON-NLS-1$
createToolItems(tbm);
updateActions();
@@ -253,7 +253,10 @@ public class DiffTreeViewer extends TreeViewer {
* @return the viewer's name
*/
public String getTitle() {
- return "Structure Compare";
+ String title= Utilities.getString(fBundle, "title", null); //$NON-NLS-1$
+ if (title == null)
+ title= Utilities.getString("DiffTreeViewer.title"); //$NON-NLS-1$
+ return title;
}
/**
@@ -373,16 +376,16 @@ public class DiffTreeViewer extends TreeViewer {
navigate(true);
}
};
- Utilities.initAction(fNextAction, fBundle, "action.NextDiff.");
- toolbarManager.appendToGroup("navigation", fNextAction);
+ Utilities.initAction(fNextAction, fBundle, "action.NextDiff."); //$NON-NLS-1$
+ toolbarManager.appendToGroup("navigation", fNextAction); //$NON-NLS-1$
fPreviousAction= new Action() {
public void run() {
navigate(false);
}
};
- Utilities.initAction(fPreviousAction, fBundle, "action.PrevDiff.");
- toolbarManager.appendToGroup("navigation", fPreviousAction);
+ Utilities.initAction(fPreviousAction, fBundle, "action.PrevDiff."); //$NON-NLS-1$
+ toolbarManager.appendToGroup("navigation", fPreviousAction); //$NON-NLS-1$
}
/**
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
index 3f4cceff9..5c6c17952 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties
@@ -7,9 +7,8 @@
#
# Resource strings for DiffTreeViewer.java
-#####################################################
-# Images
-#####################################################
+title= Structure Compare
+defaultLabel= <no name>
#####################################################
# Status messages
@@ -27,10 +26,6 @@ action.Smart.label=Smart
action.Smart.tooltip=Try to Guess Corresponding Elements
action.Smart.image=smartmode_co.gif
-#action.FilterSame.label=Show Pseudo Conflicts
-#action.FilterSame.tooltip=Show Pseudo Conflicts
-#action.FilterSame.image=showpseudoconflicts.gif
-
action.NextDiff.label=Next
action.NextDiff.tooltip=Select Next Change
action.NextDiff.image=next_nav.gif
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
index acc290a68..bf90c2d58 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
@@ -6,6 +6,7 @@ package org.eclipse.compare.structuremergeviewer;
import java.io.*;
import java.util.*;
+import java.text.MessageFormat;
import org.eclipse.jface.util.Assert;
@@ -14,6 +15,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.compare.*;
+import org.eclipse.compare.internal.Utilities;
/**
@@ -139,39 +141,39 @@ public class Differencer {
if (name == null && fRight instanceof ITypedElement)
name= ((ITypedElement)fRight).getName();
if (name == null)
- name= "???";
+ name= "???"; //$NON-NLS-1$
for (int i= 0; i < level; i++)
- System.out.print(" ");
+ System.out.print(" "); //$NON-NLS-1$
System.out.println(getDiffType(fCode) + name);
}
private String getDiffType(int code) {
- String dir= " ";
+ String dir= " "; //$NON-NLS-1$
switch (code & DIRECTION_MASK) {
case LEFT:
- dir= ">";
+ dir= ">"; //$NON-NLS-1$
break;
case RIGHT:
- dir= "<";
+ dir= "<"; //$NON-NLS-1$
break;
case CONFLICTING:
- dir= "!";
+ dir= "!"; //$NON-NLS-1$
break;
}
- String change= "=";
+ String change= "="; //$NON-NLS-1$
switch (code & CHANGE_TYPE_MASK) {
case ADDITION:
- change= "+";
+ change= "+"; //$NON-NLS-1$
break;
case DELETION:
- change= "-";
+ change= "-"; //$NON-NLS-1$
break;
case CHANGE:
- change= "#";
+ change= "#"; //$NON-NLS-1$
break;
}
- return dir + change + " ";
+ return dir + change + " "; //$NON-NLS-1$
}
}
@@ -274,7 +276,7 @@ public class Differencer {
if (pm != null) {
if (pm.isCanceled())
- throw new OperationCanceledException("Compare cancelled");
+ throw new OperationCanceledException();
updateProgress(pm, keyChild);
}
@@ -505,7 +507,9 @@ public class Differencer {
protected void updateProgress(IProgressMonitor progressMonitor, Object node) {
if (node instanceof ITypedElement) {
String name= ((ITypedElement)node).getName();
- progressMonitor.subTask("Comparing " + name);
+ String fmt= Utilities.getString("Differencer.progressFormat"); //$NON-NLS-1$
+ String msg= MessageFormat.format(fmt, new String[] { name });
+ progressMonitor.subTask(msg);
//progressMonitor.worked(1);
}
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java
index dd50c8e05..a5c7b9770 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java
@@ -166,7 +166,7 @@ public class DocumentRangeNode
fBaseDocument.addPosition(p);
fAppendPosition= p;
} catch (BadLocationException ex) {
- System.out.println("setAppendPosition: BadLocationException");
+ // ignore
}
} else {
fAppendPosition= new Position(pos);
@@ -188,7 +188,7 @@ public class DocumentRangeNode
fBaseDocument.addPosition(p);
fAppendPosition= p;
} catch (BadLocationException ex) {
- System.out.println("setAppendPosition: BadLocationException");
+ // ignore
}
} else {
fAppendPosition= new Position(fBaseDocument.getLength());
@@ -220,13 +220,11 @@ public class DocumentRangeNode
*/
private Position findCorrespondingPosition(DocumentRangeNode otherParent, DocumentRangeNode child) {
- //System.out.println("findCorrespondingPosition " + child);
// we try to find a predecessor of left Node which exists on the right side
if (child != null && fChildren != null) {
int ix= otherParent.fChildren.indexOf(child);
if (ix >= 0) {
- //System.out.println(" found at position " + ix);
for (int i= ix - 1; i >= 0; i--) {
DocumentRangeNode c1= (DocumentRangeNode) otherParent.fChildren.get(i);
@@ -273,10 +271,9 @@ public class DocumentRangeNode
Position p= findCorrespondingPosition(parent, child);
if (p != null) {
try {
- //System.out.println("inserting <"+s+"> at " + p.getOffset());
fBaseDocument.replace(p.getOffset(), p.getLength(), s);
} catch (BadLocationException ex) {
- System.out.println("BadLocationException " + ex);
+ // ignore
}
}
}
@@ -289,7 +286,7 @@ public class DocumentRangeNode
try {
s= fBaseDocument.get(fRange.getOffset(), fRange.getLength());
} catch (BadLocationException ex) {
- s= "";
+ s= ""; //$NON-NLS-1$
}
return new ByteArrayInputStream(s.getBytes());
}
@@ -307,7 +304,7 @@ public class DocumentRangeNode
public ITypedElement replace(ITypedElement child, ITypedElement other) {
DocumentRangeNode src= null;
- String srcContents= "";
+ String srcContents= ""; //$NON-NLS-1$
if (other != null) {
src= (DocumentRangeNode) child;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
index 04b5008c4..051fbc589 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
@@ -7,6 +7,7 @@ package org.eclipse.compare.structuremergeviewer;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.jface.util.*;
import org.eclipse.jface.action.ToolBarManager;
@@ -33,7 +34,7 @@ import org.eclipse.compare.internal.*;
*/
public class StructureDiffViewer extends DiffTreeViewer {
- private static final String SMART= "SMART";
+ private static final String SMART= "SMART"; //$NON-NLS-1$
private Differencer fDifferencer;
private boolean fThreeWay= false;
@@ -103,7 +104,11 @@ public class StructureDiffViewer extends DiffTreeViewer {
public void setStructureCreator(IStructureCreator structureCreator) {
if (fStructureCreator != structureCreator) {
fStructureCreator= structureCreator;
-
+
+ Control tree= getControl();
+ if (tree != null && !tree.isDisposed())
+ tree.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle());
+
if (fStructureCreator != null) {
if (fSmartAction != null)
fSmartAction.setEnabled(fStructureCreator.canRewriteTree());
@@ -314,8 +319,8 @@ public class StructureDiffViewer extends DiffTreeViewer {
super.createToolItems(toolBarManager);
- fSmartAction= new ChangePropertyAction(getBundle(), getCompareConfiguration(), "action.Smart.", SMART);
- toolBarManager.appendToGroup("modes", fSmartAction);
+ fSmartAction= new ChangePropertyAction(getBundle(), getCompareConfiguration(), "action.Smart.", SMART); //$NON-NLS-1$
+ toolBarManager.appendToGroup("modes", fSmartAction); //$NON-NLS-1$
}
/**

Back to the top