package jetbrains.mps.lang.smodel.query.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.cells.EditorCell_Error;
/*package*/ class QueryParameter_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public QueryParameter_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createAlternation_pp9zo5_a();
}
private EditorCell createAlternation_pp9zo5_a() {
boolean alternationCondition = true;
alternationCondition = nodeCondition_pp9zo5_a0();
EditorCell editorCell = null;
if (alternationCondition) {
editorCell = createComponent_pp9zo5_a0();
} else {
editorCell = createError_pp9zo5_a0();
}
EditorCell bigCell = BigCellUtil.findBigCell(editorCell, getNode());
if (bigCell != null) {
bigCell.setBig(true);
bigCell.setCellContext(getCellFactory().getCellContext());
}
return editorCell;
}
private boolean nodeCondition_pp9zo5_a0() {
return !(SConceptOperations.isExactly(SNodeOperations.asSConcept(SNodeOperations.getConcept(myNode)), MetaAdapterFactory.getConcept(0x1a8554c4eb8443baL, 0x8c346f0d90c6e75aL, 0x3bc64421760badf5L, "jetbrains.mps.lang.smodel.query.structure.QueryParameter")));
}
private EditorCell createComponent_pp9zo5_a0() {
EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.lang.core.editor.alias");
Style style = new StyleImpl();
style.set(StyleAttributes.AUTO_DELETABLE, _StyleParameter_QueryFunction_pp9zo5_a0a0());
editorCell.getStyle().putAll(style);
return editorCell;
}
private boolean _StyleParameter_QueryFunction_pp9zo5_a0a0() {
return SNodeOperations.getNextSibling(getNode()) == null && SNodeOperations.getPrevSibling(getNode()) == null;
}
private EditorCell createError_pp9zo5_a0() {
EditorCell_Error editorCell = new EditorCell_Error(getEditorContext(), myNode, "<parameter>");
editorCell.setCellId("Error_pp9zo5_a0");
return editorCell;
}
}