Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2002-01-31 12:41:05 +0000
committerAndre Weinand2002-01-31 12:41:05 +0000
commit80704e552f55c795b84fdd54f982e85cd9e4c265 (patch)
treeff2525f11ebcd96f3066dc476b4edfcc92d85814 /bundles/org.eclipse.compare/compare/org
parent4ed75fe6e6cb945a46b566ab040bbb338d6fc3ec (diff)
downloadeclipse.platform.team-80704e552f55c795b84fdd54f982e85cd9e4c265.tar.gz
eclipse.platform.team-80704e552f55c795b84fdd54f982e85cd9e4c265.tar.xz
eclipse.platform.team-80704e552f55c795b84fdd54f982e85cd9e4c265.zip
Accessability features
Diffstat (limited to 'bundles/org.eclipse.compare/compare/org')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java22
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java75
2 files changed, 10 insertions, 87 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java
index 8c5c7ce0f..d3e9f3c7f 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator.java
@@ -97,28 +97,6 @@ public interface IStructureCreator {
String getContents(Object node, boolean ignoreWhitespace);
/**
- * Returns whether this structure creator supports tree rewriting.
- * The <code>StructureDiffViewer</code> uses this method to determine
- * whether to enable a "smart" button in the UI and whether to call
- * the <code>rewriteTree</code> method.
- *
- * @return <code>true</code> if this structure creator supports tree rewriting
- */
- boolean canRewriteTree();
-
- /**
- * Rewrites the tree.
- * This method is only called if <code>canRewriteTree</code>
- * returns <code>true</code>, and only after the difference engine has constructed the diff tree.
- * Implementation of this method may perform tree rewriting such as merging
- * separate but related diff elements into a single node.
- *
- * @param differencer the differencing engine which was used to construct the diff tree
- * @param root the root of the tree returned from the differencing engine
- */
- void rewriteTree(Differencer differencer, IDiffContainer root);
-
- /**
* FIXME: need better name?
* Called whenever a copy operation has been performed on a tree node.
*
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 e6872e6d5..8b691ef93 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
@@ -5,15 +5,9 @@
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.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.text.*;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.compare.*;
import org.eclipse.compare.internal.*;
@@ -35,9 +29,7 @@ import org.eclipse.compare.internal.*;
* @see ICompareInput
*/
public class StructureDiffViewer extends DiffTreeViewer {
-
- private static final String SMART= "SMART"; //$NON-NLS-1$
-
+
private Differencer fDifferencer;
private boolean fThreeWay= false;
@@ -51,7 +43,6 @@ public class StructureDiffViewer extends DiffTreeViewer {
private IStructureCreator fStructureCreator;
private IDiffContainer fRoot;
- private ActionContributionItem fSmartActionItem;
private IContentChangeListener fContentChangedListener;
private ICompareInputChangeListener fThreeWayInputChangedListener;
private CompareViewerSwitchingPane fParent;
@@ -112,18 +103,9 @@ 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 && fSmartActionItem != null) {
- IAction a= fSmartActionItem.getAction();
- if (a != null)
- //setSmartButtonVisible(fStructureCreator.canRewriteTree());
- a.setEnabled(fStructureCreator.canRewriteTree());
- // FIXME: if there is an input we should create the trees!
- }
}
}
@@ -193,7 +175,6 @@ public class StructureDiffViewer extends DiffTreeViewer {
t= input.getAncestor();
fThreeWay= (t != null);
- setSmartButtonVisible(fThreeWay);
if (t != fAncestorInput) {
if (fAncestorInput instanceof IContentChangeNotifier)
@@ -242,23 +223,6 @@ public class StructureDiffViewer extends DiffTreeViewer {
diff();
}
- private void setSmartButtonVisible(boolean visible) {
- if (fSmartActionItem == null)
- return;
- Control c= getControl();
- if (c == null && c.isDisposed())
- return;
-
- fSmartActionItem.setVisible(visible);
- ToolBarManager tbm= CompareViewerPane.getToolBarManager(c.getParent());
- if (tbm != null) {
- tbm.update(true);
- ToolBar tb= tbm.getControl();
- if (!tb.isDisposed())
- tb.getParent().layout(true);
- }
- }
-
/**
* Calls <code>diff</code> whenever the byte contents changes.
*/
@@ -292,7 +256,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
/**
* Runs the difference engine and refreshes the tree.
*/
- private void diff() {
+ protected void diff() {
preDiffHook(fAncestorStructure, fLeftStructure, fRightStructure);
@@ -324,13 +288,8 @@ public class StructureDiffViewer extends DiffTreeViewer {
if (fRoot == null || fRoot.getChildren().length == 0) {
message= CompareMessages.getString("StructureDiffViewer.NoStructuralDifferences"); //$NON-NLS-1$
} else {
- if (fStructureCreator.canRewriteTree()) {
- boolean smart= Utilities.getBoolean(getCompareConfiguration(), SMART, false);
- if (smart && fRoot != null)
- fStructureCreator.rewriteTree(fDifferencer, fRoot);
- }
+ postDiffHook(fDifferencer, fRoot);
}
-
}
if (fParent != null)
fParent.setTitleArgument(message);
@@ -338,6 +297,10 @@ public class StructureDiffViewer extends DiffTreeViewer {
refresh(getRoot());
}
+ protected void postDiffHook(Differencer differencer, IDiffContainer root) {
+ // we do nothing here
+ }
+
/**
* Performs a byte compare on the given objects.
* Called from the difference engine.
@@ -360,30 +323,12 @@ public class StructureDiffViewer extends DiffTreeViewer {
*/
protected void propertyChange(PropertyChangeEvent event) {
String key= event.getProperty();
- if (key.equals(CompareConfiguration.IGNORE_WHITESPACE) || key.equals(SMART))
+ if (key.equals(CompareConfiguration.IGNORE_WHITESPACE))
diff();
else
super.propertyChange(event);
}
-
- /**
- * Overriden to create a "smart" button in the viewer's pane control bar.
- * <p>
- * Clients can override this method and are free to decide whether they want to call
- * the inherited method.
- *
- * @param toolbarManager the toolbar manager for which to add the buttons
- */
- protected void createToolItems(ToolBarManager toolBarManager) {
- super.createToolItems(toolBarManager);
-
- IAction a= new ChangePropertyAction(getBundle(), getCompareConfiguration(), "action.Smart.", SMART); //$NON-NLS-1$
- fSmartActionItem= new ActionContributionItem(a);
- fSmartActionItem.setVisible(fThreeWay);
- toolBarManager.appendToGroup("modes", fSmartActionItem); //$NON-NLS-1$
- }
-
/**
* Overridden to call the <code>save</code> method on the structure creator after
* nodes have been copied from one side to the other side of an input object.

Back to the top