0

我在 Jetbrains MPS 中有一个概念,我想为其创建一个自定义编辑器。

这个概念有许多孩子。

对于每个孩子,我想显示孩子自己的编辑器,但前面有一个“-”。

我不完全确定我是否正在尝试以正确的方式解决这个问题。

但我的第一次尝试是在子节点上循环的自定义单元格。

我的问题是我不知道如何找到子节点的编辑器单元格:

我的手机提供商:

return new AbstractCellProvider(node) {
@Override
public EditorCell createEditorCell(EditorContext ctx) {
  EditorCell_Collection cells = EditorCell_Collection.createVertical(ctx, node);
  foreach n in node.elements {  
    EditorCell_Collection a = EditorCell_Collection.createHorizontal(ctx, node);
    EditorCell_Label label = new EditorCell_Constant(ctx, node, "-");
    a.addEditorCell(label);
    cells.addEditorCell(a);

       how to add the child node's editor here? 

   }
return cells;
}
4

1 回答 1

1

你真正想要达到什么目的?一个例子在这里可能会有所帮助......如果没有进一步的上下文(所以我可能会误解你的问题),我认为你可以使用 EditorComponent (https://www.jetbrains.com/help/mps/editor.html#editorcomponentsandeditorcomponentcells)原始编辑器,然后制作一个带有“-”常量的编辑器,后跟EditorComponent,以达到预期的效果。

于 2019-11-18T03:27:27.417 回答