Own NEW entries in the Popup-Menu


when i click on structure etc. and click on new.
There are a couple of concepts that fit best.
All other concepts are hidden in subfolders (e.g. baselang).

How can I achieve this for my language?

unfortunately, MPS does not allow you to make "prioritized" concepts by yourself.
The thing with language aspects is that each aspect has its "main" language, so the "new" menu behaves correspondingly. Now there's no way of defining a "main" language for any other model.

BTW, could you please describe how do you determine the "main" language for your models? Maybe we could then implement such a feature in 2.0.1 or 2.1 version (at least, we can add an anchor at the beginning of CreateRootNode action group in MPS, so that you can add your custom group there, this is possible even for 2.0.1).
If you are developing your own IDE with a "main" language in it, you can just change the CreteRootNodeGroup in Java code or CreateRootNode action group in MPS.

I have a similar need. I'd like my solution module looks like a language module: right-click on module -> new -> The A aspect (creates a model with red icon and the language "A" used by default) or ... -> new -> The B aspect (green icon and the language "B" used by default).
Can I achieve this?

...and I've forgotten: model B has model A as a default import:)

Excuse me for rerising the question. I'm going to describe some complicated entity – there will be several tens of rootable concepts. It would be nice to put them in several models(aspects) with predefined properties: default language, default imports, etc. Nice example is the language module: it has structure aspect (using structure language), editor aspect (using editor language, imports structure model), etc.

Can I create such module definition?

Hi, Alexey.

Sorry for not answering for too long - I haven't received a notification about your previous post.

If I heard you aright, what you need is custom create-actions for your "special" models, wich will allow to do something with those models at construction time.

MPS supports such a case. You just need to create some language and create the "plugin" aspect in it. Then you need to describe your own actions for new model types creation and add them to existing popup.

For details, please look at LanguageActions, LanguageNewActions and LanguageNewCustomPartActions action groups (to find them, press ctrl-n and type the names) - those groups describe the structure of the language popup menu. You'll need to integrate with the same menu for solution (the top group is called SolutionActions).
NewAspectModel action (used in LanguageNewCustomPartActions) shows how to create models and change them.

If you have any further questions, feel free to ask.

Mihail, thanks for your answer! I'll try it in the nearest future.

I've found LanguageActions and LanguageNewActions but not the last one – LanguageNewCustomPartActions. Search with Ctrl-N didn't return anything about it. Could you please provide the path from "Modules Pool" so I could find it manually.
I've created my plugin aspect with NewActions group, but I'm still missing what is "-> newAspect" and where should I configure my aspects..
Still can't find anything. Is there any documentation about this (except wiki page "Plugin")?

I've found that this group was not included in build, so you can see it only if you are running on sources. Filed an issue: MPS-14175

The "-> newAspect" is a so-called "anchor", a place, where you can insert your own group.

So, you create your group, let's call it "MyNewAspects". Then you describe actions for new aspects creation, add them to MyNewAspects. Now you have a group of actions which you can insert into another group. To do this, you should go to the "modifications" part and add a modification statement there like:
add to LanguageNewActions at position newAspects 

After generating your language, you'll see your new actions in the "new" popup on a language.

Attaching the screenshots of the LanguageNewCustomPart and the NewAspectModel actions so that you could at least see what's there

Screen shot 2011-09-22 at 4.38.43 PM.png

Screen shot 2011-09-22 at 4.39.02 PM.png
I'll try to implement the same within my project! Thanks a lot!

Please sign in to leave a comment.