Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2002-01-29 17:57:39 +0000
committerAndre Weinand2002-01-29 17:57:39 +0000
commitdb0577c09b7f656b30f2702dfff8cbf021bec972 (patch)
treec5e6678e85fc8d88457cee90538248ae7d354453
parent081842ff46505d180d56ae9355107aa3dc8f6dc1 (diff)
downloadeclipse.platform.team-20020129.tar.gz
eclipse.platform.team-20020129.tar.xz
eclipse.platform.team-20020129.zip
small fix for a NPEv20020129
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java10
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java24
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java10
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java24
4 files changed, 54 insertions, 14 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
index a0f6077d6..0a17565a3 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
@@ -1515,10 +1515,12 @@ public class TextMergeViewer extends ContentMergeViewer {
}
}
- if (fCurrentDiff != null && isThreeWay() && !fIgnoreAncestor) {
- fDirectionLabel.setImage(fCurrentDiff.getImage());
- } else {
- fDirectionLabel.setImage(null);
+ if (fDirectionLabel != null) {
+ if (fCurrentDiff != null && isThreeWay() && !fIgnoreAncestor) {
+ fDirectionLabel.setImage(fCurrentDiff.getImage());
+ } else {
+ fDirectionLabel.setImage(null);
+ }
}
if (fCopyDiffLeftToRightItem != null)
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 fa54ff207..e6872e6d5 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
@@ -8,6 +8,7 @@ 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.jface.util.*;
import org.eclipse.jface.action.*;
@@ -50,7 +51,6 @@ public class StructureDiffViewer extends DiffTreeViewer {
private IStructureCreator fStructureCreator;
private IDiffContainer fRoot;
- //private ChangePropertyAction fSmartAction;
private ActionContributionItem fSmartActionItem;
private IContentChangeListener fContentChangedListener;
private ICompareInputChangeListener fThreeWayInputChangedListener;
@@ -120,6 +120,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
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!
}
@@ -192,8 +193,8 @@ public class StructureDiffViewer extends DiffTreeViewer {
t= input.getAncestor();
fThreeWay= (t != null);
- fSmartActionItem.setVisible(fThreeWay);
-
+ setSmartButtonVisible(fThreeWay);
+
if (t != fAncestorInput) {
if (fAncestorInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fAncestorInput).removeContentChangeListener(fContentChangedListener);
@@ -241,6 +242,23 @@ 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.
*/
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
index a0f6077d6..0a17565a3 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
@@ -1515,10 +1515,12 @@ public class TextMergeViewer extends ContentMergeViewer {
}
}
- if (fCurrentDiff != null && isThreeWay() && !fIgnoreAncestor) {
- fDirectionLabel.setImage(fCurrentDiff.getImage());
- } else {
- fDirectionLabel.setImage(null);
+ if (fDirectionLabel != null) {
+ if (fCurrentDiff != null && isThreeWay() && !fIgnoreAncestor) {
+ fDirectionLabel.setImage(fCurrentDiff.getImage());
+ } else {
+ fDirectionLabel.setImage(null);
+ }
}
if (fCopyDiffLeftToRightItem != null)
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 fa54ff207..e6872e6d5 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
@@ -8,6 +8,7 @@ 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.jface.util.*;
import org.eclipse.jface.action.*;
@@ -50,7 +51,6 @@ public class StructureDiffViewer extends DiffTreeViewer {
private IStructureCreator fStructureCreator;
private IDiffContainer fRoot;
- //private ChangePropertyAction fSmartAction;
private ActionContributionItem fSmartActionItem;
private IContentChangeListener fContentChangedListener;
private ICompareInputChangeListener fThreeWayInputChangedListener;
@@ -120,6 +120,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
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!
}
@@ -192,8 +193,8 @@ public class StructureDiffViewer extends DiffTreeViewer {
t= input.getAncestor();
fThreeWay= (t != null);
- fSmartActionItem.setVisible(fThreeWay);
-
+ setSmartButtonVisible(fThreeWay);
+
if (t != fAncestorInput) {
if (fAncestorInput instanceof IContentChangeNotifier)
((IContentChangeNotifier)fAncestorInput).removeContentChangeListener(fContentChangedListener);
@@ -241,6 +242,23 @@ 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.
*/

Back to the top