1 package org.simantics.selectionview;
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.Resource;
5 import org.simantics.db.exception.DatabaseException;
7 abstract public class AbstractTypedResourceTabContribution extends AbstractResourceTabContribution {
9 public AbstractTypedResourceTabContribution(ReadGraph graph, Resource configuration) throws DatabaseException {
10 super(graph, configuration);
15 public boolean accept(ReadGraph graph, Object input) throws DatabaseException {
17 if (!(input instanceof Resource))
19 Resource resource = (Resource) input;
21 SelectionViewResources SEL = SelectionViewResources.getInstance(graph);
23 Resource type = graph.getPossibleObject(configuration, SEL.AbstractTypedResourceTabContribution_HasType);
24 if(type == null) throw new DatabaseException("No type for " + graph.getPossibleURI(configuration));
26 if(!graph.isInstanceOf(resource, type)) return false;
28 return super.accept(graph, resource);