]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Prevented flows from inputs and modules
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 14 Sep 2010 13:28:16 +0000 (13:28 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 14 Sep 2010 13:28:16 +0000 (13:28 +0000)
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

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/ConnectTool.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/PointerInteractor.java

index f61b2f95f42a9bfb610af719a150d5540e8c4453..408dfc0d7ead19248fe386cec40e532f350d7b73 100644 (file)
@@ -676,7 +676,9 @@ public class ConnectTool extends AbstractDiagramParticipant {
                                                Resource end = soa.adapt(Resource.class);\r
                                                if(conntype.equals(sr.DependencyConnection)) {\r
                                                        if(end.equals(sr.CloudSymbol)) return null;\r
-                                                       //if(!(end.equals(sr.AuxiliarySymbol) || end.equals(sr.ValveSymbol))) return null;\r
+                                                       soa = startElement.getElementClass().getSingleItem(StaticObjectAdapter.class);\r
+                                                       Resource start = soa.adapt(Resource.class);\r
+                                                       if(g.isInheritedFrom(start, sr.ModuleSymbol) && !end.equals(sr.InputSymbol)) return null;\r
                                                } else if (conntype.equals(sr.FlowConnection)) {\r
                                                        if(!(end.equals(sr.StockSymbol) || end.equals(sr.ValveSymbol) || end.equals(sr.CloudSymbol))) return null;\r
                                                } else {\r
index 9ffbf9a3a63c602be42e1cbc1aeed35f39dc6358..7795ee0f3c9648b9c2d428849ba32d1f2e7f283e 100644 (file)
@@ -39,6 +39,8 @@ import org.simantics.g2d.routing.RouterFactory;
 import org.simantics.g2d.utils.GeometryUtils;\r
 import org.simantics.sysdyn.ui.elements2.AuxiliaryFactory;\r
 import org.simantics.sysdyn.ui.elements2.CloudFactory;\r
+import org.simantics.sysdyn.ui.elements2.InputFactory;\r
+import org.simantics.sysdyn.ui.elements2.ModuleFactory;\r
 import org.simantics.sysdyn.ui.elements2.connections.ConnectionClasses;\r
 \r
 /**\r
@@ -95,7 +97,10 @@ public class PointerInteractor extends org.simantics.g2d.diagram.participant.poi
                     connectionClass = elementClassProvider.get(ConnectionClasses.DEPENDENCY);\r
                     \r
                 } else if (me.button == MouseEvent.RIGHT_BUTTON) {\r
-                    if(terminalElement.getElementClass().getId().equals(AuxiliaryFactory.class.getSimpleName())) return false;\r
+                       String id  = terminalElement.getElementClass().getId();\r
+                    if(id.equals(AuxiliaryFactory.class.getSimpleName())\r
+                               || id.equals(InputFactory.class.getSimpleName())\r
+                               || id.equals(ModuleFactory.class.getSimpleName())) return false;\r
                     diagram.setHint(DiagramHints.ROUTE_ALGORITHM, RouterFactory.create(true, true));\r
                     connectionClass = elementClassProvider.get(ConnectionClasses.FLOW);\r
                 }\r