diff options
-rw-r--r-- | plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/delete/DeleteConnectionCommand.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/delete/DeleteConnectionCommand.java b/plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/delete/DeleteConnectionCommand.java index 0e062171ee7..3827ed561bf 100644 --- a/plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/delete/DeleteConnectionCommand.java +++ b/plugins/org.eclipse.fordiac.ide.model.commands/src/org/eclipse/fordiac/ide/model/commands/delete/DeleteConnectionCommand.java @@ -93,16 +93,18 @@ public class DeleteConnectionCommand extends Command { FBNetworkElement opSource = source.getFBNetworkElement().getOpposite(); FBNetworkElement opDestination = destination.getFBNetworkElement().getOpposite(); if(null != opSource && null != opDestination && opSource.getFbNetwork() == opDestination.getFbNetwork()){ - Connection con = findConnection(opSource.getInterfaceElement(source.getName()), opDestination.getInterfaceElement(destination.getName())); - DeleteConnectionCommand cmd = new DeleteConnectionCommand(con); - cmd.setPerformMappingCheck(false); //as this is the command for the mirrored connection we don't want again to check - return (cmd.canExecute()) ? cmd : null; + Connection con = findConnection(opSource.getInterfaceElement(source.getName()), opDestination.getInterfaceElement(destination.getName())); + if(null != con) { + DeleteConnectionCommand cmd = new DeleteConnectionCommand(con); + cmd.setPerformMappingCheck(false); //as this is the command for the mirrored connection we don't want again to check + return (cmd.canExecute()) ? cmd : null; + } } } return null; } - private Connection findConnection(IInterfaceElement source, IInterfaceElement destination) { + private static Connection findConnection(IInterfaceElement source, IInterfaceElement destination) { for (Connection con : source.getOutputConnections()) { if(con.getDestination() == destination){ return con; |