Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbblajer2007-01-17 16:24:40 +0000
committerbblajer2007-01-17 16:24:40 +0000
commitce5ce5996a59398048d6b3d964935dfc8f7059a1 (patch)
tree24d865e715a7abe9bb29d16f31d9b6ec300c04dc /plugins/org.eclipse.gmf.runtime.lite/src/org
parent7e3460c573b13c7b5e1dba303176f47cc78ef6cd (diff)
downloadorg.eclipse.gmf-tooling-ce5ce5996a59398048d6b3d964935dfc8f7059a1.tar.gz
org.eclipse.gmf-tooling-ce5ce5996a59398048d6b3d964935dfc8f7059a1.tar.xz
org.eclipse.gmf-tooling-ce5ce5996a59398048d6b3d964935dfc8f7059a1.zip
Prevented NPE when deleting an node with compartments
Diffstat (limited to 'plugins/org.eclipse.gmf.runtime.lite/src/org')
-rw-r--r--plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/handles/CompartmentCollapseHandle.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/handles/CompartmentCollapseHandle.java b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/handles/CompartmentCollapseHandle.java
index 496af6d9f..d6e70b9b6 100644
--- a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/handles/CompartmentCollapseHandle.java
+++ b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/handles/CompartmentCollapseHandle.java
@@ -15,6 +15,7 @@ import org.eclipse.emf.transaction.NotificationFilter;
import org.eclipse.emf.transaction.ResourceSetChangeEvent;
import org.eclipse.emf.transaction.ResourceSetListener;
import org.eclipse.emf.transaction.ResourceSetListenerImpl;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gef.DragTracker;
import org.eclipse.gef.GraphicalEditPart;
@@ -26,6 +27,7 @@ import org.eclipse.swt.graphics.Image;
public class CompartmentCollapseHandle extends CompartmentNameHandle {
private ResourceSetListener myResourceSetListener;
+ private TransactionalEditingDomain myDomain;
public CompartmentCollapseHandle(GraphicalEditPart owner, String title) {
super(owner, title); //XXX: temporary
@@ -85,13 +87,18 @@ public class CompartmentCollapseHandle extends CompartmentNameHandle {
public void addNotify() {
super.addNotify();
View ownerView = getOwnerView();
- TransactionUtil.getEditingDomain(ownerView).addResourceSetListener(myResourceSetListener);
+ myDomain = TransactionUtil.getEditingDomain(ownerView);
+ if (myDomain != null) {
+ myDomain.addResourceSetListener(myResourceSetListener);
+ }
}
@Override
public void removeNotify() {
- View ownerView = getOwnerView();
- TransactionUtil.getEditingDomain(ownerView).removeResourceSetListener(myResourceSetListener);
+ if (myDomain != null) {
+ myDomain.removeResourceSetListener(myResourceSetListener);
+ myDomain = null;
+ }
super.removeNotify();
}

Back to the top