package jetbrains.mps.lang.resources.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.nodeEditor.cells.EditorCell_Constant;
import jetbrains.mps.openapi.editor.style.Style;
import jetbrains.mps.editor.runtime.style.StyleImpl;
import jetbrains.mps.editor.runtime.style.StyleAttributes;
import jetbrains.mps.lang.editor.cellProviders.SingleRoleCellProvider;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.jetbrains.mps.openapi.language.SContainmentLink;
import jetbrains.mps.openapi.editor.cells.CellActionType;
import jetbrains.mps.editor.runtime.impl.cellActions.CellAction_DeleteSmart;
import jetbrains.mps.openapi.editor.cells.DefaultSubstituteInfo;
import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfo;
import jetbrains.mps.openapi.editor.menus.transformation.SNodeLocation;
import jetbrains.mps.lang.core.editor.BaseStyleSheet_StyleSheet.CommentStyleClass;
import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole;
import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider;
import jetbrains.mps.nodeEditor.EditorManager;
/*package*/ class Circle_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public Circle_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_zihja6_a();
}
private EditorCell createCollection_zihja6_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_zihja6_a");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
editorCell.addEditorCell(createConstant_zihja6_a0());
editorCell.addEditorCell(createConstant_zihja6_b0());
editorCell.addEditorCell(createConstant_zihja6_c0());
editorCell.addEditorCell(createRefNode_zihja6_d0());
editorCell.addEditorCell(createConstant_zihja6_e0());
editorCell.addEditorCell(createConstant_zihja6_f0());
editorCell.addEditorCell(createConstant_zihja6_g0());
editorCell.addEditorCell(createRefNode_zihja6_h0());
editorCell.addEditorCell(createConstant_zihja6_i0());
editorCell.addEditorCell(createConstant_zihja6_j0());
editorCell.addEditorCell(createConstant_zihja6_k0());
editorCell.addEditorCell(createProperty_zihja6_l0());
return editorCell;
}
private EditorCell createConstant_zihja6_a0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "circle");
editorCell.setCellId("Constant_zihja6_a0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_zihja6_b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "fill");
editorCell.setCellId("Constant_zihja6_b0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_zihja6_c0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "=");
editorCell.setCellId("Constant_zihja6_c0");
Style style = new StyleImpl();
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
style.set(StyleAttributes.PUNCTUATION_RIGHT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNode_zihja6_d0() {
SingleRoleCellProvider provider = new Circle_EditorBuilder_a.fillColorSingleRoleHandler_zihja6_d0(myNode, MetaAdapterFactory.getContainmentLink(0x982eb8df2c964bd7L, 0x996311712ea622e5L, 0x26417c37742e28b1L, 0x19d079f4ec114c11L, "fillColor"), getEditorContext());
return provider.createCell();
}
private static class fillColorSingleRoleHandler_zihja6_d0 extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public fillColorSingleRoleHandler_zihja6_d0(SNode ownerNode, SContainmentLink containmentLink, EditorContext context) {
super(containmentLink, context);
myNode = ownerNode;
}
@Override
@NotNull
public SNode getNode() {
return myNode;
}
protected EditorCell createChildCell(SNode child) {
EditorCell editorCell = getUpdateSession().updateChildNodeCell(child);
editorCell.setAction(CellActionType.DELETE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x982eb8df2c964bd7L, 0x996311712ea622e5L, 0x26417c37742e28b1L, 0x19d079f4ec114c11L, "fillColor"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x982eb8df2c964bd7L, 0x996311712ea622e5L, 0x26417c37742e28b1L, 0x19d079f4ec114c11L, "fillColor"), child));
installCellInfo(child, editorCell);
return editorCell;
}
private void installCellInfo(SNode child, EditorCell editorCell) {
if (editorCell.getSubstituteInfo() == null || editorCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) {
editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell, myNode, MetaAdapterFactory.getContainmentLink(0x982eb8df2c964bd7L, 0x996311712ea622e5L, 0x26417c37742e28b1L, 0x19d079f4ec114c11L, "fillColor"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("fillColor");
}
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x982eb8df2c964bd7L, 0x996311712ea622e5L, 0x26417c37742e28b1L, 0x19d079f4ec114c11L, "fillColor")));
try {
EditorCell editorCell = super.createEmptyCell();
editorCell.setCellId("empty_fillColor");
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
protected String getNoTargetText() {
return "<no fillColor>";
}
}
private EditorCell createConstant_zihja6_e0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ",");
editorCell.setCellId("Constant_zihja6_e0");
Style style = new StyleImpl();
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_zihja6_f0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "border");
editorCell.setCellId("Constant_zihja6_f0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_zihja6_g0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "=");
editorCell.setCellId("Constant_zihja6_g0");
Style style = new StyleImpl();
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
style.set(StyleAttributes.PUNCTUATION_RIGHT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNode_zihja6_h0() {
SingleRoleCellProvider provider = new Circle_EditorBuilder_a.borderColorSingleRoleHandler_zihja6_h0(myNode, MetaAdapterFactory.getContainmentLink(0x982eb8df2c964bd7L, 0x996311712ea622e5L, 0x26417c37742e28b1L, 0x19d079f4ec114c13L, "borderColor"), getEditorContext());
return provider.createCell();
}
private static class borderColorSingleRoleHandler_zihja6_h0 extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public borderColorSingleRoleHandler_zihja6_h0(SNode ownerNode, SContainmentLink containmentLink, EditorContext context) {
super(containmentLink, context);
myNode = ownerNode;
}
@Override
@NotNull
public SNode getNode() {
return myNode;
}
protected EditorCell createChildCell(SNode child) {
EditorCell editorCell = getUpdateSession().updateChildNodeCell(child);
editorCell.setAction(CellActionType.DELETE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x982eb8df2c964bd7L, 0x996311712ea622e5L, 0x26417c37742e28b1L, 0x19d079f4ec114c13L, "borderColor"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x982eb8df2c964bd7L, 0x996311712ea622e5L, 0x26417c37742e28b1L, 0x19d079f4ec114c13L, "borderColor"), child));
installCellInfo(child, editorCell);
return editorCell;
}
private void installCellInfo(SNode child, EditorCell editorCell) {
if (editorCell.getSubstituteInfo() == null || editorCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) {
editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell, myNode, MetaAdapterFactory.getContainmentLink(0x982eb8df2c964bd7L, 0x996311712ea622e5L, 0x26417c37742e28b1L, 0x19d079f4ec114c13L, "borderColor"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("borderColor");
}
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x982eb8df2c964bd7L, 0x996311712ea622e5L, 0x26417c37742e28b1L, 0x19d079f4ec114c13L, "borderColor")));
try {
EditorCell editorCell = createConstant_zihja6_a7a();
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
private EditorCell createConstant_zihja6_a7a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "<default>");
editorCell.setCellId("Constant_zihja6_a7a");
Style style = new StyleImpl();
new CommentStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
}
private EditorCell createConstant_zihja6_i0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ",");
editorCell.setCellId("Constant_zihja6_i0");
Style style = new StyleImpl();
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_zihja6_j0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "size");
editorCell.setCellId("Constant_zihja6_j0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_zihja6_k0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "=");
editorCell.setCellId("Constant_zihja6_k0");
Style style = new StyleImpl();
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
style.set(StyleAttributes.PUNCTUATION_RIGHT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createProperty_zihja6_l0() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("r");
provider.setNoTargetText("<no r>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_r");
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;
}
}