From 93e70f713558f9826b78ad54929f80e52d8c824b Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Wed, 26 Jul 2017 09:26:25 +0300 Subject: [PATCH] Ignore multiple modelled tests via context menu action refs #7382 Change-Id: I8e6c5abddd51a75fad027283c3bc845817b634bd --- .../graph/TestsUI.pgraph | 9 +++++++++ .../scl/Simantics/TestsUI.scl | 1 + .../tests/modelled/ui/TestsUIUtils.java | 19 +++++++++++++++++++ .../tests/modelled/utils/ModelledSTSTest.java | 2 +- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/bundles/org.simantics.tests.modelled.ui.ontology/graph/TestsUI.pgraph b/bundles/org.simantics.tests.modelled.ui.ontology/graph/TestsUI.pgraph index a0e60d0b3..bcae4c480 100644 --- a/bundles/org.simantics.tests.modelled.ui.ontology/graph/TestsUI.pgraph +++ b/bundles/org.simantics.tests.modelled.ui.ontology/graph/TestsUI.pgraph @@ -57,6 +57,8 @@ ACTIONS.NewSTSTest @MOD.sclAction "createSTSTestAction" ACTIONS.RunSTSTest @MOD.sclAction "runSTSTestAction" +ACTIONS.IgnoreSTSTest + @MOD.sclAction "ignoreSTSTestAction" ACTIONS.NewSTSVariable @MOD.sclAction "createSTSVariableAction" @@ -82,6 +84,13 @@ MAC VP.ActionContribution.HasNodeType TESTS.STSSuite VP.ActionContribution.HasNodeType TESTS.STSTest VP.ActionContribution.HasAction ACTIONS.RunSTSTest + VP.BrowseContext.HasActionContribution _ : VP.ActionContribution + L0.HasLabel "Ignore" + VP.ActionContribution.HasImage SILK.control_play + VP.ActionContribution.HasCategory VP.EditActionCategory + VP.ActionContribution.HasNodeType TESTS.STSSuite + VP.ActionContribution.HasNodeType TESTS.STSTest + VP.ActionContribution.HasAction ACTIONS.IgnoreSTSTest VP.BrowseContext.HasActionContribution _ : VP.ActionContribution L0.HasLabel "STS Variable" VP.ActionContribution.HasImage SILK.page_white_edit diff --git a/bundles/org.simantics.tests.modelled.ui/scl/Simantics/TestsUI.scl b/bundles/org.simantics.tests.modelled.ui/scl/Simantics/TestsUI.scl index 53218224a..0b99fe784 100644 --- a/bundles/org.simantics.tests.modelled.ui/scl/Simantics/TestsUI.scl +++ b/bundles/org.simantics.tests.modelled.ui/scl/Simantics/TestsUI.scl @@ -7,6 +7,7 @@ createSTSTestAction res = do importJava "org.simantics.tests.modelled.ui.TestsUIUtils" where runSTSTestAction :: Resource -> () + ignoreSTSTestAction :: [Resource] -> () createSTSSuiteAction :: Resource -> () createSTSSuiteAction res = do 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 651ee47df..b24f445e2 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,10 +1,16 @@ package org.simantics.tests.modelled.ui; import java.io.IOException; +import java.util.List; 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 { @@ -20,4 +26,17 @@ public class TestsUIUtils { view.currentTest(test); view.execute(); } + + public static void ignoreSTSTestAction(List tests) throws DatabaseException { + Simantics.getSession().syncRequest(new Write() { + + @Override + public void perform(WriteGraph graph) throws DatabaseException { + TestsResource TESTS = TestsResource.getInstance(graph); + for (Resource test : tests) { + graph.claimLiteral(test, TESTS.ignore, true, Bindings.BOOLEAN); + } + } + }); + } } diff --git a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/utils/ModelledSTSTest.java b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/utils/ModelledSTSTest.java index 3ce1b0158..78964403f 100644 --- a/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/utils/ModelledSTSTest.java +++ b/bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/utils/ModelledSTSTest.java @@ -117,7 +117,7 @@ public class ModelledSTSTest { // // } // // } // return new ModuleCompilationOptions(coverage); -// } + // } // }); SCLReportingHandler handler = (SCLReportingHandler) SCLContext.getCurrent().get(SCLReportingHandler.REPORTING_HANDLER); -- 2.47.1