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.editor.runtime.cells.BigCellUtil;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.nodeEditor.cells.EditorCell_Error;
import jetbrains.mps.openapi.editor.style.Style;
import jetbrains.mps.editor.runtime.style.StyleImpl;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.KeyWordStyleClass;
/*package*/ class Type_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public Type_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createAlternation_a1nfgp_a();
}
private EditorCell createAlternation_a1nfgp_a() {
boolean alternationCondition = true;
alternationCondition = nodeCondition_a1nfgp_a0();
EditorCell editorCell = null;
if (alternationCondition) {
editorCell = createError_a1nfgp_a0();
} else {
editorCell = createComponent_a1nfgp_a0();
}
EditorCell bigCell = BigCellUtil.findBigCell(editorCell, getNode());
if (bigCell != null) {
bigCell.setBig(true);
bigCell.setCellContext(getCellFactory().getCellContext());
}
return editorCell;
}
private boolean nodeCondition_a1nfgp_a0() {
return SNodeOperations.getConcept(myNode).isAbstract();
}
private EditorCell createError_a1nfgp_a0() {
EditorCell_Error editorCell = new EditorCell_Error(getEditorContext(), myNode, "<type>");
editorCell.setCellId("Error_a1nfgp_a0");
return editorCell;
}
private EditorCell createComponent_a1nfgp_a0() {
EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.lang.core.editor.alias");
Style style = new StyleImpl();
new KeyWordStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
return editorCell;
}
}