X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.tests.modelled.ui%2Fsrc%2Forg%2Fsimantics%2Ftests%2Fmodelled%2Fui%2Fadapters%2FIsTestIgnored.java;fp=bundles%2Forg.simantics.tests.modelled.ui%2Fsrc%2Forg%2Fsimantics%2Ftests%2Fmodelled%2Fui%2Fadapters%2FIsTestIgnored.java;h=a58f3b3c3210556e3423056f1f648f08069e0a41;hp=0000000000000000000000000000000000000000;hb=f03893d9b643eae3f03debf7a656edbfa5b9b501;hpb=51006ffec13cbf8e0d9c8b07212d69478e4bdd4e diff --git a/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/adapters/IsTestIgnored.java b/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/adapters/IsTestIgnored.java new file mode 100644 index 000000000..a58f3b3c3 --- /dev/null +++ b/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/adapters/IsTestIgnored.java @@ -0,0 +1,44 @@ +package org.simantics.tests.modelled.ui.adapters; + +import java.util.Map; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.simantics.browsing.ui.model.images.ImageRule; +import org.simantics.browsing.ui.model.tests.Test; +import org.simantics.browsing.ui.model.visuals.VisualsRule; +import org.simantics.databoard.Bindings; +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.exception.DatabaseException; +import org.simantics.tests.modelled.ontology.TestsResource; + +public enum IsTestIgnored implements Test, VisualsRule, ImageRule { + + INSTANCE; + + public static IsTestIgnored get() { + return INSTANCE; + } + + @Override + public boolean isCompatible(Class contentType) { + return Resource.class.equals(contentType); + } + + @Override + public boolean test(ReadGraph graph, Object content) throws DatabaseException { + if (content instanceof Resource) { + Resource resource = (Resource) content; + TestsResource TESTS = TestsResource.getInstance(graph); + return graph.getPossibleRelatedValue2(resource, TESTS.ignore, Bindings.BOOLEAN); + } + return false; + } + + @Override + public Map getImage(ReadGraph graph, Object content) throws DatabaseException { + // TODO Auto-generated method stub + return null; + } + +}