package jetbrains.mps.lang.editor.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.nodeEditor.cells.EditorCell_Error;
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;
/*package*/ class TransformationLocation_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public TransformationLocation_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createAlternation_h1yxkn_a();
}
private EditorCell createAlternation_h1yxkn_a() {
boolean alternationCondition = true;
alternationCondition = nodeCondition_h1yxkn_a0();
EditorCell editorCell = null;
if (alternationCondition) {
editorCell = createError_h1yxkn_a0();
} else {
editorCell = createComponent_h1yxkn_a0();
}
EditorCell bigCell = BigCellUtil.findBigCell(editorCell, getNode());
if (bigCell != null) {
bigCell.setBig(true);
bigCell.setCellContext(getCellFactory().getCellContext());
}
return editorCell;
}
private boolean nodeCondition_h1yxkn_a0() {
return SConceptOperations.isExactly(SNodeOperations.asSConcept(SNodeOperations.getConcept(myNode)), MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x7c45559defb64aa6L, "jetbrains.mps.lang.editor.structure.TransformationLocation"));
}
private EditorCell createError_h1yxkn_a0() {
EditorCell_Error editorCell = new EditorCell_Error(getEditorContext(), myNode, "<choose location>");
editorCell.setCellId("Error_h1yxkn_a0");
return editorCell;
}
private EditorCell createComponent_h1yxkn_a0() {
EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.lang.core.editor.alias");
Style style = new StyleImpl();
style.set(StyleAttributes.FONT_STYLE, MPSFonts.PLAIN);
editorCell.getStyle().putAll(style);
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new TransformationLocation_EditorBuilder_a.ReplaceWith_TransformationLocation_cellMenu_h1yxkn_a0a0(), new SChildSubstituteInfoPartEx(editorCell)}));
return editorCell;
}
public static class ReplaceWith_TransformationLocation_cellMenu_h1yxkn_a0a0 extends AbstractCellMenuPart_ReplaceNode_CustomNodeConcept {
public ReplaceWith_TransformationLocation_cellMenu_h1yxkn_a0a0() {
}
public SAbstractConcept getReplacementConcept() {
return MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x7c45559defb64aa6L, "jetbrains.mps.lang.editor.structure.TransformationLocation");
}
}
}