which fixed the way ConnectionRequest invokes ElementFactory create/getClass methods.
The problem was caused by invalidly implemented create method which assumed that it receives an element instance,
not an element type as it should receive.
fixes #3276
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@24392
ac1ea38d-2e2b-0410-8846-
a27921b304fc
import org.simantics.g2d.element.handler.impl.StaticObjectAdapter;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.modeling.ModelingResources;\r
-import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.editor.routing.DependencyRouter;\r
import org.simantics.utils.datastructures.Pair;\r
\r
\r
@Override\r
public void create(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementType, final AsyncProcedure<ElementClass> procedure) {\r
- DiagramResource dr = graph.getService(DiagramResource.class);\r
- graph.forSingleType(elementType, dr.Connection, new AsyncProcedure<Resource>() {\r
- @Override\r
- public void exception(AsyncReadGraph graph, Throwable throwable) {\r
- procedure.exception(graph, throwable);\r
- }\r
- @Override\r
- public void execute(AsyncReadGraph graph, Resource connectionType) {\r
- procedure.execute(graph, SysdynConnectionClass.CLASS.newClassWith(false, new StaticObjectAdapter(connectionType)));\r
- }\r
- });\r
+ procedure.execute(graph, SysdynConnectionClass.CLASS.newClassWith(false, new StaticObjectAdapter(elementType)));\r
+ }\r
+\r
+ @Override\r
+ protected Resource getElementClassBaseType(AsyncReadGraph graph) {\r
+ return graph.getService(DiagramResource.class).Connection;\r
}\r
\r
@Override\r
\r
@Override\r
public void create(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementType, final AsyncProcedure<ElementClass> procedure) {\r
- DiagramResource dr = graph.getService(DiagramResource.class);\r
- graph.forSingleType(elementType, dr.Connection, new AsyncProcedure<Resource>() {\r
- @Override\r
- public void exception(AsyncReadGraph graph, Throwable throwable) {\r
- procedure.exception(graph, throwable);\r
- }\r
- @Override\r
- public void execute(AsyncReadGraph graph, Resource connectionType) {\r
- procedure.execute(graph, ConnectionClass.CLASS.newClassWith(false, new StaticObjectAdapter(connectionType)));\r
- }\r
- });\r
+ procedure.execute(graph, ConnectionClass.CLASS.newClassWith(false, new StaticObjectAdapter(elementType)));\r
+ }\r
+\r
+ @Override\r
+ protected Resource getElementClassBaseType(AsyncReadGraph graph) {\r
+ return graph.getService(DiagramResource.class).Connection;\r
}\r
\r
@Override\r
\r
@Override\r
public void create(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementType, final AsyncProcedure<ElementClass> procedure) {\r
- SysdynResource sr = graph.getService(SysdynResource.class);\r
- graph.forSingleType(elementType, sr.FlowConnection, new AsyncProcedure<Resource>() {\r
- @Override\r
- public void exception(AsyncReadGraph graph, Throwable throwable) {\r
- procedure.exception(graph, throwable);\r
- }\r
- @Override\r
- public void execute(AsyncReadGraph graph, Resource connectionType) {\r
- procedure.execute(graph, CLASS.newClassWith(false, new StaticObjectAdapter(connectionType)));\r
- }\r
- });\r
+ procedure.execute(graph, CLASS.newClassWith(false, new StaticObjectAdapter(elementType)));\r
}\r
- \r
+\r
+ @Override\r
+ protected Resource getElementClassBaseType(AsyncReadGraph graph) {\r
+ return graph.getService(SysdynResource.class).FlowConnection;\r
+ }\r
+\r
@Override\r
public void load(ReadGraph graph, final ICanvasContext canvas, final IDiagram diagram, final Resource connection,\r
IElement element) throws DatabaseException {\r