Commit fc928a9f authored by Simon Barner's avatar Simon Barner
Browse files

Merge branch '3935' into 'master'

[3934] Do not allow connections to occupied ports

See merge request af3/af3!286
parents 6012320a aa76f374 a1dbd75cfce361b709249b0d851f080cf63d243c GREEN 35a2c38859ddf2f6ee358e15f6eda42e47df702b GREEN aa5842f6de9a764cbd5e1b90fc56427560e062a0 GREEN a0fb18af7ded52cbcb18be83cf1d9960028ceac2 GREEN 42625f27b7e2d5de0df39c56618173ff057ea7a5 GREEN 299d369552fb940a1297d64606c3c0c1698e57a8 GREEN
......@@ -23,6 +23,7 @@ import org.fortiss.tooling.base.compose.ConnectorConnectionCompositorBase;
import org.fortiss.tooling.base.model.base.ConnectionSegmentBase;
import org.fortiss.tooling.base.model.base.ConnectorBase;
import org.fortiss.tooling.base.model.element.IConnection;
* Compositor for connecting exit and entry connectors on state automata editor.
......@@ -32,6 +33,21 @@ import org.fortiss.tooling.base.model.element.IConnection;
public class ConnectorConnectionCompositor
extends ConnectorConnectionCompositorBase<State, ConnectorBase, ConnectorBase> {
/** {@inheritDoc} */
public boolean canConnect(ConnectorBase source, ConnectorBase target, State parent,
IConnectionCompositionContext context) {
// Do not allow connections from and to already occupied ports. Since a link can be drawn
// from an entry not to an exit node as well, both end points have to be checked for both
// incoming and outgoing links.
boolean freeSource = source.getOutgoing().isEmpty() && source.getIncoming().isEmpty();
boolean freeTarget = target.getIncoming().isEmpty() && target.getOutgoing().isEmpty();
if(freeSource && freeTarget) {
return super.canConnect(source, target, parent, context);
return false;
/** {@inheritDoc} */
protected ConnectionSegmentBase createConnection() {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment