Custom EditCell

Hi, I am playing with MPS and I would like to implement a custom EditCell.

I have to implement this EditCellProvider which should return EditCells. WHere I can find information on the methods to implement? There are abstract classes partially implementing EditCell which I am suppose to extend?

Thank you a lot,

Federico Tomassetti

Comment actions Permalink


Unfortunately we do not have (i think any) documentation describing how to extend MPS editor with your custom Cells. Basicly to extend editor with your custom cells you have to:

  • Create new language and define sub-cpncept(s) of EditorCellModel concept (from jetbrains.mps.lang.editor) there. Concepts defined in this language will be inserted into language definition of "target" editor and keep necessary properties describing this custom cell.
  • Define editors and generators for this custom EditoeCellModel(s). Concerning the generator - it's good idea to use one of existing generators for EditorCellModel sub-concepts as an example
  • This generator will be used to generate corresponding factory methods in ????_Editor java class initializing and returning instances of jetbrains.mps.nodeEditor.cells.EditorCell interface - this interface used in runtime to represent hierarchy of actual MPS editor cells.

this is all you need to do for this task, but you'll probably need some more details concerning these steps, so do not hesitate to ask me. :-)

Concerning your questions about existing code reuse - you can extends your CustomEditorCell (runtime model) either from jetbrains.mps.nodeEditor.cells.EditorCell_Collection or jetbrains.mps.nodeEditor.cells.EditorCell_Label (or any other EditorCell interface implementors if you need your really custom cells)

Comment actions Permalink

I just realized that I actually did not answer original question ;-)

$custom cell$ can be used, as you properly mentioned, to point to a sub-class of AbstractCellProvider. Sub-classes of AbstractCellProvider will be generated by MPS for each of defined "editor component" (except of an editor in MPS you can define "reusable" editor component for any concept). I doubt it make sense to reuse any of MPS-generated AbstractCellProvider subclasses - in this case you can just reuse corresponding editor components directly in editor definition.

In case you'd like to create some custom EditorCell subclasses and use these subclasses in an editor with a sub-class of AbstractCellProvider you can initialize corresponding runtime cell hierarchy ad plug it into MPS editor. In a bit more sophisticated or generic situations then you need to parametrize custom EditorCell you have to probably follow my first suggestion. ;-)


Please sign in to leave a comment.