package jetbrains.mps.core.xml.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.core.xml.behavior.XmlPart__BehaviorDescriptor;
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.editor.runtime.style.Padding;
import jetbrains.mps.editor.runtime.style.Measure;
import jetbrains.mps.nodeEditor.cells.EditorCell_Constant;
/*package*/ class XmlContent_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public XmlContent_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_91idit_a();
}
private EditorCell createCollection_91idit_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_91idit_a");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
editorCell.addEditorCell(createError_91idit_a0());
if (nodeCondition_91idit_a1a()) {
editorCell.addEditorCell(createConstant_91idit_b0());
}
return editorCell;
}
private boolean nodeCondition_91idit_a1a() {
return (boolean) XmlPart__BehaviorDescriptor.hasNewLineAfter_id1Qs9WekVZ9E.invoke(myNode);
}
private EditorCell createError_91idit_a0() {
EditorCell_Error editorCell = new EditorCell_Error(getEditorContext(), myNode, "<no content>");
editorCell.setCellId("Error_91idit_a0");
Style style = new StyleImpl();
style.set(StyleAttributes.INDENT_LAYOUT_ON_NEW_LINE, _StyleParameter_QueryFunction_91idit_a0a0());
style.set(StyleAttributes.PADDING_LEFT, new Padding(0, Measure.SPACES));
style.set(StyleAttributes.PADDING_RIGHT, new Padding(0, Measure.SPACES));
editorCell.getStyle().putAll(style);
return editorCell;
}
private boolean _StyleParameter_QueryFunction_91idit_a0a0() {
return (boolean) XmlPart__BehaviorDescriptor.onNewLine_id1Qs9WekVZ9$.invoke(getNode());
}
private EditorCell createConstant_91idit_b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "");
editorCell.setCellId("Constant_91idit_b0");
Style style = new StyleImpl();
style.set(StyleAttributes.INDENT_LAYOUT_NEW_LINE, true);
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
}