Ignore multiple modelled tests via context menu action 64/764/2
authorjsimomaa <jani.simomaa@gmail.com>
Wed, 26 Jul 2017 06:26:25 +0000 (09:26 +0300)
committerJani Simomaa <jani.simomaa@semantum.fi>
Mon, 31 Jul 2017 06:46:50 +0000 (09:46 +0300)
refs #7382

Change-Id: I8e6c5abddd51a75fad027283c3bc845817b634bd

bundles/org.simantics.tests.modelled.ui.ontology/graph/TestsUI.pgraph
bundles/org.simantics.tests.modelled.ui/scl/Simantics/TestsUI.scl
bundles/org.simantics.tests.modelled.ui/src/org/simantics/tests/modelled/ui/TestsUIUtils.java
bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/utils/ModelledSTSTest.java

index a0e60d0b31e2882935a98a802a8bf7f82776757f..bcae4c4805e8f96a48815bc8bb051f9f677af7bf 100644 (file)
@@ -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
index 53218224a089feac163ae5e475d245afe05a25e2..0b99fe784fa2239470ef3f93f80b59f5e2ae6bcf 100644 (file)
@@ -7,6 +7,7 @@ createSTSTestAction res = do
 
 importJava "org.simantics.tests.modelled.ui.TestsUIUtils" where
     runSTSTestAction :: Resource -> <Proc> ()
+    ignoreSTSTestAction :: [Resource] -> <Proc> ()
     
 createSTSSuiteAction :: Resource -> <Proc> ()
 createSTSSuiteAction res = do
index 651ee47df7282751f3e891b11dcce3e5588b2caa..b24f445e23c985e317f652f628e435a0135a3b53 100644 (file)
@@ -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<Resource> 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);
+                }
+            }
+        });
+    }
 }
index 3ce1b01580c7415d517f712ca499cf4670c8aa45..78964403f95057464a929d8ea81e0622dea54a8b 100644 (file)
@@ -117,7 +117,7 @@ public class ModelledSTSTest {
 //    //                    }
 //    //                }
 //                    return new ModuleCompilationOptions(coverage);
-//                }
+    //                    }
 //            });
             
             SCLReportingHandler handler = (SCLReportingHandler) SCLContext.getCurrent().get(SCLReportingHandler.REPORTING_HANDLER);