Przeglądaj źródła

NullPointerException fixed when using Note Attachments

Andreas Mülder 13 lat temu
rodzic
commit
4ce1b84306

+ 7 - 4
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/policies/RegionCompartmentCanonicalEditPolicy.java

@@ -58,14 +58,17 @@ public class RegionCompartmentCanonicalEditPolicy extends
 			Collection<View> children) {
 			Collection<View> children) {
 		// Connections should only be included, when the source vertex is
 		// Connections should only be included, when the source vertex is
 		// contained in the region this edit policy belongs to
 		// contained in the region this edit policy belongs to
-		Transition transition = (Transition) connection.getElement();
-		Vertex source = transition.getSource();
-		if (!getSemanticHost().getVertices().contains(source)) {
-			return false;
+		EObject element = (EObject) connection.getElement();
+		if (element instanceof Transition) {
+			Vertex source = ((Transition) element).getSource();
+			if (!getSemanticHost().getVertices().contains(source)) {
+				return false;
+			}
 		}
 		}
 		return super.shouldIncludeConnection(connection, children);
 		return super.shouldIncludeConnection(connection, children);
 	}
 	}
 
 
+
 	@Override
 	@Override
 	protected EObject getSourceElement(EObject relationship) {
 	protected EObject getSourceElement(EObject relationship) {
 		Assert.isTrue(relationship instanceof Transition);
 		Assert.isTrue(relationship instanceof Transition);