]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
(refs #5428) Support creation of SCL modules in libraries
authorvillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 21 Oct 2014 08:19:19 +0000 (08:19 +0000)
committervillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 21 Oct 2014 08:19:19 +0000 (08:19 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@30468 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/plugin.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewSCLModuleHandler.java

index 3cac4f5ea6b80ee9858cb227aec41d8972a90cda..7bf5389964da7b093e9b1bd7f68e7f5762d431a9 100644 (file)
                      checkEnabled="true">\r
                   <with\r
                         variable="selection">\r
+                        <or>\r
                      <test\r
                            args="org.simantics.sysdyn.ui.browser.nodes.SCLModulesFolder"\r
                            property="org.simantics.sysdyn.ui.nodeClass">\r
                      </test>\r
+                 <test\r
+                       args="http://www.simantics.org/Layer0-0.0/SharedOntology"\r
+                       property="org.simantics.graph.resourceType"\r
+                       value="true">\r
+                 </test>\r
+                 <test\r
+                       args="http://www.simantics.org/Layer0-0.0/Library"\r
+                       property="org.simantics.graph.resourceType"\r
+                       value="true">\r
+                 </test>\r
+                 <test\r
+                       args="http://www.simantics.org/Simulation-0.0/Model"\r
+                       property="org.simantics.graph.resourceType"\r
+                       value="true">\r
+                 </test>\r
+                     </or>\r
                   </with>\r
                </visibleWhen>\r
             </command>\r
                         args="org.simantics.sysdyn.ui.browser.nodes.SCLModulesFolder"\r
                         property="org.simantics.sysdyn.ui.nodeClass">\r
                   </test>\r
+                 <test\r
+                       args="http://www.simantics.org/Layer0-0.0/SharedOntology"\r
+                       property="org.simantics.graph.resourceType"\r
+                       value="true">\r
+                 </test>\r
+                 <test\r
+                       args="http://www.simantics.org/Layer0-0.0/Library"\r
+                       property="org.simantics.graph.resourceType"\r
+                       value="true">\r
+                 </test>\r
+                 <test\r
+                       args="http://www.simantics.org/Simulation-0.0/Model"\r
+                       property="org.simantics.graph.resourceType"\r
+                       value="true">\r
+                 </test>\r
                </or>\r
             </with>\r
          </activeWhen>\r
index a026c31b1301d52858711ace27a977e2e58898e6..7dee59c845b8348c9503b2b393b7401367a7040b 100644 (file)
@@ -25,11 +25,16 @@ public class NewSCLModuleHandler  extends AbstractHandler {
         ISelection sel = HandlerUtil.getCurrentSelection(event);\r
         \r
         @SuppressWarnings("unchecked")\r
-               AbstractNode<Resource> node = AdaptionUtils.adaptToSingle(sel, AbstractNode.class);\r
-        if (node == null)\r
-            return null;\r
+               Resource res = AdaptionUtils.adaptToSingle(sel, Resource.class);\r
+        if(res == null) {\r
+               @SuppressWarnings("unchecked")\r
+                       AbstractNode<Resource> node = AdaptionUtils.adaptToSingle(sel, AbstractNode.class);\r
+               if (node == null)\r
+                       return null;\r
+               res = node.data;\r
+        }\r
 \r
-        final Resource parent = node.data;\r
+        final Resource parent = res;\r
         \r
         SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
                \r