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.SNodeOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.baseLanguage.behavior.Expression__BehaviorDescriptor;
import jetbrains.mps.nodeEditor.cells.EditorCell_Constant;
import jetbrains.mps.openapi.editor.style.Style;
import jetbrains.mps.editor.runtime.style.StyleImpl;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.CommentStyleClass;
import jetbrains.mps.editor.runtime.style.StyleAttributes;
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;
/*package*/ class Expression_VisibleExpressionBoundaries_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public Expression_VisibleExpressionBoundaries_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_nejlv4_a();
}
private EditorCell createCollection_nejlv4_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_nejlv4_a");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
if (nodeCondition_nejlv4_a0a()) {
editorCell.addEditorCell(createConstant_nejlv4_a0());
}
editorCell.addEditorCell(createNextEditor_nejlv4_b0());
if (nodeCondition_nejlv4_a2a()) {
editorCell.addEditorCell(createConstant_nejlv4_c0());
}
return editorCell;
}
private boolean nodeCondition_nejlv4_a0a() {
return SNodeOperations.isInstanceOf(SNodeOperations.getParent(myNode), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37f506fL, "jetbrains.mps.baseLanguage.structure.Expression")) && (!((boolean) Expression__BehaviorDescriptor.singleValue_id1o8Ht9sES3u.invoke(SNodeOperations.asSConcept(SNodeOperations.getConcept(myNode))))) && !(SNodeOperations.getConcept(myNode).isAbstract()) && !(SNodeOperations.isInstanceOf(myNode, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfb4ed32b7fL, "jetbrains.mps.baseLanguage.structure.ParenthesizedExpression")));
}
private boolean nodeCondition_nejlv4_a2a() {
return SNodeOperations.isInstanceOf(SNodeOperations.getParent(myNode), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37f506fL, "jetbrains.mps.baseLanguage.structure.Expression")) && (!((boolean) Expression__BehaviorDescriptor.singleValue_id1o8Ht9sES3u.invoke(SNodeOperations.asSConcept(SNodeOperations.getConcept(myNode)))) && !(SNodeOperations.getConcept(myNode).isAbstract())) && !(SNodeOperations.isInstanceOf(myNode, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfb4ed32b7fL, "jetbrains.mps.baseLanguage.structure.ParenthesizedExpression")));
}
private EditorCell createConstant_nejlv4_a0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "[");
editorCell.setCellId("Constant_nejlv4_a0");
Style style = new StyleImpl();
new CommentStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.PUNCTUATION_RIGHT, true);
style.set(StyleAttributes.EDITABLE, false);
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createNextEditor_nejlv4_b0() {
{
EditorCell editorCell = getCellFactory().createEditorCell(myNode, false, Expression_VisibleExpressionBoundaries_Editor.class);
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new Expression_VisibleExpressionBoundaries_EditorBuilder_a.ReplaceWith_Expression_cellMenu_nejlv4_a0b0(), new SChildSubstituteInfoPartEx(editorCell)}));
return editorCell;
}
}
public static class ReplaceWith_Expression_cellMenu_nejlv4_a0b0 extends AbstractCellMenuPart_ReplaceNode_CustomNodeConcept {
public ReplaceWith_Expression_cellMenu_nejlv4_a0b0() {
}
public SAbstractConcept getReplacementConcept() {
return MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37f506fL, "jetbrains.mps.baseLanguage.structure.Expression");
}
}
private EditorCell createConstant_nejlv4_c0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "]");
editorCell.setCellId("Constant_nejlv4_c0");
Style style = new StyleImpl();
new CommentStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
style.set(StyleAttributes.EDITABLE, false);
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
}