package jetbrains.mps.baseLanguage.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_Indent;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.internal.collections.runtime.Sequence;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.AttributeOperations;
import jetbrains.mps.openapi.editor.style.Style;
import jetbrains.mps.editor.runtime.style.StyleImpl;
import jetbrains.mps.editor.runtime.style.StyleAttributes;
import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole;
import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.LabelStyleClass;
import jetbrains.mps.nodeEditor.EditorManager;
import jetbrains.mps.nodeEditor.cells.EditorCell_Constant;
import jetbrains.mps.lang.editor.cellProviders.SingleRoleCellProvider;
import org.jetbrains.mps.openapi.language.SContainmentLink;
import jetbrains.mps.openapi.editor.cells.CellActionType;
import jetbrains.mps.editor.runtime.impl.cellActions.CellAction_DeleteSmart;
import jetbrains.mps.openapi.editor.cells.DefaultSubstituteInfo;
import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfo;
import jetbrains.mps.openapi.editor.menus.transformation.SNodeLocation;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.KeyWordStyleClass;
import jetbrains.mps.lang.editor.menus.transformation.NamedTransformationMenuLookup;
import jetbrains.mps.smodel.language.LanguageRegistry;
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 jetbrains.mps.lang.editor.generator.internal.AbstractCellMenuPart_ReplaceNode_CustomNodeConcept;
import org.jetbrains.mps.openapi.language.SAbstractConcept;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.LeftParenStyleClass;
import jetbrains.mps.nodeEditor.cellProviders.AbstractCellListHandler;
import jetbrains.mps.lang.editor.cellProviders.RefNodeListHandler;
import jetbrains.mps.smodel.action.NodeFactoryManager;
import jetbrains.mps.nodeEditor.cellActions.CellAction_DeleteNode;
import jetbrains.mps.lang.editor.cellProviders.RefNodeListHandlerElementKeyMap;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.SemicolonStyleClass;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.RightParenStyleClass;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.LeftBraceStyleClass;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.RightBraceStyleClass;
/*package*/ class ForStatement_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public ForStatement_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_l9yc2b_a();
}
private EditorCell createCollection_l9yc2b_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_l9yc2b_a");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
BigStatement_comment_action.setCellActions(editorCell, myNode, getEditorContext());
if (nodeCondition_l9yc2b_a0a()) {
editorCell.addEditorCell(createCollection_l9yc2b_a0());
}
if (nodeCondition_l9yc2b_a1a()) {
editorCell.addEditorCell(createCollection_l9yc2b_b0());
}
editorCell.addEditorCell(createConstant_l9yc2b_c0());
editorCell.addEditorCell(createConstant_l9yc2b_d0());
editorCell.addEditorCell(createRefNode_l9yc2b_e0());
if (nodeCondition_l9yc2b_a5a()) {
editorCell.addEditorCell(createCollection_l9yc2b_f0());
}
editorCell.addEditorCell(createConstant_l9yc2b_g0());
editorCell.addEditorCell(createRefNode_l9yc2b_h0());
editorCell.addEditorCell(createConstant_l9yc2b_i0());
editorCell.addEditorCell(createRefNodeList_l9yc2b_j0());
editorCell.addEditorCell(createConstant_l9yc2b_k0());
editorCell.addEditorCell(createConstant_l9yc2b_l0());
editorCell.addEditorCell(createRefNode_l9yc2b_m0());
editorCell.addEditorCell(createConstant_l9yc2b_n0());
return editorCell;
}
private boolean nodeCondition_l9yc2b_a0a() {
return !(SPropertyOperations.hasValue(myNode, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x11745b5371dL, "label"), null));
}
private boolean nodeCondition_l9yc2b_a1a() {
return Sequence.fromIterable(AttributeOperations.getChildNodesAndAttributes(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x50c493bf9555131L, "loopLabel"))).isNotEmpty();
}
private boolean nodeCondition_l9yc2b_a5a() {
return Sequence.fromIterable(AttributeOperations.getChildNodesAndAttributes(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a698082feL, 0xe5318742b9d1411L, "additionalVar"))).isNotEmpty();
}
private EditorCell createCollection_l9yc2b_a0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_l9yc2b_a0");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.addEditorCell(createProperty_l9yc2b_a0a());
editorCell.addEditorCell(createConstant_l9yc2b_b0a());
return editorCell;
}
private EditorCell createProperty_l9yc2b_a0a() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("label");
provider.setNoTargetText("<no label>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_label");
Style style = new StyleImpl();
new LabelStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
AbstractLoopStatement_Label_Actions.setCellActions(editorCell, myNode, getEditorContext());
editorCell.setSubstituteInfo(provider.createDefaultSubstituteInfo());
SNode attributeConcept = provider.getRoleAttribute();
if (attributeConcept != null) {
EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext());
return manager.createNodeRoleAttributeCell(attributeConcept, provider.getRoleAttributeKind(), editorCell);
} else
return editorCell;
}
private EditorCell createConstant_l9yc2b_b0a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ":");
editorCell.setCellId("Constant_l9yc2b_b0a");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
style.set(StyleAttributes.EDITABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createCollection_l9yc2b_b0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_l9yc2b_b0");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.addEditorCell(createRefNode_l9yc2b_a1a());
editorCell.addEditorCell(createConstant_l9yc2b_b1a());
return editorCell;
}
private EditorCell createRefNode_l9yc2b_a1a() {
SingleRoleCellProvider provider = new ForStatement_EditorBuilder_a.loopLabelSingleRoleHandler_l9yc2b_a1a(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x50c493bf9555131L, "loopLabel"), getEditorContext());
return provider.createCell();
}
private static class loopLabelSingleRoleHandler_l9yc2b_a1a extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public loopLabelSingleRoleHandler_l9yc2b_a1a(SNode ownerNode, SContainmentLink containmentLink, EditorContext context) {
super(containmentLink, context);
myNode = ownerNode;
}
@Override
@NotNull
public SNode getNode() {
return myNode;
}
protected EditorCell createChildCell(SNode child) {
EditorCell editorCell = getUpdateSession().updateChildNodeCell(child);
editorCell.setAction(CellActionType.DELETE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x50c493bf9555131L, "loopLabel"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x50c493bf9555131L, "loopLabel"), child));
installCellInfo(child, editorCell);
return editorCell;
}
private void installCellInfo(SNode child, EditorCell editorCell) {
if (editorCell.getSubstituteInfo() == null || editorCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) {
editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell, myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x50c493bf9555131L, "loopLabel"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("loopLabel");
}
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x50c493bf9555131L, "loopLabel")));
try {
EditorCell editorCell = super.createEmptyCell();
editorCell.setCellId("empty_loopLabel");
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
protected String getNoTargetText() {
return "<no loopLabel>";
}
}
private EditorCell createConstant_l9yc2b_b1a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ":");
editorCell.setCellId("Constant_l9yc2b_b1a");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
style.set(StyleAttributes.EDITABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_l9yc2b_c0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "for");
editorCell.setCellId("Constant_l9yc2b_c0");
Style style = new StyleImpl();
new KeyWordStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.EDITABLE, true);
editorCell.getStyle().putAll(style);
Delete_Loop.setCellActions(editorCell, myNode, getEditorContext());
editorCell.setTransformationMenuLookup(new NamedTransformationMenuLookup(LanguageRegistry.getInstance(getEditorContext().getRepository()), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, "jetbrains.mps.baseLanguage.structure.AbstractLoopStatement"), "jetbrains.mps.baseLanguage.editor.loopLabelsAndIfStatement"));
editorCell.setDefaultText("");
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new ForStatement_EditorBuilder_a.ReplaceWith_WhileStatement_cellMenu_l9yc2b_a0c0(), new ForStatement_EditorBuilder_a.ReplaceWith_DoWhileStatement_cellMenu_l9yc2b_b0c0(), new ForStatement_EditorBuilder_a.ReplaceWith_ForeachStatement_cellMenu_l9yc2b_c0c0(), new SChildSubstituteInfoPartEx(editorCell)}));
return editorCell;
}
public static class ReplaceWith_WhileStatement_cellMenu_l9yc2b_a0c0 extends AbstractCellMenuPart_ReplaceNode_CustomNodeConcept {
public ReplaceWith_WhileStatement_cellMenu_l9yc2b_a0c0() {
}
public SAbstractConcept getReplacementConcept() {
return MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfaa4bf0f2fL, "jetbrains.mps.baseLanguage.structure.WhileStatement");
}
}
public static class ReplaceWith_DoWhileStatement_cellMenu_l9yc2b_b0c0 extends AbstractCellMenuPart_ReplaceNode_CustomNodeConcept {
public ReplaceWith_DoWhileStatement_cellMenu_l9yc2b_b0c0() {
}
public SAbstractConcept getReplacementConcept() {
return MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x11232674988L, "jetbrains.mps.baseLanguage.structure.DoWhileStatement");
}
}
public static class ReplaceWith_ForeachStatement_cellMenu_l9yc2b_c0c0 extends AbstractCellMenuPart_ReplaceNode_CustomNodeConcept {
public ReplaceWith_ForeachStatement_cellMenu_l9yc2b_c0c0() {
}
public SAbstractConcept getReplacementConcept() {
return MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a6933ce33L, "jetbrains.mps.baseLanguage.structure.ForeachStatement");
}
}
private EditorCell createConstant_l9yc2b_d0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "(");
editorCell.setCellId("Constant_l9yc2b_d0");
Style style = new StyleImpl();
new LeftParenStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNode_l9yc2b_e0() {
SingleRoleCellProvider provider = new ForStatement_EditorBuilder_a.variableSingleRoleHandler_l9yc2b_e0(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a697996feL, 0x10a6979f36bL, "variable"), getEditorContext());
return provider.createCell();
}
private static class variableSingleRoleHandler_l9yc2b_e0 extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public variableSingleRoleHandler_l9yc2b_e0(SNode ownerNode, SContainmentLink containmentLink, EditorContext context) {
super(containmentLink, context);
myNode = ownerNode;
}
@Override
@NotNull
public SNode getNode() {
return myNode;
}
protected EditorCell createChildCell(SNode child) {
EditorCell editorCell = getUpdateSession().updateChildNodeCell(child);
editorCell.setAction(CellActionType.DELETE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a697996feL, 0x10a6979f36bL, "variable"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a697996feL, 0x10a6979f36bL, "variable"), child));
installCellInfo(child, editorCell);
return editorCell;
}
private void installCellInfo(SNode child, EditorCell editorCell) {
if (editorCell.getSubstituteInfo() == null || editorCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) {
editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell, myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a697996feL, 0x10a6979f36bL, "variable"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("variable");
}
HandleFirstForLoopVar.setCellActions(editorCell, getNode(), getEditorContext());
editorCell.addKeyMap(new AddForStatementVar());
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a697996feL, 0x10a6979f36bL, "variable")));
try {
EditorCell editorCell = super.createEmptyCell();
editorCell.setCellId("empty_variable");
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
protected String getNoTargetText() {
return " ";
}
}
private EditorCell createCollection_l9yc2b_f0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_l9yc2b_f0");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.addEditorCell(createConstant_l9yc2b_a5a());
editorCell.addEditorCell(createRefNodeList_l9yc2b_b5a());
return editorCell;
}
private EditorCell createConstant_l9yc2b_a5a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ",");
editorCell.setCellId("Constant_l9yc2b_a5a");
Style style = new StyleImpl();
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
editorCell.getStyle().putAll(style);
DeleteFirstForLoopVarComma.setCellActions(editorCell, myNode, getEditorContext());
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNodeList_l9yc2b_b5a() {
AbstractCellListHandler handler = new ForStatement_EditorBuilder_a.additionalVarListHandler_l9yc2b_b5a(myNode, "additionalVar", getEditorContext());
EditorCell_Collection editorCell = handler.createCells(new CellLayout_Indent(), false);
editorCell.setCellId("refNodeList_additionalVar");
editorCell.setRole(handler.getElementRole());
return editorCell;
}
private static class additionalVarListHandler_l9yc2b_b5a extends RefNodeListHandler {
@NotNull
private SNode myNode;
public additionalVarListHandler_l9yc2b_b5a(SNode ownerNode, String childRole, EditorContext context) {
super(ownerNode, childRole, context, false);
myNode = ownerNode;
}
@Override
@NotNull
public SNode getNode() {
return myNode;
}
public SNode createNodeToInsert(EditorContext editorContext) {
return NodeFactoryManager.createNode(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x19659b074928781eL, "jetbrains.mps.baseLanguage.structure.AdditionalForLoopVariable"), null, getNode(), getNode().getModel());
}
public EditorCell createNodeCell(SNode elementNode) {
EditorCell elementCell = getUpdateSession().updateChildNodeCell(elementNode);
installElementCellActions(elementNode, elementCell);
return elementCell;
}
public EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(additionalVarListHandler_l9yc2b_b5a.this.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a698082feL, 0xe5318742b9d1411L, "additionalVar")));
try {
EditorCell emptyCell = null;
emptyCell = super.createEmptyCell();
installElementCellActions(null, emptyCell);
setCellContext(emptyCell);
return emptyCell;
} finally {
getCellFactory().popCellContext();
}
}
public void installElementCellActions(SNode elementNode, EditorCell elementCell) {
if (elementCell.getUserObject(AbstractCellListHandler.ELEMENT_CELL_ACTIONS_SET) == null) {
elementCell.putUserObject(AbstractCellListHandler.ELEMENT_CELL_ACTIONS_SET, AbstractCellListHandler.ELEMENT_CELL_ACTIONS_SET);
if (elementNode != null) {
elementCell.setAction(CellActionType.DELETE, new CellAction_DeleteNode(elementNode, CellAction_DeleteNode.DeleteDirection.FORWARD));
elementCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteNode(elementNode, CellAction_DeleteNode.DeleteDirection.BACKWARD));
elementCell.addKeyMap(new RefNodeListHandlerElementKeyMap(this, ","));
}
if (elementCell.getSubstituteInfo() == null || elementCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) {
elementCell.setSubstituteInfo(new SChildSubstituteInfo(elementCell, getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a698082feL, 0xe5318742b9d1411L, "additionalVar"), elementNode));
}
}
}
@Override
public EditorCell createSeparatorCell(SNode prevNode, SNode nextNode) {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), getNode(), ",");
editorCell.setSelectable(false);
Style style = new StyleImpl();
style.set(StyleAttributes.LAYOUT_CONSTRAINT, "");
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
editorCell.getStyle().putAll(style);
editorCell.setAction(CellActionType.DELETE, new CellAction_DeleteNode(prevNode, CellAction_DeleteNode.DeleteDirection.FORWARD));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteNode(prevNode, CellAction_DeleteNode.DeleteDirection.BACKWARD));
return editorCell;
}
}
private EditorCell createConstant_l9yc2b_g0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ";");
editorCell.setCellId("Constant_l9yc2b_g0");
Style style = new StyleImpl();
new SemicolonStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNode_l9yc2b_h0() {
SingleRoleCellProvider provider = new ForStatement_EditorBuilder_a.conditionSingleRoleHandler_l9yc2b_h0(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a698082feL, 0x10a69819132L, "condition"), getEditorContext());
return provider.createCell();
}
private static class conditionSingleRoleHandler_l9yc2b_h0 extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public conditionSingleRoleHandler_l9yc2b_h0(SNode ownerNode, SContainmentLink containmentLink, EditorContext context) {
super(containmentLink, context);
myNode = ownerNode;
}
@Override
@NotNull
public SNode getNode() {
return myNode;
}
protected EditorCell createChildCell(SNode child) {
EditorCell editorCell = getUpdateSession().updateChildNodeCell(child);
editorCell.setAction(CellActionType.DELETE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a698082feL, 0x10a69819132L, "condition"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a698082feL, 0x10a69819132L, "condition"), child));
installCellInfo(child, editorCell);
return editorCell;
}
private void installCellInfo(SNode child, EditorCell editorCell) {
if (editorCell.getSubstituteInfo() == null || editorCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) {
editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell, myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a698082feL, 0x10a69819132L, "condition"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("condition");
}
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a698082feL, 0x10a69819132L, "condition")));
try {
EditorCell editorCell = super.createEmptyCell();
editorCell.setCellId("empty_condition");
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
protected String getNoTargetText() {
return " ";
}
}
private EditorCell createConstant_l9yc2b_i0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ";");
editorCell.setCellId("Constant_l9yc2b_i0");
Style style = new StyleImpl();
new SemicolonStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNodeList_l9yc2b_j0() {
AbstractCellListHandler handler = new ForStatement_EditorBuilder_a.iterationListHandler_l9yc2b_j0(myNode, "iteration", getEditorContext());
EditorCell_Collection editorCell = handler.createCells(new CellLayout_Indent(), false);
editorCell.setCellId("refNodeList_iteration");
editorCell.setRole(handler.getElementRole());
return editorCell;
}
private static class iterationListHandler_l9yc2b_j0 extends RefNodeListHandler {
@NotNull
private SNode myNode;
public iterationListHandler_l9yc2b_j0(SNode ownerNode, String childRole, EditorContext context) {
super(ownerNode, childRole, context, false);
myNode = ownerNode;
}
@Override
@NotNull
public SNode getNode() {
return myNode;
}
public SNode createNodeToInsert(EditorContext editorContext) {
return NodeFactoryManager.createNode(MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37f506fL, "jetbrains.mps.baseLanguage.structure.Expression"), null, getNode(), getNode().getModel());
}
public EditorCell createNodeCell(SNode elementNode) {
EditorCell elementCell = getUpdateSession().updateChildNodeCell(elementNode);
installElementCellActions(elementNode, elementCell);
return elementCell;
}
public EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(iterationListHandler_l9yc2b_j0.this.getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a698082feL, 0x10a6981b2c5L, "iteration")));
try {
EditorCell emptyCell = null;
emptyCell = createConstant_l9yc2b_a9a();
installElementCellActions(null, emptyCell);
setCellContext(emptyCell);
return emptyCell;
} finally {
getCellFactory().popCellContext();
}
}
public void installElementCellActions(SNode elementNode, EditorCell elementCell) {
if (elementCell.getUserObject(AbstractCellListHandler.ELEMENT_CELL_ACTIONS_SET) == null) {
elementCell.putUserObject(AbstractCellListHandler.ELEMENT_CELL_ACTIONS_SET, AbstractCellListHandler.ELEMENT_CELL_ACTIONS_SET);
if (elementNode != null) {
elementCell.setAction(CellActionType.DELETE, new CellAction_DeleteNode(elementNode, CellAction_DeleteNode.DeleteDirection.FORWARD));
elementCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteNode(elementNode, CellAction_DeleteNode.DeleteDirection.BACKWARD));
elementCell.addKeyMap(new RefNodeListHandlerElementKeyMap(this, ","));
}
if (elementCell.getSubstituteInfo() == null || elementCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) {
elementCell.setSubstituteInfo(new SChildSubstituteInfo(elementCell, getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10a698082feL, 0x10a6981b2c5L, "iteration"), elementNode));
}
}
}
@Override
public EditorCell createSeparatorCell(SNode prevNode, SNode nextNode) {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), getNode(), ",");
editorCell.setSelectable(false);
Style style = new StyleImpl();
style.set(StyleAttributes.LAYOUT_CONSTRAINT, "");
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
editorCell.getStyle().putAll(style);
editorCell.setAction(CellActionType.DELETE, new CellAction_DeleteNode(prevNode, CellAction_DeleteNode.DeleteDirection.FORWARD));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteNode(prevNode, CellAction_DeleteNode.DeleteDirection.BACKWARD));
return editorCell;
}
private EditorCell createConstant_l9yc2b_a9a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "");
editorCell.setCellId("Constant_l9yc2b_a9a");
Style style = new StyleImpl();
style.set(StyleAttributes.EDITABLE, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
}
private EditorCell createConstant_l9yc2b_k0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ")");
editorCell.setCellId("Constant_l9yc2b_k0");
Style style = new StyleImpl();
new RightParenStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_l9yc2b_l0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "{");
editorCell.setCellId("Constant_l9yc2b_l0");
Style style = new StyleImpl();
new LeftBraceStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.INDENT_LAYOUT_NEW_LINE, true);
editorCell.getStyle().putAll(style);
Delete_Loop.setCellActions(editorCell, myNode, getEditorContext());
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNode_l9yc2b_m0() {
SingleRoleCellProvider provider = new ForStatement_EditorBuilder_a.bodySingleRoleHandler_l9yc2b_m0(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x10cb1ada6e8L, "body"), getEditorContext());
return provider.createCell();
}
private static class bodySingleRoleHandler_l9yc2b_m0 extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public bodySingleRoleHandler_l9yc2b_m0(SNode ownerNode, SContainmentLink containmentLink, EditorContext context) {
super(containmentLink, context);
myNode = ownerNode;
}
@Override
@NotNull
public SNode getNode() {
return myNode;
}
protected EditorCell createChildCell(SNode child) {
EditorCell editorCell = getUpdateSession().updateChildNodeCell(child);
editorCell.setAction(CellActionType.DELETE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x10cb1ada6e8L, "body"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x10cb1ada6e8L, "body"), child));
installCellInfo(child, editorCell);
return editorCell;
}
private void installCellInfo(SNode child, EditorCell editorCell) {
if (editorCell.getSubstituteInfo() == null || editorCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) {
editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell, myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x10cb1ada6e8L, "body"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("body");
}
Style style = new StyleImpl();
style.set(StyleAttributes.INDENT_LAYOUT_INDENT, true);
style.set(StyleAttributes.INDENT_LAYOUT_NEW_LINE, true);
editorCell.getStyle().putAll(style);
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10cb1ac5adeL, 0x10cb1ada6e8L, "body")));
try {
EditorCell editorCell = super.createEmptyCell();
editorCell.setCellId("empty_body");
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
protected String getNoTargetText() {
return "<no body>";
}
}
private EditorCell createConstant_l9yc2b_n0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "}");
editorCell.setCellId("Constant_l9yc2b_n0");
Style style = new StyleImpl();
new RightBraceStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.INDENT_LAYOUT_NEW_LINE, true);
editorCell.getStyle().putAll(style);
Delete_Loop.setCellActions(editorCell, myNode, getEditorContext());
editorCell.setDefaultText("");
return editorCell;
}
}