1 package org.simantics.modeling.utils;
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.Resource;
5 import org.simantics.db.exception.DatabaseException;
6 import org.simantics.diagram.stubs.DiagramResource;
7 import org.simantics.modeling.ModelingResources;
10 * Utilities for dealing with diagram monitors.
12 * @author Tuukka Lehtonen
14 public final class Monitors {
16 public static Resource getMonitoredComponent(ReadGraph graph, Resource monitor) throws DatabaseException {
17 DiagramResource DIA = DiagramResource.getInstance(graph);
18 Resource component = graph.getPossibleObject(monitor, DIA.HasMonitorComponent);
22 public static Resource getMonitoredElement(ReadGraph graph, Resource monitor) throws DatabaseException {
23 Resource component = getMonitoredComponent(graph, monitor);
24 if (component == null)
26 ModelingResources MOD = ModelingResources.getInstance(graph);
27 Resource element = graph.getPossibleObject(component, MOD.ComponentToElement);