X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.tests.modelled.ui%2Fsrc%2Forg%2Fsimantics%2Ftests%2Fmodelled%2Fui%2FTestsUIUtils.java;h=648d48969456e2c74064255fc01bc6fd7daa954e;hb=21bef5bfa30007c081028f4f40d52a20c43794ca;hp=c6bd1c28708d1fed48d642147ebc85994e79c73e;hpb=3b5069d0d30e7de27f73d88d5e89d29052291a34;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/TestsUIUtils.java b/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/TestsUIUtils.java index c6bd1c287..648d48969 100644 --- a/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/TestsUIUtils.java +++ b/bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/TestsUIUtils.java @@ -1,23 +1,39 @@ -package org.simantics.tests.modelled.ui; - -import java.io.IOException; - -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.simantics.db.Resource; -import org.simantics.db.exception.DatabaseException; -import org.simantics.ui.workbench.e4.E4WorkbenchUtils; - -public class TestsUIUtils { - - private TestsUIUtils() { - } - - public static void runSTSTestAction(Resource test) throws DatabaseException, IOException { - MPart part = E4WorkbenchUtils.getMPartById(STSTestRunnerView.ID); - E4WorkbenchUtils.openAndShowPart(part); - Object obj = part.getObject(); - STSTestRunnerView view = (STSTestRunnerView) obj; - view.currentTest(test); - view.execute(); - } -} +package org.simantics.tests.modelled.ui; + +import java.io.IOException; + +import org.eclipse.e4.ui.model.application.ui.basic.MPart; +import org.simantics.Simantics; +import org.simantics.databoard.Bindings; +import org.simantics.db.Resource; +import org.simantics.db.WriteGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.request.Write; +import org.simantics.tests.modelled.ontology.TestsResource; +import org.simantics.ui.workbench.e4.E4WorkbenchUtils; + +public class TestsUIUtils { + + private TestsUIUtils() { + } + + public static void runSTSTestAction(Resource test) throws DatabaseException, IOException { + MPart part = E4WorkbenchUtils.getMPartById(STSTestRunnerView.ID); + E4WorkbenchUtils.openAndShowPart(part); + Object obj = part.getObject(); + STSTestRunnerView view = (STSTestRunnerView) obj; + view.currentTest(test); + view.execute(); + } + + public static void ignoreSTSTestAction(Resource test) throws DatabaseException { + Simantics.getSession().syncRequest(new Write() { + + @Override + public void perform(WriteGraph graph) throws DatabaseException { + TestsResource TESTS = TestsResource.getInstance(graph); + graph.claimLiteral(test, TESTS.ignore, true, Bindings.BOOLEAN); + } + }); + } +}