Creating instances via dropdown menu

Hi everybody,

i'm looking for something like this:

given :
  • Concept A which has a reference to a single item of a list consisting of instances of Concept B
  • Editor for Concept A has a link declaration, such that I get a dropdown menu with the available instances of Concept B
  • (so far very easy...)

wanted :
  1. extending the dropdown menu with something like "New instance of Concept B", such that a new instance is created and added to the list.
  2. when the first point works: is it possible to create a new root node via the dropdown menu "New instance.." ??

I could not find anything about this in the forum or the user guide. (Maybe I was not looking for the right term...)

Would be very thankful for any advice or documentation link. :-)

Kind regards,
zappl
1 comment
Ok, meanwhile, I have found it myself... :-)

If anybody is interested:

One has to create a "generic menu item" in the inspector of editor cell.

The user guide says: "This kind of cell menu part allows one to make MPS perform an arbitrary action when a respective menu item will be selected in a completion menu. One should specify matching text for a menu item and write a function which does what one wants."

generic item
   matching text : add field
   handler       : (node, model, scope, operationContext)->void {
       node.field.add new (<default>) ;
prettyPrint();
Creating new root nodes is done with the following action:

node.field = model.new root node(<no concept>);
prettyPrint();

Have fun,
zappl
0

Please sign in to leave a comment.