X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.model%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fmodel%2Ftests%2FHasInstanceOfTest.java;fp=bundles%2Forg.simantics.browsing.ui.model%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fmodel%2Ftests%2FHasInstanceOfTest.java;h=0d5ea67e6ea02fc69c8deab87ccb5a1329eaa8b1;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 diff --git a/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/tests/HasInstanceOfTest.java b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/tests/HasInstanceOfTest.java new file mode 100644 index 000000000..0d5ea67e6 --- /dev/null +++ b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/tests/HasInstanceOfTest.java @@ -0,0 +1,26 @@ +package org.simantics.browsing.ui.model.tests; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.exception.DatabaseException; + +public class HasInstanceOfTest implements Test { + Resource type; + + public HasInstanceOfTest(Resource type) { + this.type = type; + } + + @Override + public boolean isCompatible(Class contentType) { + return contentType == Resource.class; + } + + @Override + public boolean test(ReadGraph graph, Object content) + throws DatabaseException { + return graph.isInstanceOf((Resource)content, type); + } + + +}