package jetbrains.mps.lang.typesystem.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_Vertical;
import jetbrains.mps.nodeEditor.cellLayout.CellLayout_Horizontal;
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.nodeEditor.cellProviders.CellProviderWithRole;
import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider;
import jetbrains.mps.nodeEditor.EditorManager;
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.nodeEditor.cellLayout.CellLayout_Flow;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.KeyWordStyleClass;
import jetbrains.mps.editor.runtime.style.Padding;
import jetbrains.mps.editor.runtime.style.Measure;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.LeftBraceStyleClass;
import jetbrains.mps.nodeEditor.cells.EditorCell_Indent;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.RightBraceStyleClass;
/*package*/ class InequationReplacementRule_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public InequationReplacementRule_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_gjcmhj_a();
}
private EditorCell createCollection_gjcmhj_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical());
editorCell.setCellId("Collection_gjcmhj_a");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
editorCell.addEditorCell(createCollection_gjcmhj_a0());
editorCell.addEditorCell(createConstant_gjcmhj_b0());
editorCell.addEditorCell(createCollection_gjcmhj_c0());
editorCell.addEditorCell(createConstant_gjcmhj_d0());
editorCell.addEditorCell(createCollection_gjcmhj_e0());
editorCell.addEditorCell(createConstant_gjcmhj_f0());
editorCell.addEditorCell(createCollection_gjcmhj_g0());
editorCell.addEditorCell(createCollection_gjcmhj_h0());
editorCell.addEditorCell(createConstant_gjcmhj_i0());
return editorCell;
}
private EditorCell createCollection_gjcmhj_a0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal());
editorCell.setCellId("Collection_gjcmhj_a0");
editorCell.addEditorCell(createConstant_gjcmhj_a0a());
editorCell.addEditorCell(createProperty_gjcmhj_b0a());
return editorCell;
}
private EditorCell createConstant_gjcmhj_a0a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "replacement rule");
editorCell.setCellId("Constant_gjcmhj_a0a");
Style style = new StyleImpl();
style.set(StyleAttributes.EDITABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createProperty_gjcmhj_b0a() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("name");
provider.setNoTargetText("<no name>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_name");
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_gjcmhj_b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, " ");
editorCell.setCellId("Constant_gjcmhj_b0");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createCollection_gjcmhj_c0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal());
editorCell.setCellId("Collection_gjcmhj_c0");
editorCell.addEditorCell(createConstant_gjcmhj_a2a());
editorCell.addEditorCell(createRefNode_gjcmhj_b2a());
editorCell.addEditorCell(createConstant_gjcmhj_c2a());
editorCell.addEditorCell(createRefNode_gjcmhj_d2a());
return editorCell;
}
private EditorCell createConstant_gjcmhj_a2a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "applicable for ");
editorCell.setCellId("Constant_gjcmhj_a2a");
Style style = new StyleImpl();
style.set(StyleAttributes.EDITABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNode_gjcmhj_b2a() {
SingleRoleCellProvider provider = new InequationReplacementRule_EditorBuilder_a.applicableNodeSingleRoleHandler_gjcmhj_b2a(myNode, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1117e7b5c73L, 0x1117e7b9c40L, "applicableNode"), getEditorContext());
return provider.createCell();
}
private static class applicableNodeSingleRoleHandler_gjcmhj_b2a extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public applicableNodeSingleRoleHandler_gjcmhj_b2a(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(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1117e7b5c73L, 0x1117e7b9c40L, "applicableNode"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1117e7b5c73L, 0x1117e7b9c40L, "applicableNode"), 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(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1117e7b5c73L, 0x1117e7b9c40L, "applicableNode"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("applicableNode");
}
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1117e7b5c73L, 0x1117e7b9c40L, "applicableNode")));
try {
EditorCell editorCell = super.createEmptyCell();
editorCell.setCellId("empty_applicableNode");
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
protected String getNoTargetText() {
return "<no applicableNode>";
}
}
private EditorCell createConstant_gjcmhj_c2a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "<:");
editorCell.setCellId("Constant_gjcmhj_c2a");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNode_gjcmhj_d2a() {
SingleRoleCellProvider provider = new InequationReplacementRule_EditorBuilder_a.supertypeNodeSingleRoleHandler_gjcmhj_d2a(myNode, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x117c5668bf2L, 0x117c567f086L, "supertypeNode"), getEditorContext());
return provider.createCell();
}
private static class supertypeNodeSingleRoleHandler_gjcmhj_d2a extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public supertypeNodeSingleRoleHandler_gjcmhj_d2a(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(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x117c5668bf2L, 0x117c567f086L, "supertypeNode"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x117c5668bf2L, 0x117c567f086L, "supertypeNode"), 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(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x117c5668bf2L, 0x117c567f086L, "supertypeNode"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("supertypeNode");
}
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x117c5668bf2L, 0x117c567f086L, "supertypeNode")));
try {
EditorCell editorCell = super.createEmptyCell();
editorCell.setCellId("empty_supertypeNode");
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
protected String getNoTargetText() {
return "<no supertypeNode>";
}
}
private EditorCell createConstant_gjcmhj_d0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, " ");
editorCell.setCellId("Constant_gjcmhj_d0");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createCollection_gjcmhj_e0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal());
editorCell.setCellId("Collection_gjcmhj_e0");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.addEditorCell(createConstant_gjcmhj_a4a());
editorCell.addEditorCell(createRefNode_gjcmhj_b4a());
return editorCell;
}
private EditorCell createConstant_gjcmhj_a4a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "custom condition:");
editorCell.setCellId("Constant_gjcmhj_a4a");
Style style = new StyleImpl();
style.set(StyleAttributes.EDITABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNode_gjcmhj_b4a() {
SingleRoleCellProvider provider = new InequationReplacementRule_EditorBuilder_a.isApplicableClauseSingleRoleHandler_gjcmhj_b4a(myNode, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x117c5668bf2L, 0x31d99a115038e5edL, "isApplicableClause"), getEditorContext());
return provider.createCell();
}
private static class isApplicableClauseSingleRoleHandler_gjcmhj_b4a extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public isApplicableClauseSingleRoleHandler_gjcmhj_b4a(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(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x117c5668bf2L, 0x31d99a115038e5edL, "isApplicableClause"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x117c5668bf2L, 0x31d99a115038e5edL, "isApplicableClause"), 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(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x117c5668bf2L, 0x31d99a115038e5edL, "isApplicableClause"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("isApplicableClause");
}
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x117c5668bf2L, 0x31d99a115038e5edL, "isApplicableClause")));
try {
EditorCell editorCell = super.createEmptyCell();
editorCell.setCellId("empty_isApplicableClause");
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
protected String getNoTargetText() {
return "true";
}
}
private EditorCell createConstant_gjcmhj_f0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, " ");
editorCell.setCellId("Constant_gjcmhj_f0");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createCollection_gjcmhj_g0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Flow());
editorCell.setCellId("Collection_gjcmhj_g0");
editorCell.addEditorCell(createConstant_gjcmhj_a6a());
editorCell.addEditorCell(createConstant_gjcmhj_b6a());
return editorCell;
}
private EditorCell createConstant_gjcmhj_a6a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "rule");
editorCell.setCellId("Constant_gjcmhj_a6a");
Style style = new StyleImpl();
new KeyWordStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.PADDING_RIGHT, new Padding(0.0, Measure.SPACES));
style.set(StyleAttributes.EDITABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_gjcmhj_b6a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "{");
editorCell.setCellId("Constant_gjcmhj_b6a");
Style style = new StyleImpl();
new LeftBraceStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.EDITABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createCollection_gjcmhj_h0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal());
editorCell.setCellId("Collection_gjcmhj_h0");
editorCell.addEditorCell(createIndentCell_gjcmhj_a7a());
editorCell.addEditorCell(createRefNode_gjcmhj_b7a());
return editorCell;
}
private EditorCell createIndentCell_gjcmhj_a7a() {
EditorCell_Indent editorCell = new EditorCell_Indent(getEditorContext(), myNode);
return editorCell;
}
private EditorCell createRefNode_gjcmhj_b7a() {
SingleRoleCellProvider provider = new InequationReplacementRule_EditorBuilder_a.bodySingleRoleHandler_gjcmhj_b7a(myNode, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1119c40dfb0L, 0x1119c41b754L, "body"), getEditorContext());
return provider.createCell();
}
private static class bodySingleRoleHandler_gjcmhj_b7a extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public bodySingleRoleHandler_gjcmhj_b7a(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(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1119c40dfb0L, 0x1119c41b754L, "body"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1119c40dfb0L, 0x1119c41b754L, "body"), 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(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1119c40dfb0L, 0x1119c41b754L, "body"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("body");
}
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1119c40dfb0L, 0x1119c41b754L, "body")));
try {
EditorCell editorCell = super.createEmptyCell();
editorCell.setCellId("empty_body");
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
protected String getNoTargetText() {
return "<no body>";
}
}
private EditorCell createConstant_gjcmhj_i0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "}");
editorCell.setCellId("Constant_gjcmhj_i0");
Style style = new StyleImpl();
new RightBraceStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.EDITABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
}