MPS中的自定义编辑器

问题描述 投票:0回答:1

我在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;
}
dsl mps
1个回答
0
投票

您真正想实现什么?一个例子可能会在这里有所帮助...没有更多的上下文(因此我可能会误解您的问题),我认为您可以为原始编辑器使用EditorComponent(https://www.jetbrains.com/help/mps/editor.html#editorcomponentsandeditorcomponentcells),然后使用“-”常量和后跟EditorComponent的编辑器来获得所需的效果。

© www.soinside.com 2019 - 2024. All rights reserved.