Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.compare/.classpath4
-rw-r--r--bundles/org.eclipse.compare/.vcm_meta4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java62
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/.classpath4
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/.vcm_meta4
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java62
6 files changed, 82 insertions, 58 deletions
diff --git a/bundles/org.eclipse.compare/.classpath b/bundles/org.eclipse.compare/.classpath
index c34f42382..ce863b74a 100644
--- a/bundles/org.eclipse.compare/.classpath
+++ b/bundles/org.eclipse.compare/.classpath
@@ -5,8 +5,8 @@
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
<classpathentry kind="src" path="/org.eclipse.ui"/>
<classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry exported="true" kind="lib" path="compare.jar"
- rootpath="" sourcepath="/org.eclipse.compare/comparesrc.zip"/>
+ <classpathentry exported="true" kind="lib" path="compare.jar" sourcepath="/org.eclipse.compare/comparesrc.zip"/>
<classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
+ <classpathentry kind="src" path="/org.eclipse.swt"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/bundles/org.eclipse.compare/.vcm_meta b/bundles/org.eclipse.compare/.vcm_meta
index d75ec7879..f6264c0e0 100644
--- a/bundles/org.eclipse.compare/.vcm_meta
+++ b/bundles/org.eclipse.compare/.vcm_meta
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-description>
<nature id="org.eclipse.jdt.core.javanature"/>
- <reference project-name="org.eclipse.core.resources"/>
- <reference project-name="org.eclipse.ui"/>
<reference project-name="org.eclipse.core.boot"/>
+ <reference project-name="org.eclipse.ui"/>
<reference project-name="org.eclipse.core.runtime"/>
+ <reference project-name="org.eclipse.core.resources"/>
<reference project-name="org.eclipse.swt"/>
<builder name="org.eclipse.jdt.core.javabuilder">
</builder>
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 2fcd30bf9..d24276f0c 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
@@ -154,7 +154,6 @@ public class StructureDiffViewer extends DiffTreeViewer {
protected void inputChanged(Object input, Object oldInput) {
if (input instanceof ICompareInput) {
compareInputChanged((ICompareInput) input);
- diff();
if (input != oldInput)
navigate(true);
}
@@ -176,8 +175,9 @@ public class StructureDiffViewer extends DiffTreeViewer {
/**
* Recreates the comparable structures for the input sides.
*/
- private void compareInputChanged(ICompareInput input) {
+ protected void compareInputChanged(ICompareInput input) {
ITypedElement t= null;
+ boolean changed= false;
if (input != null)
t= input.getAncestor();
@@ -186,9 +186,10 @@ public class StructureDiffViewer extends DiffTreeViewer {
if (fAncestorInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fAncestorInput).removeContentChangeListener(fContentChangedListener);
fAncestorInput= t;
- if (fAncestorInput != null)
+ if (fAncestorInput != null) {
fAncestorStructure= fStructureCreator.getStructure(fAncestorInput);
- else
+ changed= true;
+ } else
fAncestorStructure= null;
if (fAncestorInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fAncestorInput).addContentChangeListener(fContentChangedListener);
@@ -200,9 +201,10 @@ public class StructureDiffViewer extends DiffTreeViewer {
if (fLeftInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fLeftInput).removeContentChangeListener(fContentChangedListener);
fLeftInput= t;
- if (fLeftInput != null)
+ if (fLeftInput != null) {
fLeftStructure= fStructureCreator.getStructure(fLeftInput);
- else
+ changed= true;
+ } else
fLeftStructure= null;
if (fLeftInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fLeftInput).addContentChangeListener(fContentChangedListener);
@@ -214,45 +216,55 @@ public class StructureDiffViewer extends DiffTreeViewer {
if (fRightInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fRightInput).removeContentChangeListener(fContentChangedListener);
fRightInput= t;
- if (fRightInput != null)
+ if (fRightInput != null) {
fRightStructure= fStructureCreator.getStructure(fRightInput);
- else
+ changed= true;
+ } else
fRightStructure= null;
if (fRightInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fRightInput).addContentChangeListener(fContentChangedListener);
}
+
+ if (changed)
+ diff();
}
/**
* Calls <code>diff</code> whenever the byte contents changes.
*/
- private void contentChanged(IContentChangeNotifier changed) {
+ protected void contentChanged(IContentChangeNotifier changed) {
- if (changed == fAncestorInput) {
- IStructureComparator drn= fStructureCreator.getStructure(fAncestorInput);
-// if (drn == null)
-// return;
- fAncestorStructure= drn;
- } else if (changed == fLeftInput) {
- IStructureComparator drn= fStructureCreator.getStructure(fLeftInput);
-// if (drn == null)
-// return;
- fLeftStructure= drn;
- } else if (changed == fRightInput) {
- IStructureComparator drn= fStructureCreator.getStructure(fRightInput);
-// if (drn == null)
-// return;
- fRightStructure= drn;
- } else
+ if (fStructureCreator == null)
return;
+
+ if (changed != null) {
+ if (changed == fAncestorInput) {
+ fAncestorStructure= fStructureCreator.getStructure(fAncestorInput);
+ } else if (changed == fLeftInput) {
+ fLeftStructure= fStructureCreator.getStructure(fLeftInput);
+ } else if (changed == fRightInput) {
+ fRightStructure= fStructureCreator.getStructure(fRightInput);
+ } else
+ return;
+ } else {
+ fAncestorStructure= fStructureCreator.getStructure(fAncestorInput);
+ fLeftStructure= fStructureCreator.getStructure(fLeftInput);
+ fRightStructure= fStructureCreator.getStructure(fRightInput);
+ }
diff();
}
+ protected void preDiffHook(IStructureComparator ancestor, IStructureComparator left, IStructureComparator right) {
+ // we do nothing here
+ }
+
/**
* Runs the difference engine and refreshes the tree.
*/
private void diff() {
+
+ preDiffHook(fAncestorStructure, fLeftStructure, fRightStructure);
if ((fThreeWay && fAncestorStructure == null) || fLeftStructure == null || fRightStructure == null) {
// could not get structure of one (or more) of the legs
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.classpath b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.classpath
index c34f42382..ce863b74a 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.classpath
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.classpath
@@ -5,8 +5,8 @@
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
<classpathentry kind="src" path="/org.eclipse.ui"/>
<classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry exported="true" kind="lib" path="compare.jar"
- rootpath="" sourcepath="/org.eclipse.compare/comparesrc.zip"/>
+ <classpathentry exported="true" kind="lib" path="compare.jar" sourcepath="/org.eclipse.compare/comparesrc.zip"/>
<classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
+ <classpathentry kind="src" path="/org.eclipse.swt"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.vcm_meta b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.vcm_meta
index d75ec7879..f6264c0e0 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.vcm_meta
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/.vcm_meta
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-description>
<nature id="org.eclipse.jdt.core.javanature"/>
- <reference project-name="org.eclipse.core.resources"/>
- <reference project-name="org.eclipse.ui"/>
<reference project-name="org.eclipse.core.boot"/>
+ <reference project-name="org.eclipse.ui"/>
<reference project-name="org.eclipse.core.runtime"/>
+ <reference project-name="org.eclipse.core.resources"/>
<reference project-name="org.eclipse.swt"/>
<builder name="org.eclipse.jdt.core.javabuilder">
</builder>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
index 2fcd30bf9..d24276f0c 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
@@ -154,7 +154,6 @@ public class StructureDiffViewer extends DiffTreeViewer {
protected void inputChanged(Object input, Object oldInput) {
if (input instanceof ICompareInput) {
compareInputChanged((ICompareInput) input);
- diff();
if (input != oldInput)
navigate(true);
}
@@ -176,8 +175,9 @@ public class StructureDiffViewer extends DiffTreeViewer {
/**
* Recreates the comparable structures for the input sides.
*/
- private void compareInputChanged(ICompareInput input) {
+ protected void compareInputChanged(ICompareInput input) {
ITypedElement t= null;
+ boolean changed= false;
if (input != null)
t= input.getAncestor();
@@ -186,9 +186,10 @@ public class StructureDiffViewer extends DiffTreeViewer {
if (fAncestorInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fAncestorInput).removeContentChangeListener(fContentChangedListener);
fAncestorInput= t;
- if (fAncestorInput != null)
+ if (fAncestorInput != null) {
fAncestorStructure= fStructureCreator.getStructure(fAncestorInput);
- else
+ changed= true;
+ } else
fAncestorStructure= null;
if (fAncestorInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fAncestorInput).addContentChangeListener(fContentChangedListener);
@@ -200,9 +201,10 @@ public class StructureDiffViewer extends DiffTreeViewer {
if (fLeftInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fLeftInput).removeContentChangeListener(fContentChangedListener);
fLeftInput= t;
- if (fLeftInput != null)
+ if (fLeftInput != null) {
fLeftStructure= fStructureCreator.getStructure(fLeftInput);
- else
+ changed= true;
+ } else
fLeftStructure= null;
if (fLeftInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fLeftInput).addContentChangeListener(fContentChangedListener);
@@ -214,45 +216,55 @@ public class StructureDiffViewer extends DiffTreeViewer {
if (fRightInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fRightInput).removeContentChangeListener(fContentChangedListener);
fRightInput= t;
- if (fRightInput != null)
+ if (fRightInput != null) {
fRightStructure= fStructureCreator.getStructure(fRightInput);
- else
+ changed= true;
+ } else
fRightStructure= null;
if (fRightInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fRightInput).addContentChangeListener(fContentChangedListener);
}
+
+ if (changed)
+ diff();
}
/**
* Calls <code>diff</code> whenever the byte contents changes.
*/
- private void contentChanged(IContentChangeNotifier changed) {
+ protected void contentChanged(IContentChangeNotifier changed) {
- if (changed == fAncestorInput) {
- IStructureComparator drn= fStructureCreator.getStructure(fAncestorInput);
-// if (drn == null)
-// return;
- fAncestorStructure= drn;
- } else if (changed == fLeftInput) {
- IStructureComparator drn= fStructureCreator.getStructure(fLeftInput);
-// if (drn == null)
-// return;
- fLeftStructure= drn;
- } else if (changed == fRightInput) {
- IStructureComparator drn= fStructureCreator.getStructure(fRightInput);
-// if (drn == null)
-// return;
- fRightStructure= drn;
- } else
+ if (fStructureCreator == null)
return;
+
+ if (changed != null) {
+ if (changed == fAncestorInput) {
+ fAncestorStructure= fStructureCreator.getStructure(fAncestorInput);
+ } else if (changed == fLeftInput) {
+ fLeftStructure= fStructureCreator.getStructure(fLeftInput);
+ } else if (changed == fRightInput) {
+ fRightStructure= fStructureCreator.getStructure(fRightInput);
+ } else
+ return;
+ } else {
+ fAncestorStructure= fStructureCreator.getStructure(fAncestorInput);
+ fLeftStructure= fStructureCreator.getStructure(fLeftInput);
+ fRightStructure= fStructureCreator.getStructure(fRightInput);
+ }
diff();
}
+ protected void preDiffHook(IStructureComparator ancestor, IStructureComparator left, IStructureComparator right) {
+ // we do nothing here
+ }
+
/**
* Runs the difference engine and refreshes the tree.
*/
private void diff() {
+
+ preDiffHook(fAncestorStructure, fLeftStructure, fRightStructure);
if ((fThreeWay && fAncestorStructure == null) || fLeftStructure == null || fRightStructure == null) {
// could not get structure of one (or more) of the legs

Back to the top