Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Davis2013-06-18 18:15:42 +0000
committerMatthew Davis2013-06-18 18:15:42 +0000
commit84bd66197dba818c62e5d63751e57fbd3adfb33f (patch)
tree2384e7b6269bf87d1ac08bc9c9422f819df6cc21
parent69b90793eeb1dbc8e14d74536f5f419a4e4632a6 (diff)
downloadorg.eclipse.stem-84bd66197dba818c62e5d63751e57fbd3adfb33f.tar.gz
org.eclipse.stem-84bd66197dba818c62e5d63751e57fbd3adfb33f.tar.xz
org.eclipse.stem-84bd66197dba818c62e5d63751e57fbd3adfb33f.zip
Can no longer connect a transition to a non-standard or non-deaths
compartment
-rw-r--r--modelgen/org.eclipse.stem.model.ui.editor/src/org/eclipse/stem/model/ui/editor/commands/TransitionCreateCommand.java12
-rw-r--r--modelgen/org.eclipse.stem.model.ui.editor/src/org/eclipse/stem/model/ui/editor/commands/TransitionReconnectCommand.java2
2 files changed, 12 insertions, 2 deletions
diff --git a/modelgen/org.eclipse.stem.model.ui.editor/src/org/eclipse/stem/model/ui/editor/commands/TransitionCreateCommand.java b/modelgen/org.eclipse.stem.model.ui.editor/src/org/eclipse/stem/model/ui/editor/commands/TransitionCreateCommand.java
index 30ff68609..192a39015 100644
--- a/modelgen/org.eclipse.stem.model.ui.editor/src/org/eclipse/stem/model/ui/editor/commands/TransitionCreateCommand.java
+++ b/modelgen/org.eclipse.stem.model.ui.editor/src/org/eclipse/stem/model/ui/editor/commands/TransitionCreateCommand.java
@@ -11,6 +11,7 @@
package org.eclipse.stem.model.ui.editor.commands;
import org.eclipse.gef.commands.Command;
+import org.eclipse.stem.model.metamodel.CompartmentType;
import org.eclipse.stem.model.metamodel.MetamodelFactory;
import org.eclipse.stem.model.metamodel.Transition;
import org.eclipse.stem.model.ui.editor.vismodel.CompartmentElement;
@@ -44,12 +45,23 @@ public class TransitionCreateCommand extends Command {
if (target == null) {
return false;
}
+
if (source.equals(target)) {
return false;
}
if (source.getModelElement() != target.getModelElement()) {
return false;
}
+
+ if (source.getCompartment().getType() != CompartmentType.STANDARD) {
+ return false;
+ }
+
+ if (target.getCompartment().getType() != CompartmentType.STANDARD &&
+ target.getCompartment().getType() != CompartmentType.DEATHS) {
+ return false;
+ }
+
ModelElement model = source.getModelElement();
for (TransitionElement te : model.getTransitionElements()) {
if (te.getSource() != null && te.getTarget() != null) {
diff --git a/modelgen/org.eclipse.stem.model.ui.editor/src/org/eclipse/stem/model/ui/editor/commands/TransitionReconnectCommand.java b/modelgen/org.eclipse.stem.model.ui.editor/src/org/eclipse/stem/model/ui/editor/commands/TransitionReconnectCommand.java
index dea1d48f8..bd3336557 100644
--- a/modelgen/org.eclipse.stem.model.ui.editor/src/org/eclipse/stem/model/ui/editor/commands/TransitionReconnectCommand.java
+++ b/modelgen/org.eclipse.stem.model.ui.editor/src/org/eclipse/stem/model/ui/editor/commands/TransitionReconnectCommand.java
@@ -81,8 +81,6 @@ public class TransitionReconnectCommand extends Command {
} else if (newTarget != null) {
transition.setSource(oldSource);
transition.setTarget(newTarget);
- } else {
- throw new IllegalStateException("Should not happen");
}
}

Back to the top