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_Constant;
import jetbrains.mps.openapi.editor.style.Style;
import jetbrains.mps.editor.runtime.style.StyleImpl;
import jetbrains.mps.core.xml.editor.XmlSS_StyleSheet.xmlTagPunctuationStyleClass;
import jetbrains.mps.editor.runtime.style.StyleAttributes;
import jetbrains.mps.core.xml.editor.XmlSS_StyleSheet.xmlTagNameStyleClass;
import jetbrains.mps.core.xml.editor.XmlSS_StyleSheet.xmlAttributeNameStyleClass;
import jetbrains.mps.core.xml.editor.XmlSS_StyleSheet.xmlAttributeValueStyleClass;
import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole;
import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider;
import jetbrains.mps.nodeEditor.EditorManager;
/*package*/ class XmlDeclaration_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public XmlDeclaration_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_axvdb8_a();
}
private EditorCell createCollection_axvdb8_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_axvdb8_a");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
editorCell.addEditorCell(createAlternation_axvdb8_a0());
editorCell.addEditorCell(createCollection_axvdb8_b0());
editorCell.addEditorCell(createAlternation_axvdb8_c0());
return editorCell;
}
private EditorCell createAlternation_axvdb8_a0() {
boolean alternationCondition = true;
alternationCondition = nodeCondition_axvdb8_a0a();
EditorCell editorCell = null;
if (alternationCondition) {
editorCell = createConstant_axvdb8_a0a();
} else {
editorCell = createConstant_axvdb8_a0a_0();
}
return editorCell;
}
private boolean nodeCondition_axvdb8_a0a() {
return (boolean) XmlPart__BehaviorDescriptor.isFirstPositionAllowed_id1Qs9WekVZ7m.invoke(myNode);
}
private EditorCell createConstant_axvdb8_a0a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "<?");
editorCell.setCellId("Constant_axvdb8_a0a");
Style style = new StyleImpl();
new xmlTagPunctuationStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.MATCHING_LABEL, "openTag");
style.set(StyleAttributes.PUNCTUATION_RIGHT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_axvdb8_a0a_0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "<?");
editorCell.setCellId("Constant_axvdb8_a0a_0");
Style style = new StyleImpl();
new xmlTagPunctuationStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.PUNCTUATION_RIGHT, true);
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
style.set(StyleAttributes.MATCHING_LABEL, "openTag");
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createCollection_axvdb8_b0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_axvdb8_b0");
editorCell.addEditorCell(createConstant_axvdb8_a1a());
editorCell.addEditorCell(createCollection_axvdb8_b1a());
editorCell.addEditorCell(createCollection_axvdb8_c1a());
editorCell.addEditorCell(createCollection_axvdb8_d1a());
return editorCell;
}
private EditorCell createConstant_axvdb8_a1a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "xml");
editorCell.setCellId("Constant_axvdb8_a1a");
Style style = new StyleImpl();
new xmlTagNameStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createCollection_axvdb8_b1a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_axvdb8_b1a");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.addEditorCell(createConstant_axvdb8_a1b0());
editorCell.addEditorCell(createConstant_axvdb8_b1b0());
editorCell.addEditorCell(createConstant_axvdb8_c1b0());
editorCell.addEditorCell(createProperty_axvdb8_d1b0());
editorCell.addEditorCell(createConstant_axvdb8_e1b0());
return editorCell;
}
private EditorCell createConstant_axvdb8_a1b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "version");
editorCell.setCellId("Constant_axvdb8_a1b0");
Style style = new StyleImpl();
new xmlAttributeNameStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_axvdb8_b1b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "=");
editorCell.setCellId("Constant_axvdb8_b1b0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_axvdb8_c1b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "\"");
editorCell.setCellId("Constant_axvdb8_c1b0");
Style style = new StyleImpl();
new xmlAttributeValueStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.PUNCTUATION_RIGHT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createProperty_axvdb8_d1b0() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("version");
provider.setNoTargetText("<no version>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_version");
Style style = new StyleImpl();
new xmlAttributeValueStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setSubstituteInfo(provider.createDefaultSubstituteInfo());
SNode attributeConcept = provider.getRoleAttribute();
if (attributeConcept != null) {
EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext());
return manager.createNodeRoleAttributeCell(attributeConcept, provider.getRoleAttributeKind(), editorCell);
} else
return editorCell;
}
private EditorCell createConstant_axvdb8_e1b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "\"");
editorCell.setCellId("Constant_axvdb8_e1b0");
Style style = new StyleImpl();
new xmlAttributeValueStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createCollection_axvdb8_c1a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_axvdb8_c1a");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.addEditorCell(createConstant_axvdb8_a2b0());
editorCell.addEditorCell(createConstant_axvdb8_b2b0());
editorCell.addEditorCell(createConstant_axvdb8_c2b0());
editorCell.addEditorCell(createProperty_axvdb8_d2b0());
editorCell.addEditorCell(createConstant_axvdb8_e2b0());
return editorCell;
}
private EditorCell createConstant_axvdb8_a2b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "encoding");
editorCell.setCellId("Constant_axvdb8_a2b0");
Style style = new StyleImpl();
new xmlAttributeNameStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_axvdb8_b2b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "=");
editorCell.setCellId("Constant_axvdb8_b2b0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_axvdb8_c2b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "\"");
editorCell.setCellId("Constant_axvdb8_c2b0");
Style style = new StyleImpl();
new xmlAttributeValueStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.PUNCTUATION_RIGHT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createProperty_axvdb8_d2b0() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("encoding");
provider.setNoTargetText("default");
provider.setAllowsEmptyTarget(true);
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_encoding");
Style style = new StyleImpl();
new xmlAttributeValueStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setSubstituteInfo(provider.createDefaultSubstituteInfo());
SNode attributeConcept = provider.getRoleAttribute();
if (attributeConcept != null) {
EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext());
return manager.createNodeRoleAttributeCell(attributeConcept, provider.getRoleAttributeKind(), editorCell);
} else
return editorCell;
}
private EditorCell createConstant_axvdb8_e2b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "\"");
editorCell.setCellId("Constant_axvdb8_e2b0");
Style style = new StyleImpl();
new xmlAttributeValueStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createCollection_axvdb8_d1a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_axvdb8_d1a");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.addEditorCell(createConstant_axvdb8_a3b0());
editorCell.addEditorCell(createConstant_axvdb8_b3b0());
editorCell.addEditorCell(createConstant_axvdb8_c3b0());
editorCell.addEditorCell(createProperty_axvdb8_d3b0());
editorCell.addEditorCell(createConstant_axvdb8_e3b0());
return editorCell;
}
private EditorCell createConstant_axvdb8_a3b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "standalone");
editorCell.setCellId("Constant_axvdb8_a3b0");
Style style = new StyleImpl();
new xmlAttributeNameStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_axvdb8_b3b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "=");
editorCell.setCellId("Constant_axvdb8_b3b0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_axvdb8_c3b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "\"");
editorCell.setCellId("Constant_axvdb8_c3b0");
Style style = new StyleImpl();
new xmlAttributeValueStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.PUNCTUATION_RIGHT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createProperty_axvdb8_d3b0() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("standalone");
provider.setNoTargetText("default");
provider.setAllowsEmptyTarget(true);
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_standalone");
Style style = new StyleImpl();
new xmlAttributeValueStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setSubstituteInfo(provider.createDefaultSubstituteInfo());
SNode attributeConcept = provider.getRoleAttribute();
if (attributeConcept != null) {
EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext());
return manager.createNodeRoleAttributeCell(attributeConcept, provider.getRoleAttributeKind(), editorCell);
} else
return editorCell;
}
private EditorCell createConstant_axvdb8_e3b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "\"");
editorCell.setCellId("Constant_axvdb8_e3b0");
Style style = new StyleImpl();
new xmlAttributeValueStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createAlternation_axvdb8_c0() {
boolean alternationCondition = true;
alternationCondition = nodeCondition_axvdb8_a2a();
EditorCell editorCell = null;
if (alternationCondition) {
editorCell = createConstant_axvdb8_a2a();
} else {
editorCell = createConstant_axvdb8_a2a_0();
}
return editorCell;
}
private boolean nodeCondition_axvdb8_a2a() {
return (boolean) XmlPart__BehaviorDescriptor.isLastPositionAllowed_id1Qs9WekVZ8v.invoke(myNode);
}
private EditorCell createConstant_axvdb8_a2a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "?>");
editorCell.setCellId("Constant_axvdb8_a2a");
Style style = new StyleImpl();
new xmlTagPunctuationStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.MATCHING_LABEL, "openTag");
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_axvdb8_a2a_0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "?>");
editorCell.setCellId("Constant_axvdb8_a2a_0");
Style style = new StyleImpl();
new xmlTagPunctuationStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.PUNCTUATION_RIGHT, true);
style.set(StyleAttributes.MATCHING_LABEL, "openTag");
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
}