*******************************************************************************/
package org.simantics.diagram.adapter;
+import java.util.List;
+
import org.simantics.db.AsyncReadGraph;
import org.simantics.db.Resource;
import org.simantics.db.common.primitiverequest.Adapter;
import org.simantics.diagram.synchronization.ErrorHandler;
import org.simantics.g2d.canvas.ICanvasContext;
import org.simantics.g2d.diagram.IDiagram;
+import org.simantics.g2d.diagram.handler.SubstituteElementClass;
import org.simantics.g2d.element.ElementClass;
import org.simantics.g2d.element.IElement;
}
@Override
- public void execute(AsyncReadGraph graph, final ElementClass clazz) {
-
+ public void execute(AsyncReadGraph graph, ElementClass mutableClazz) {
+ List<SubstituteElementClass> substitutes = diagram.getDiagramClass().getItemsByClass(SubstituteElementClass.class);
+ for (SubstituteElementClass subs : substitutes) {
+ mutableClazz = subs.substitute(diagram, mutableClazz);
+ }
+ final ElementClass clazz = mutableClazz;
graph.asyncRequest(new SpawnRequest(canvas, clazz, data), new TransientCacheAsyncListener<IElement>() {
@Override