Skip to content

Action Aspect¶ ⧉

The action aspect defines node factories and copy/paste related handlers.

Are node factories used when calling new node?

No. Editor Actions | MPS contains more information.

Where can you find all key mappings for the editor?

MPSEditorActions.xml ⧉ contains Windows and Mac shortcuts for editor actions.

Why is a custom action map not executed on a CellModel_Collection?

I can reference an action map from an editor collection cell in MPS.

cellmodel collection: inspector

However, my defined actions are never executed when the editor is used. Why is this so, and how to fix it?

Reason for the Problem

In general, the applied actions should be invoked and executed. However, depending on the content of the collection cells, MPS might generate some default actions which will override your custom actions.


You have a read-only model access cell inside the collection cell:

alias and read-only modelaccess

In this case, the internal MPS generator for CellModel_ReadOnlyModelAccessor will automatically generate and register some default actions like delete/backspace ⧉, which in the end, will prohibit your custom action from being applied.


You can use the cell explorer (Language DebugShow Cell in Explorer) to see which actions are defined for a cell. Deactivate the automatically applied action with the help of custom editor cells (CellModel_CustomFactory ⧉). You can use CellModel_CustomFactory to wrap the cells in your collection which generate unwanted actions and deactivate them.

custom factory cell delete actions

contributed by: @arimer

Can you create a copy-paste handler/paste wrapper for arbitrary concepts?

Yes, the handlers can be created for any concept, e.g. ClassConcept. You don't have to use the language containing the handler in the model.

How can I call the copy-and-paste handler programmatically?

  • Copy: DataTransferManager.getInstance().preProcessNode()
  • Paste: DataTransferManager.getInstance().postProcessNode()

CopyPasteUtil ⧉ can help you with those two actions.

I have an interface IStatementand two concepts StatementA, and StatementB, that implement that interface. I paste a node of concept StatementA into a node of concept StatementB into a role that accepts IStatement. Why is the paste wrapper not called?

A paste wrapper only modifies the pasted node if it can change the source concept to the target concept and if the pasted node is not already an instance of the target concept. In the described case, the node of concept StatementA is already an instance of IStatement, and the paste wrapper is not called.

Edit: Not sure if this is really correct. Maybe the problem was rather that the paste wrapper was not implement for the direct concept but for the common interface.