X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fadapter%2FGraphToDiagramSynchronizer.java;h=aa35c63342c28e8d952a7989f2cc5edd26f83f21;hp=e2c1521ee45b21c6e63dc166535d645b60e0354e;hb=881a82d0707953038b327d334560ac12ac3e5ea9;hpb=ff1c29bf73b3e5ea939dc1987540aa0240dc4ae6 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 e2c1521ee..aa35c6334 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 @@ -11,9 +11,6 @@ *******************************************************************************/ package org.simantics.diagram.adapter; -import gnu.trove.map.hash.TObjectIntHashMap; -import gnu.trove.set.hash.THashSet; - import java.awt.geom.AffineTransform; import java.lang.reflect.InvocationTargetException; import java.util.ArrayDeque; @@ -158,6 +155,11 @@ import org.simantics.utils.strings.EString; import org.simantics.utils.threads.ThreadUtils; import org.simantics.utils.threads.logger.ITask; import org.simantics.utils.threads.logger.ThreadLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import gnu.trove.map.hash.TObjectIntHashMap; +import gnu.trove.set.hash.THashSet; /** * This class loads a diagram contained in the graph database into the runtime @@ -250,6 +252,8 @@ import org.simantics.utils.threads.logger.ThreadLogger; */ public class GraphToDiagramSynchronizer extends AbstractDisposable implements IDiagramLoader, IModifiableSynchronizationContext { + private static final Logger LOGGER = LoggerFactory.getLogger(GraphToDiagramSynchronizer.class); + /** * Controls whether the class adds hint listeners to each diagram element * that try to perform basic sanity checks on changes happening in element @@ -1111,7 +1115,7 @@ public class GraphToDiagramSynchronizer extends AbstractDisposable implements ID } } catch (InterruptedException e) { // Shouldn't happen. - e.printStackTrace(); + LOGGER.error("Dispose interrupted!", e); } finally { detachSessionListener(); @@ -1343,7 +1347,11 @@ public class GraphToDiagramSynchronizer extends AbstractDisposable implements ID g.getSession().asyncRequest(new AsyncReadRequest() { @Override public void run(AsyncReadGraph graph) { - profileObserver.listen(graph, GraphToDiagramSynchronizer.this); + ProfileObserver po = profileObserver; + if (po != null) + po.listen(graph, GraphToDiagramSynchronizer.this); + else + LOGGER.info("profileObserver has been disposed already!"); } }); @@ -3456,7 +3464,7 @@ public class GraphToDiagramSynchronizer extends AbstractDisposable implements ID Resource resource = ElementUtils.adapt(ec, Resource.class); if (resource == null) { pass = false; - new Exception("Attempted to add an element to the diagram that is not adaptable to Resource: " + e + ", class: " + ec).printStackTrace(); + LOGGER.error("", new Exception("Attempted to add an element to the diagram that is not adaptable to Resource: " + e + ", class: " + ec)); } // Sanity check connection hints