Add Action to Tools menu

  • 7
  • 11

I tried to add an Action to the Tools menu. In the MPS 3.0 documentation there is a reference to Tutorial: how to add an Action to the Jetbrains MetaProgramming-System. I followed all the steps in the tutorial (slightly adapted because I use MPS 3.0, the tutorial is 2.0)., Everything goes fine, it seems simple enough. However \the new action never shows up in the Tools menu. Is the tutorial out of date? Or do I need to do something additional to get the action to show up?
I've migrated my actions to MPS 3.0 successfully, so it's not impossible to use them there. But I haven't followed this tutorial. I would recommend you to copy a action instance from any jetbrains model to yours and modify it step by step. Then you will see which change will break your action.

Can you point me to one that I could follow ?

You can find all instances of a concept very easily:
Open the concept and click with the right button on its name. Select "Find Usages Settings..." and check in the dialog "Concept Instances" and "Global". You can disable all other checkboxes.
In the Usages results you can select now one action which is similar to yours.

I copied the CopyNodeReference which is part of the Edit group. The only thing I changed was the execution code because that is compiled code. The actions still dopes not appear in any of the menus, while the Copy Node Reference action does (in the edit menu). See the code below:
EditGroup.PNG

CopyNodeReference.PNG

Could it be something in the project / solution / language setup ?

I've not found any documentation about this, too, so I can only guess what's going wrong. Is the solution, where your action are stored, marked with the solution kind "Other"? Do you have a StandalonePluginDescriptor in your model? I think this is necessary.

Adding a StandalonePluginDescriptor inside the plugin aspect (and also using the language jetbrains.mps.lang.plugin.standalone) solved the problem. The action is now visible and selectable in the menu.

There is no "new" for creating such a StandalonePluginDescriptor, I had to copy it from another project, because I could not find how to create it otherwise.

In the MPS project where the above CopyNodeReference was defined such a StandalonePluginDescriptior does exists indeed. However because it is a large project with a large folder structure it was unclear that this has anything to do with the problem.

Thanks,
Jos

I'm glad to help you! Things like this are really hard to figure out.
But after setting up your language imports properly, you should also be able to add a new StandalonePluginDescriptor from the context menu. Perhaps you should run the Optimize Imports procedure for your project.