package jetbrains.mps.lang.generator.editor;
/*Generated by MPS */
import jetbrains.mps.editor.runtime.descriptor.AbstractEditorBuilder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.openapi.editor.EditorContext;
import jetbrains.mps.openapi.editor.cells.EditorCell;
import jetbrains.mps.nodeEditor.cells.EditorCell_Collection;
import jetbrains.mps.nodeEditor.cellLayout.CellLayout_Horizontal;
import jetbrains.mps.nodeEditor.cells.EditorCell_Constant;
import jetbrains.mps.openapi.editor.style.Style;
import jetbrains.mps.editor.runtime.style.StyleImpl;
import jetbrains.mps.lang.generator.editor.Styles_StyleSheet.macroStartStyleClass;
import jetbrains.mps.editor.runtime.style.StyleAttributes;
import jetbrains.mps.editor.runtime.style.FocusPolicy;
import jetbrains.mps.nodeEditor.cellMenu.CompositeSubstituteInfo;
import jetbrains.mps.nodeEditor.cellMenu.BasicCellContext;
import jetbrains.mps.nodeEditor.cellMenu.SubstituteInfoPartExt;
import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfoPartEx;
import java.util.List;
import jetbrains.mps.openapi.editor.cells.SubstituteAction;
import jetbrains.mps.nodeEditor.cellMenu.CellContext;
/*package*/ class LabelMacro_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public LabelMacro_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_x0em22_a();
}
private EditorCell createCollection_x0em22_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal());
editorCell.setCellId("Collection_x0em22_a");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
editorCell.addEditorCell(createConstant_x0em22_a0());
editorCell.addEditorCell(createComponent_x0em22_b0());
return editorCell;
}
private EditorCell createConstant_x0em22_a0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "$LABEL$");
editorCell.setCellId("Constant_x0em22_a0");
Style style = new StyleImpl();
new macroStartStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.PUNCTUATION_RIGHT, false);
style.set(StyleAttributes.LAST_POSITION_ALLOWED, false);
editorCell.getStyle().putAll(style);
if (true) {
editorCell.getStyle().set(StyleAttributes.FOCUS_POLICY, FocusPolicy.ATTRACTS_FOCUS);
}
MacroSymbol_Actions.setCellActions(editorCell, myNode, getEditorContext());
editorCell.setDefaultText("");
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new LabelMacro_EditorBuilder_a.LabelMacro_component_cellMenu_x0em22_a0a0(), new SChildSubstituteInfoPartEx(editorCell)}));
return editorCell;
}
public static class LabelMacro_component_cellMenu_x0em22_a0a0 implements SubstituteInfoPartExt {
private replace_node_macro myComponent;
public LabelMacro_component_cellMenu_x0em22_a0a0() {
this.myComponent = new replace_node_macro();
}
public List<SubstituteAction> createActions(CellContext cellContext, EditorContext editorContext) {
return this.myComponent.createSubstituteActions(cellContext, editorContext);
}
}
private EditorCell createComponent_x0em22_b0() {
EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.lang.generator.editor.NodeMacro_postfix");
return editorCell;
}
}