From: villberg Date: Tue, 21 Oct 2014 08:19:19 +0000 (+0000) Subject: (refs #5428) Support creation of SCL modules in libraries X-Git-Tag: v1.29.0~158 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=6ab14ebc4d9b8596c59e8872aa6e3c60e323fd22;p=simantics%2Fsysdyn.git (refs #5428) Support creation of SCL modules in libraries git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@30468 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/plugin.xml b/org.simantics.sysdyn.ui/plugin.xml index 3cac4f5e..7bf53899 100644 --- a/org.simantics.sysdyn.ui/plugin.xml +++ b/org.simantics.sysdyn.ui/plugin.xml @@ -848,10 +848,27 @@ checkEnabled="true"> + + + + + + + + @@ -2022,6 +2039,21 @@ args="org.simantics.sysdyn.ui.browser.nodes.SCLModulesFolder" property="org.simantics.sysdyn.ui.nodeClass"> + + + + + + diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewSCLModuleHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewSCLModuleHandler.java index a026c31b..7dee59c8 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewSCLModuleHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewSCLModuleHandler.java @@ -25,11 +25,16 @@ public class NewSCLModuleHandler extends AbstractHandler { ISelection sel = HandlerUtil.getCurrentSelection(event); @SuppressWarnings("unchecked") - AbstractNode node = AdaptionUtils.adaptToSingle(sel, AbstractNode.class); - if (node == null) - return null; + Resource res = AdaptionUtils.adaptToSingle(sel, Resource.class); + if(res == null) { + @SuppressWarnings("unchecked") + AbstractNode node = AdaptionUtils.adaptToSingle(sel, AbstractNode.class); + if (node == null) + return null; + res = node.data; + } - final Resource parent = node.data; + final Resource parent = res; SimanticsUI.getSession().asyncRequest(new WriteRequest() {