]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/tests/HasInstanceOfTest.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.browsing.ui.model / src / org / simantics / browsing / ui / model / tests / HasInstanceOfTest.java
1 package org.simantics.browsing.ui.model.tests;
2
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.Resource;
5 import org.simantics.db.exception.DatabaseException;
6
7 public class HasInstanceOfTest implements Test {
8     Resource type;
9
10     public HasInstanceOfTest(Resource type) {
11         this.type = type;
12     }
13
14     @Override
15     public boolean isCompatible(Class<?> contentType) {
16         return contentType == Resource.class;
17     }
18
19     @Override
20     public boolean test(ReadGraph graph, Object content)
21             throws DatabaseException {
22         return graph.isInstanceOf((Resource)content, type);
23     }
24     
25     
26 }