Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2002-03-12 11:52:12 -0500
committerAndre Weinand2002-03-12 11:52:12 -0500
commit0b9c7481e4d54d92d419cac3237d5a36439d6072 (patch)
treee099aa51da9f31da35d8ee3d45d28ecee49afb1b /bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer
parent36f16f9018c7db7a8cc2f8f2c084d80b0c3f70bd (diff)
downloadeclipse.platform.team-0b9c7481e4d54d92d419cac3237d5a36439d6072.tar.gz
eclipse.platform.team-0b9c7481e4d54d92d419cac3237d5a36439d6072.tar.xz
eclipse.platform.team-0b9c7481e4d54d92d419cac3237d5a36439d6072.zip
structure compare is always on
Diffstat (limited to 'bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewer.java27
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffTreeViewerResources.properties7
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java18
3 files changed, 43 insertions, 9 deletions
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 d5930d835..90a451564 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
@@ -145,6 +145,7 @@ public class DiffTreeViewer extends TreeViewer {
private Action fNextAction;
private Action fPreviousAction;
private Action fEmptyMenuAction;
+ private Action fExpandAllAction;
/**
* Creates a new viewer for the given SWT tree control with the specified configuration.
@@ -411,13 +412,23 @@ public class DiffTreeViewer extends TreeViewer {
/**
* This method is called to add actions to the viewer's context menu.
- * It installs actions for copying one side of a <code>DiffNode</code> to the other side.
+ * It installs actions for expanding tree nodes, copying one side of a <code>DiffNode</code> to the other side.
* Clients can override this method and are free to decide whether they want to call
* the inherited method.
*
* @param manager the menu manager for which to add the actions
*/
protected void fillContextMenu(IMenuManager manager) {
+ if (fExpandAllAction == null) {
+ fExpandAllAction= new Action() {
+ public void run() {
+ expandSelection();
+ }
+ };
+ Utilities.initAction(fExpandAllAction, fBundle, "action.ExpandAll."); //$NON-NLS-1$
+ }
+ manager.add(fExpandAllAction);
+
if (fCopyLeftToRightAction != null)
manager.add(fCopyLeftToRightAction);
if (fCopyRightToLeftAction != null)
@@ -425,6 +436,20 @@ public class DiffTreeViewer extends TreeViewer {
}
/**
+ * Expands to infinity all items in the selection.
+ */
+ protected void expandSelection() {
+ ISelection selection= getSelection();
+ if (selection instanceof IStructuredSelection) {
+ Iterator elements= ((IStructuredSelection)selection).iterator();
+ while (elements.hasNext()) {
+ Object next= elements.next();
+ expandToLevel(next, ALL_LEVELS);
+ }
+ }
+ }
+
+ /**
* Copies one side of all <code>DiffNode</code>s in the current selection to the other side.
* Called from the (internal) actions for copying the sides of a <code>DiffNode</code>.
* Clients may override.
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 9a91be426..9fc63b64b 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
@@ -21,9 +21,12 @@ emptyMenuItem= <Empty Menu>
#####################################################
action.Smart.label=Smart
-action.Smart.tooltip=Try to Guess Corresponding Elements
+action.Smart.tooltip=Try to Guess Similar Elements
action.Smart.image=smartmode_co.gif
+action.ExpandAll.label=Expand All
+action.ExpandAll.tooltip=Expand All Nodes
+
action.NextDiff.label=Next
action.NextDiff.tooltip=Select Next Change
action.NextDiff.image=next_nav.gif
@@ -37,5 +40,5 @@ action.TakeLeft.tooltip=Copy Selected Nodes from Left to Right
action.TakeLeft.image=copycont_r_co.gif
action.TakeRight.label=Copy Right to Left
-action.TakeRight.tooltip=Copy selected Nodes from Right to Left
+action.TakeRight.tooltip=Copy Selected Nodes from Right to Left
action.TakeRight.image=copycont_l_co.gif
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 b68de6d02..57073008b 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
@@ -14,7 +14,9 @@ import org.eclipse.jface.text.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.compare.*;
import org.eclipse.compare.internal.Utilities;
+import org.eclipse.compare.contentmergeviewer.*;
import org.eclipse.compare.contentmergeviewer.IDocumentRange;
+import org.eclipse.compare.contentmergeviewer.TextMergeViewer;
/**
@@ -39,7 +41,7 @@ public class DocumentRangeNode
implements IDocumentRange, IStructureComparator, IEditableContent, IStreamContentAccessor {
private static final boolean POS_UPDATE= true;
-
+
private IDocument fBaseDocument;
private Position fRange; // the range in the base document
private int fTypeCode;
@@ -65,11 +67,13 @@ public class DocumentRangeNode
fID= id;
fBaseDocument= document;
+ fBaseDocument.addPositionCategory(RANGE_CATEGORY);
fRange= new Position(start, length);
if (POS_UPDATE) {
try {
- document.addPosition(fRange);
+ document.addPosition(RANGE_CATEGORY, fRange);
+ } catch (BadPositionCategoryException ex) {
} catch (BadLocationException ex) {
}
}
@@ -163,8 +167,9 @@ public class DocumentRangeNode
fBaseDocument.removePosition(fAppendPosition);
try {
Position p= new Position(pos);
- fBaseDocument.addPosition(p);
+ fBaseDocument.addPosition(RANGE_CATEGORY, p);
fAppendPosition= p;
+ } catch (BadPositionCategoryException ex) {
} catch (BadLocationException ex) {
// ignore
}
@@ -185,8 +190,9 @@ public class DocumentRangeNode
if (POS_UPDATE) {
try {
Position p= new Position(fBaseDocument.getLength());
- fBaseDocument.addPosition(p);
+ fBaseDocument.addPosition(RANGE_CATEGORY, p);
fAppendPosition= p;
+ } catch (BadPositionCategoryException ex) {
} catch (BadLocationException ex) {
// ignore
}
@@ -236,7 +242,7 @@ public class DocumentRangeNode
//try {
Position po= new Position(p.getOffset() + p.getLength() + 1, 0);
- //c.fBaseDocument.addPosition(po);
+ //c.fBaseDocument.addPosition(RANGE_CATEGORY, po);
return po;
//} catch (BadLocationException ex) {
//}
@@ -253,7 +259,7 @@ public class DocumentRangeNode
Position p= c.fRange;
//try {
Position po= new Position(p.getOffset(), 0);
- //c.fBaseDocument.addPosition(po);
+ //c.fBaseDocument.addPosition(RANGE_CATEGORY, po);
return po;
//} catch (BadLocationException ex) {
//}

Back to the top