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