From 3335a0d4d7ed7efc9ba6344c9b33a39e6582afff Mon Sep 17 00:00:00 2001 From: lempinen Date: Tue, 14 Sep 2010 13:28:16 +0000 Subject: [PATCH] Prevented flows from inputs and modules Prevented dependencies from modules to other types than inputs git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@17911 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../sysdyn/ui/editor/participant/ConnectTool.java | 4 +++- .../sysdyn/ui/editor/participant/PointerInteractor.java | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/ConnectTool.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/ConnectTool.java index f61b2f95..408dfc0d 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/ConnectTool.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/ConnectTool.java @@ -676,7 +676,9 @@ public class ConnectTool extends AbstractDiagramParticipant { Resource end = soa.adapt(Resource.class); if(conntype.equals(sr.DependencyConnection)) { if(end.equals(sr.CloudSymbol)) return null; - //if(!(end.equals(sr.AuxiliarySymbol) || end.equals(sr.ValveSymbol))) return null; + soa = startElement.getElementClass().getSingleItem(StaticObjectAdapter.class); + Resource start = soa.adapt(Resource.class); + if(g.isInheritedFrom(start, sr.ModuleSymbol) && !end.equals(sr.InputSymbol)) return null; } else if (conntype.equals(sr.FlowConnection)) { if(!(end.equals(sr.StockSymbol) || end.equals(sr.ValveSymbol) || end.equals(sr.CloudSymbol))) return null; } else { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/PointerInteractor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/PointerInteractor.java index 9ffbf9a3..7795ee0f 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/PointerInteractor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/PointerInteractor.java @@ -39,6 +39,8 @@ import org.simantics.g2d.routing.RouterFactory; import org.simantics.g2d.utils.GeometryUtils; import org.simantics.sysdyn.ui.elements2.AuxiliaryFactory; import org.simantics.sysdyn.ui.elements2.CloudFactory; +import org.simantics.sysdyn.ui.elements2.InputFactory; +import org.simantics.sysdyn.ui.elements2.ModuleFactory; import org.simantics.sysdyn.ui.elements2.connections.ConnectionClasses; /** @@ -95,7 +97,10 @@ public class PointerInteractor extends org.simantics.g2d.diagram.participant.poi connectionClass = elementClassProvider.get(ConnectionClasses.DEPENDENCY); } else if (me.button == MouseEvent.RIGHT_BUTTON) { - if(terminalElement.getElementClass().getId().equals(AuxiliaryFactory.class.getSimpleName())) return false; + String id = terminalElement.getElementClass().getId(); + if(id.equals(AuxiliaryFactory.class.getSimpleName()) + || id.equals(InputFactory.class.getSimpleName()) + || id.equals(ModuleFactory.class.getSimpleName())) return false; diagram.setHint(DiagramHints.ROUTE_ALGORITHM, RouterFactory.create(true, true)); connectionClass = elementClassProvider.get(ConnectionClasses.FLOW); } -- 2.47.1