Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlgoubet2008-06-30 09:20:14 +0000
committerlgoubet2008-06-30 09:20:14 +0000
commit775883a13279003c97a7409cb05caeef440b1f5e (patch)
treedce9f83e2a036e9b190213b1f6e51234dac54ce4
parentc60fd08abe6b80013c9af8fd70329b7e2ce4c771 (diff)
downloadorg.eclipse.emf.compare-775883a13279003c97a7409cb05caeef440b1f5e.tar.gz
org.eclipse.emf.compare-775883a13279003c97a7409cb05caeef440b1f5e.tar.xz
org.eclipse.emf.compare-775883a13279003c97a7409cb05caeef440b1f5e.zip
[238942] Comparison of models with unset enums no longer fails in NPE
-rwxr-xr-xplugins/org.eclipse.emf.compare.ui/src/org/eclipse/emf/compare/ui/viewer/content/part/diff/ModelContentMergeDiffTab.java82
1 files changed, 42 insertions, 40 deletions
diff --git a/plugins/org.eclipse.emf.compare.ui/src/org/eclipse/emf/compare/ui/viewer/content/part/diff/ModelContentMergeDiffTab.java b/plugins/org.eclipse.emf.compare.ui/src/org/eclipse/emf/compare/ui/viewer/content/part/diff/ModelContentMergeDiffTab.java
index 4760167d8..850260f0c 100755
--- a/plugins/org.eclipse.emf.compare.ui/src/org/eclipse/emf/compare/ui/viewer/content/part/diff/ModelContentMergeDiffTab.java
+++ b/plugins/org.eclipse.emf.compare.ui/src/org/eclipse/emf/compare/ui/viewer/content/part/diff/ModelContentMergeDiffTab.java
@@ -135,48 +135,50 @@ public class ModelContentMergeDiffTab extends TreeViewer implements IModelConten
final ModelContentMergeTabItem item = dataToItem.get(diff);
- // This is a match, we'll search the first visible element in its tree path
- final Item treeItem = getVisibleAncestorOf(item.getVisibleItem());
- if (treeItem == item.getVisibleItem()) {
- // This is actually a perfect match : the item is visible in the tree and it is the actual
- // item displayed by the diff
- result = item;
- } else {
- // The item corresponding to the diff is not visible. We'll wrap its
- // first visible ancestor.
- result = new ModelContentMergeTabItem(item.getActualItem(), treeItem, item.getCurveColor());
+ if (item != null) {
+ // This is a match, we'll search the first visible element in its tree path
+ final Item treeItem = getVisibleAncestorOf(item.getVisibleItem());
+ if (treeItem == item.getVisibleItem()) {
+ // This is actually a perfect match : the item is visible in the tree and it is the actual
+ // item displayed by the diff
+ result = item;
+ } else {
+ // The item corresponding to the diff is not visible. We'll wrap its
+ // first visible ancestor.
+ result = new ModelContentMergeTabItem(item.getActualItem(), treeItem, item.getCurveColor());
+ }
+
+ // we should have found an item. sets the curve width and Y coordinate
+ final int curveY;
+ if (result.getActualItem() == result.getVisibleItem()) {
+ if (partSide == EMFCompareConstants.LEFT && diff instanceof ModelElementChangeRightTarget)
+ curveY = ((TreeItem)result.getVisibleItem()).getBounds().y
+ + ((TreeItem)result.getVisibleItem()).getBounds().height;
+ else if (partSide == EMFCompareConstants.RIGHT && diff instanceof ModelElementChangeLeftTarget)
+ curveY = ((TreeItem)result.getVisibleItem()).getBounds().y
+ + ((TreeItem)result.getVisibleItem()).getBounds().height;
+ else
+ curveY = ((TreeItem)result.getVisibleItem()).getBounds().y
+ + ((TreeItem)result.getVisibleItem()).getBounds().height / 2;
+ result.setCurveY(curveY);
+ } else {
+ if (partSide == EMFCompareConstants.LEFT && diff instanceof ModelElementChangeRightTarget)
+ curveY = ((TreeItem)result.getVisibleItem()).getBounds().y
+ + ((TreeItem)result.getVisibleItem()).getBounds().height;
+ else if (partSide == EMFCompareConstants.RIGHT && diff instanceof ModelElementChangeLeftTarget)
+ curveY = ((TreeItem)result.getVisibleItem()).getBounds().y
+ + ((TreeItem)result.getVisibleItem()).getBounds().height;
+ else
+ curveY = ((TreeItem)result.getVisibleItem()).getBounds().y
+ + ((TreeItem)result.getVisibleItem()).getBounds().height;
+ result.setCurveY(curveY);
+ }
+ if (getSelectedElements().contains(result.getActualItem()))
+ result.setCurveSize(2);
+ else
+ result.setCurveSize(1);
}
- // we should have found an item. sets the curve width and Y coordinate
- final int curveY;
- if (result.getActualItem() == result.getVisibleItem()) {
- if (partSide == EMFCompareConstants.LEFT && diff instanceof ModelElementChangeRightTarget)
- curveY = ((TreeItem)result.getVisibleItem()).getBounds().y
- + ((TreeItem)result.getVisibleItem()).getBounds().height;
- else if (partSide == EMFCompareConstants.RIGHT && diff instanceof ModelElementChangeLeftTarget)
- curveY = ((TreeItem)result.getVisibleItem()).getBounds().y
- + ((TreeItem)result.getVisibleItem()).getBounds().height;
- else
- curveY = ((TreeItem)result.getVisibleItem()).getBounds().y
- + ((TreeItem)result.getVisibleItem()).getBounds().height / 2;
- result.setCurveY(curveY);
- } else {
- if (partSide == EMFCompareConstants.LEFT && diff instanceof ModelElementChangeRightTarget)
- curveY = ((TreeItem)result.getVisibleItem()).getBounds().y
- + ((TreeItem)result.getVisibleItem()).getBounds().height;
- else if (partSide == EMFCompareConstants.RIGHT && diff instanceof ModelElementChangeLeftTarget)
- curveY = ((TreeItem)result.getVisibleItem()).getBounds().y
- + ((TreeItem)result.getVisibleItem()).getBounds().height;
- else
- curveY = ((TreeItem)result.getVisibleItem()).getBounds().y
- + ((TreeItem)result.getVisibleItem()).getBounds().height;
- result.setCurveY(curveY);
- }
- if (getSelectedElements().contains(result.getActualItem()))
- result.setCurveSize(2);
- else
- result.setCurveSize(1);
-
return result;
}

Back to the top