package jetbrains.mps.lang.smodel.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.editor.runtime.cells.BigCellUtil;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SConceptOperations;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
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.MPSFonts;
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.nodeEditor.cells.EditorCell_Error;
/*package*/ class SConceptOperation_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public SConceptOperation_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createAlternation_z8oglp_a();
}
private EditorCell createAlternation_z8oglp_a() {
boolean alternationCondition = true;
alternationCondition = nodeCondition_z8oglp_a0();
EditorCell editorCell = null;
if (alternationCondition) {
editorCell = createComponent_z8oglp_a0();
} else {
editorCell = createError_z8oglp_a0();
}
EditorCell bigCell = BigCellUtil.findBigCell(editorCell, getNode());
if (bigCell != null) {
bigCell.setBig(true);
bigCell.setCellContext(getCellFactory().getCellContext());
}
return editorCell;
}
private boolean nodeCondition_z8oglp_a0() {
return !(SConceptOperations.isExactly(SNodeOperations.asSConcept(SNodeOperations.getConcept(myNode)), MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x5f5952af8843faf9L, "jetbrains.mps.lang.smodel.structure.SConceptOperation")));
}
private EditorCell createComponent_z8oglp_a0() {
EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.lang.core.editor.alias");
Style style = new StyleImpl();
style.set(StyleAttributes.FONT_STYLE, MPSFonts.BOLD);
editorCell.getStyle().putAll(style);
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new SConceptOperation_EditorBuilder_a.ReplaceWith_SConceptOperation_cellMenu_z8oglp_a0a0(), new SChildSubstituteInfoPartEx(editorCell)}));
return editorCell;
}
public static class ReplaceWith_SConceptOperation_cellMenu_z8oglp_a0a0 extends AbstractCellMenuPart_ReplaceNode_CustomNodeConcept {
public ReplaceWith_SConceptOperation_cellMenu_z8oglp_a0a0() {
}
public SAbstractConcept getReplacementConcept() {
return MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x5f5952af8843faf9L, "jetbrains.mps.lang.smodel.structure.SConceptOperation");
}
}
private EditorCell createError_z8oglp_a0() {
EditorCell_Error editorCell = new EditorCell_Error(getEditorContext(), myNode, "<choose operaion>");
editorCell.setCellId("Error_z8oglp_a0");
return editorCell;
}
}