]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/adapters/IsTestIgnored.java
Enhancements to modelled STS-tests
[simantics/platform.git] / bundles / org.simantics.tests.modelled.ui / src / org / simantics / tests / modelled / ui / adapters / IsTestIgnored.java
1 package org.simantics.tests.modelled.ui.adapters;
2
3 import java.util.Map;
4
5 import org.eclipse.jface.resource.ImageDescriptor;
6 import org.simantics.browsing.ui.model.images.ImageRule;
7 import org.simantics.browsing.ui.model.tests.Test;
8 import org.simantics.browsing.ui.model.visuals.VisualsRule;
9 import org.simantics.databoard.Bindings;
10 import org.simantics.db.ReadGraph;
11 import org.simantics.db.Resource;
12 import org.simantics.db.exception.DatabaseException;
13 import org.simantics.tests.modelled.ontology.TestsResource;
14
15 public enum IsTestIgnored implements Test, VisualsRule, ImageRule {
16
17     INSTANCE;
18
19     public static IsTestIgnored get() {
20         return INSTANCE;
21     }
22
23     @Override
24     public boolean isCompatible(Class<?> contentType) {
25         return Resource.class.equals(contentType);
26     }
27
28     @Override
29     public boolean test(ReadGraph graph, Object content) throws DatabaseException {
30         if (content instanceof Resource) {
31             Resource resource = (Resource) content;
32             TestsResource TESTS = TestsResource.getInstance(graph);
33             return graph.getPossibleRelatedValue2(resource, TESTS.ignore, Bindings.BOOLEAN);
34         }
35         return false;
36     }
37
38     @Override
39     public Map<String, ImageDescriptor> getImage(ReadGraph graph, Object content) throws DatabaseException {
40         // TODO Auto-generated method stub
41         return null;
42     }
43
44 }