prevent enter key from creating a new child

Hey forum!

I have a very basic question. I have a child list [0..n] of cars, separated by a comma. Now if the user hits enter, it always creates a new child. Instead I only want that behavior for a comma input.

How can I accomplish this?

Regards msch95

3 comments

i think you are looking for an action map: https://confluence.jetbrains.com/display/MPSD34/Editor+cookbook#Editorcookbook-Commoneditorpatterns (scroll down a little).

Here is what you need to do (roughly):

  1. On your editor aspect, add a new "Cell Action Map" (right click on the aspect -> New -> Cell Action Map)
  2. give it a name
  3. applicable concept: Car (I guess that is your concept for the "cars" children)
  4. add an action for INSERT
  5. can execute:press enter to add a function and return "false"
  6. go to your Editor where you want to use this action map to prevent the enter key from firing
  7. select the "cars" reference in the editor
  8. in the inspector, add your new action map to the "action map" row

Best,

Robert

 

1

Thanks Robert! That helped.

0

Will that prevent ctrl+c / ctrl+v as well?

0

Please sign in to leave a comment.