Hi there,
Currently using Magic System of Systems Architect, 2022x R2.
I unexpectantly came across a Groovy script buried in:
Up until this point, I was under the impression that using a scripting language to add to existing menu items was only possible using Jython (as explained in the Developer's Guide, Jython Scripting section).
Now, I don't use Concept Modeler however this groovy script demonstrates how to add a menu item to the right-click menu when selecting from the containment tree - including how to limit its display based on properties of what's selected, eg. Package, which is great!
Issue: If you run the macro again, it duplicates the menu item! 😟
Questions:
- How can I search to see whether it has already been added? Seems like the constructor to MDAction omitted the 'id' - does this need to be set to retrieve? If it is given an id how can I retrieve a reference to it?
- Assuming the answer to the above will also help with a way to remove the menu item? Is it via using: removeContainmentBrowserContextConfigurator? (Which needs a configurator reference - how?)
Issue: Adding a menu item using Groovy is possible! Yet, this requires manually executing the script as required (program start-up). Using a compiled plugin is not (currently) possible.
Questions:
- Is there a way I can add such scripts to a location, as with the Jython example, that are loaded/executed at start-up?
- Is there another mechanism I can use to load/execute Groovy scripts upon application start-up? Or when loading a certain project?
- Is there a way I can make Groovy work like Jython? For example, creating a Groovy version of the jpython_api.jar contained in \\plugins\\com.nomagic.magicdraw.jpython.
Thank you!
