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.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
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.xmlTagNameStyleClass;
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 java.util.List;
import jetbrains.mps.openapi.editor.cells.SubstituteAction;
import jetbrains.mps.nodeEditor.cellMenu.CellContext;
import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole;
import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider;
import jetbrains.mps.core.xml.editor.XmlSS_StyleSheet.xmlAttributeValueStyleClass;
import jetbrains.mps.nodeEditor.EditorManager;
/*package*/ class XmlExternalId_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public XmlExternalId_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_dsthrr_a();
}
private EditorCell createCollection_dsthrr_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_dsthrr_a");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
editorCell.addEditorCell(createAlternation_dsthrr_a0());
editorCell.addEditorCell(createProperty_dsthrr_b0());
return editorCell;
}
private EditorCell createAlternation_dsthrr_a0() {
boolean alternationCondition = true;
alternationCondition = nodeCondition_dsthrr_a0a();
EditorCell editorCell = null;
if (alternationCondition) {
editorCell = createCollection_dsthrr_a0a();
} else {
editorCell = createConstant_dsthrr_a0a();
}
return editorCell;
}
private boolean nodeCondition_dsthrr_a0a() {
return SPropertyOperations.getBoolean(myNode, MetaAdapterFactory.getProperty(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x1d9c27c394f6033fL, 0x1d9c27c394f60345L, "isPublic"));
}
private EditorCell createCollection_dsthrr_a0a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_dsthrr_a0a");
editorCell.addEditorCell(createConstant_dsthrr_a0a0());
editorCell.addEditorCell(createProperty_dsthrr_b0a0());
return editorCell;
}
private EditorCell createConstant_dsthrr_a0a0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "PUBLIC");
editorCell.setCellId("Constant_dsthrr_a0a0");
Style style = new StyleImpl();
new xmlTagNameStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new XmlExternalId_EditorBuilder_a.XmlExternalId_component_cellMenu_dsthrr_a0a0a0(), new SChildSubstituteInfoPartEx(editorCell)}));
return editorCell;
}
public static class XmlExternalId_component_cellMenu_dsthrr_a0a0a0 implements SubstituteInfoPartExt {
private ExternalIdMenu myComponent;
public XmlExternalId_component_cellMenu_dsthrr_a0a0a0() {
this.myComponent = new ExternalIdMenu();
}
public List<SubstituteAction> createActions(CellContext cellContext, EditorContext editorContext) {
return this.myComponent.createSubstituteActions(cellContext, editorContext);
}
}
private EditorCell createProperty_dsthrr_b0a0() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("publicId");
provider.setNoTargetText("<no publicId>");
provider.setAllowsEmptyTarget(true);
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_publicId");
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_dsthrr_a0a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "SYSTEM");
editorCell.setCellId("Constant_dsthrr_a0a");
Style style = new StyleImpl();
new xmlTagNameStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new XmlExternalId_EditorBuilder_a.XmlExternalId_component_cellMenu_dsthrr_a0a0a(), new SChildSubstituteInfoPartEx(editorCell)}));
return editorCell;
}
public static class XmlExternalId_component_cellMenu_dsthrr_a0a0a implements SubstituteInfoPartExt {
private ExternalIdMenu myComponent;
public XmlExternalId_component_cellMenu_dsthrr_a0a0a() {
this.myComponent = new ExternalIdMenu();
}
public List<SubstituteAction> createActions(CellContext cellContext, EditorContext editorContext) {
return this.myComponent.createSubstituteActions(cellContext, editorContext);
}
}
private EditorCell createProperty_dsthrr_b0() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("systemId");
provider.setNoTargetText("<no systemId>");
provider.setAllowsEmptyTarget(true);
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_systemId");
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;
}
}