package org.simantics.sysdyn.ui.editor;\r
\r
+import java.util.ArrayList;\r
+import java.util.Arrays;\r
+\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.RequestProcessor;\r
import org.simantics.db.Resource;\r
import org.simantics.g2d.elementclass.FlagHandler;\r
import org.simantics.structural.stubs.StructuralResource2;\r
import org.simantics.structural2.modelingRules.CPFlag;\r
-import org.simantics.structural2.modelingRules.IConnection;\r
+import org.simantics.structural2.modelingRules.ConnectionJudgement;\r
+import org.simantics.structural2.modelingRules.ConnectionJudgementType;\r
import org.simantics.structural2.modelingRules.IConnectionPoint;\r
import org.simantics.structural2.modelingRules.IModelingRules;\r
import org.simantics.sysdyn.SysdynResource;\r
}\r
}\r
\r
- IConnection connection = modelingRules.createConnection()\r
- .attachNew(g, getConnectionPoint(g, element1, term1));\r
+ ArrayList<IConnectionPoint> cps = new ArrayList<IConnectionPoint>();\r
+ cps.add(getConnectionPoint(g, element1, term1));\r
if(element2 != null)\r
- connection = connection.attachNew(g, getConnectionPoint(g, element2, term2));\r
- if(connection.isLegal())\r
- return connection.getConnectionType();\r
+ cps.add(getConnectionPoint(g, element2, term2));\r
+ ConnectionJudgement judgement = \r
+ modelingRules.judgeConnection(g, cps); \r
+ \r
+ if(judgement.type == ConnectionJudgementType.LEGAL)\r
+ return judgement.connectionType;\r
else\r
return null;\r
}\r
\r
@Override\r
public Boolean perform(ReadGraph g) throws DatabaseException {\r
- return modelingRules.createConnection()\r
- .attachNew(g, getConnectionPoint(g, element, term))\r
- .isLegal();\r
+ return modelingRules.judgeConnection(g,\r
+ Arrays.asList(getConnectionPoint(g, element, term)))\r
+ .type != ConnectionJudgementType.ILLEGAL;\r
}\r
\r
});\r