X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fadapter%2FGraphToDiagramSynchronizer.java;h=a1fa5bee59dd6d609c6d2eaf1846e82346c3406c;hb=3cfa8ee6785da4a41c655c0f2a12a899b28f85d5;hp=14b9f148a1baa1d8f5fe1ab320d40e0370ccc202;hpb=bf96ac52241da33b0150f15547c1b57b2673f25c;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/GraphToDiagramSynchronizer.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/GraphToDiagramSynchronizer.java index 14b9f148a..a1fa5bee5 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/GraphToDiagramSynchronizer.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/GraphToDiagramSynchronizer.java @@ -127,9 +127,7 @@ import org.simantics.g2d.element.ElementUtils; import org.simantics.g2d.element.IElement; import org.simantics.g2d.element.IElementClassProvider; import org.simantics.g2d.element.handler.EdgeVisuals.EdgeEnd; -import org.simantics.g2d.element.handler.ElementHandler; import org.simantics.g2d.element.handler.ElementLayerListener; -import org.simantics.g2d.element.handler.ElementLayers; import org.simantics.g2d.element.handler.TerminalTopology; import org.simantics.g2d.element.impl.Element; import org.simantics.g2d.layers.ILayer; @@ -766,19 +764,8 @@ public class GraphToDiagramSynchronizer extends AbstractDisposable implements ID public ElementClass substitute(IDiagram d, ElementClass ec) { if (d != diagram) throw new IllegalArgumentException("specified diagram does not have this SubstituteElementClass handler"); - - // If the element class is our own, there's no point in creating - // a copy of it. - /*if (ec.contains(elementLayerListener)) - return ec;*/ - - List all = ec.getAll(); - List result = new ArrayList(all); - for (ElementHandler eh : all) { - if (eh instanceof ElementLayers) - result.add(elementLayerListener); - } - return ElementClass.compile(result, false).setId(ec.getId()); + // Nothing to substitute here + return ec; } } @@ -1199,6 +1186,11 @@ public class GraphToDiagramSynchronizer extends AbstractDisposable implements ID } } + @Override + public void flush() { + modificationQueue.flush(); + } + void changeTag(IElement e, Resource tag, boolean set) { Object object = e.getHint(ElementHints.KEY_OBJECT); Resource tagged = null; @@ -1213,7 +1205,7 @@ public class GraphToDiagramSynchronizer extends AbstractDisposable implements ID if (tagged == null) return; - modificationQueue.async(new TagChange(tagged, tag, set), null); + modificationQueue.offer(new TagChange(tagged, tag, set), null); } }; @@ -1280,6 +1272,7 @@ public class GraphToDiagramSynchronizer extends AbstractDisposable implements ID d.setHint(DiagramHints.KEY_LAYERS, layers); d.setHint(DiagramHints.KEY_LAYERS_EDITOR, layers); + d.setHint(DiagramHints.KEY_ELEMENT_LAYER_LISTENER, elementLayerListener); d.addCompositionVetoListener(diagramListener); d.addCompositionListener(diagramListener);