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%2FTypeGroup.java;h=7e4cb0e37bc7d448eb3a79fea764a4bcc6d908bf;hp=b7b4ba2ff13bb9d9a55fec7a155bbc389bdd8883;hb=acb2ceac4ac946941beae7547783ec76edceb733;hpb=e2f997281a0eb7c0108000e5462659f5906d3e23 diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/TypeGroup.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/TypeGroup.java index b7b4ba2ff..7e4cb0e37 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/TypeGroup.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/TypeGroup.java @@ -29,12 +29,16 @@ import org.simantics.db.procedure.SetListener; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.layer0.Layer0; import org.simantics.scenegraph.profile.Group; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author Tuukka Lehtonen */ public class TypeGroup implements Group { + private static final Logger LOGGER = LoggerFactory.getLogger(TypeGroup.class); + private final Collection types; private final String name; @@ -103,14 +107,17 @@ public class TypeGroup implements Group { // for (Resource t : types) // System.out.println("\t" + NameUtils.getSafeName(graph, t, true)); - Collection elements = graph.syncRequest(new OrderedSet(realDiagram)); - for (Resource element : elements) { -// System.out.println("checking element " + NameUtils.getSafeName(graph, element, true)); - Collection elementTypes = graph.getTypes(element); - if (!Collections.disjoint(types, elementTypes)) - result.add(element); + if (graph.hasStatement(realDiagram)) { + Collection elements = graph.syncRequest(new OrderedSet(realDiagram)); + for (Resource element : elements) { + // System.out.println("checking element " + NameUtils.getSafeName(graph, element, true)); + Collection elementTypes = graph.getTypes(element); + if (!Collections.disjoint(types, elementTypes)) + result.add(element); + } + } else { + LOGGER.warn("Most likely after deleting a diagram or something therefore no ordered set can be found for {}", realDiagram); } - return result; }