package testPrimitiveType.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.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole;
import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider;
import jetbrains.mps.nodeEditor.EditorManager;
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 jetbrains.mps.lang.editor.generator.internal.AbstractCellMenuPart_Generic_Item;
import org.jetbrains.mps.openapi.model.SModel;
import jetbrains.mps.smodel.IOperationContext;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
/*package*/ class TypeWithProperties_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public TypeWithProperties_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_8yz4v0_a();
}
private EditorCell createCollection_8yz4v0_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_8yz4v0_a");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
editorCell.addEditorCell(createComponent_8yz4v0_a0());
editorCell.addEditorCell(createConstant_8yz4v0_b0());
editorCell.addEditorCell(createConstant_8yz4v0_c0());
editorCell.addEditorCell(createAlternation_8yz4v0_d0());
editorCell.addEditorCell(createConstant_8yz4v0_e0());
editorCell.addEditorCell(createConstant_8yz4v0_f0());
editorCell.addEditorCell(createAlternation_8yz4v0_g0());
editorCell.addEditorCell(createConstant_8yz4v0_h0());
editorCell.addEditorCell(createConstant_8yz4v0_i0());
editorCell.addEditorCell(createAlternation_8yz4v0_j0());
editorCell.addEditorCell(createConstant_8yz4v0_k0());
return editorCell;
}
private EditorCell createComponent_8yz4v0_a0() {
EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.lang.core.editor.alias");
return editorCell;
}
private EditorCell createConstant_8yz4v0_b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "[");
editorCell.setCellId("Constant_8yz4v0_b0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_8yz4v0_c0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "str=");
editorCell.setCellId("Constant_8yz4v0_c0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createAlternation_8yz4v0_d0() {
boolean alternationCondition = true;
alternationCondition = nodeCondition_8yz4v0_a3a();
EditorCell editorCell = null;
if (alternationCondition) {
editorCell = createProperty_8yz4v0_a3a();
} else {
editorCell = createConstant_8yz4v0_a3a();
}
return editorCell;
}
private boolean nodeCondition_8yz4v0_a3a() {
return myNode.getProperty(MetaAdapterFactory.getProperty(0x8a53c70515e44f87L, 0x8796457845605512L, 0x9cc88b154a54d6cL, 0x9cc88b154a556a2L, "str")) != null;
}
private EditorCell createProperty_8yz4v0_a3a() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("str");
provider.setNoTargetText("<no str>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_str");
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_8yz4v0_a3a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "null");
editorCell.setCellId("Constant_8yz4v0_a3a");
editorCell.setDefaultText("");
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new TypeWithProperties_EditorBuilder_a.TypeWithProperties_generic_cellMenu_8yz4v0_a0a3a(), new SChildSubstituteInfoPartEx(editorCell)}));
return editorCell;
}
public static class TypeWithProperties_generic_cellMenu_8yz4v0_a0a3a extends AbstractCellMenuPart_Generic_Item {
public TypeWithProperties_generic_cellMenu_8yz4v0_a0a3a() {
}
public void handleAction(SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) {
SPropertyOperations.set(node, MetaAdapterFactory.getProperty(0x8a53c70515e44f87L, 0x8796457845605512L, 0x9cc88b154a54d6cL, 0x9cc88b154a556a2L, "str"), "");
}
public String getMatchingText() {
return "default";
}
}
private EditorCell createConstant_8yz4v0_e0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ",");
editorCell.setCellId("Constant_8yz4v0_e0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_8yz4v0_f0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "num=");
editorCell.setCellId("Constant_8yz4v0_f0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createAlternation_8yz4v0_g0() {
boolean alternationCondition = true;
alternationCondition = nodeCondition_8yz4v0_a6a();
EditorCell editorCell = null;
if (alternationCondition) {
editorCell = createProperty_8yz4v0_a6a();
} else {
editorCell = createConstant_8yz4v0_a6a();
}
return editorCell;
}
private boolean nodeCondition_8yz4v0_a6a() {
return myNode.getProperty(MetaAdapterFactory.getProperty(0x8a53c70515e44f87L, 0x8796457845605512L, 0x9cc88b154a54d6cL, 0x9cc88b154a556a8L, "num")) != null;
}
private EditorCell createProperty_8yz4v0_a6a() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("num");
provider.setNoTargetText("<no num>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_num");
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_8yz4v0_a6a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "null");
editorCell.setCellId("Constant_8yz4v0_a6a");
editorCell.setDefaultText("");
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new TypeWithProperties_EditorBuilder_a.TypeWithProperties_generic_cellMenu_8yz4v0_a0a6a(), new SChildSubstituteInfoPartEx(editorCell)}));
return editorCell;
}
public static class TypeWithProperties_generic_cellMenu_8yz4v0_a0a6a extends AbstractCellMenuPart_Generic_Item {
public TypeWithProperties_generic_cellMenu_8yz4v0_a0a6a() {
}
public void handleAction(SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) {
SPropertyOperations.set(node, MetaAdapterFactory.getProperty(0x8a53c70515e44f87L, 0x8796457845605512L, 0x9cc88b154a54d6cL, 0x9cc88b154a556a8L, "num"), "" + (0));
}
public String getMatchingText() {
return "default";
}
}
private EditorCell createConstant_8yz4v0_h0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ",");
editorCell.setCellId("Constant_8yz4v0_h0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_8yz4v0_i0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "bool=");
editorCell.setCellId("Constant_8yz4v0_i0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createAlternation_8yz4v0_j0() {
boolean alternationCondition = true;
alternationCondition = nodeCondition_8yz4v0_a9a();
EditorCell editorCell = null;
if (alternationCondition) {
editorCell = createProperty_8yz4v0_a9a();
} else {
editorCell = createConstant_8yz4v0_a9a();
}
return editorCell;
}
private boolean nodeCondition_8yz4v0_a9a() {
return myNode.getProperty(MetaAdapterFactory.getProperty(0x8a53c70515e44f87L, 0x8796457845605512L, 0x9cc88b154a54d6cL, 0x9cc88b154a556abL, "bool")) != null;
}
private EditorCell createProperty_8yz4v0_a9a() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("bool");
provider.setNoTargetText("<no bool>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_bool");
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_8yz4v0_a9a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "null");
editorCell.setCellId("Constant_8yz4v0_a9a");
editorCell.setDefaultText("");
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new TypeWithProperties_EditorBuilder_a.TypeWithProperties_generic_cellMenu_8yz4v0_a0a9a(), new SChildSubstituteInfoPartEx(editorCell)}));
return editorCell;
}
public static class TypeWithProperties_generic_cellMenu_8yz4v0_a0a9a extends AbstractCellMenuPart_Generic_Item {
public TypeWithProperties_generic_cellMenu_8yz4v0_a0a9a() {
}
public void handleAction(SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) {
SPropertyOperations.set(node, MetaAdapterFactory.getProperty(0x8a53c70515e44f87L, 0x8796457845605512L, 0x9cc88b154a54d6cL, 0x9cc88b154a556abL, "bool"), "" + (false));
}
public String getMatchingText() {
return "default";
}
}
private EditorCell createConstant_8yz4v0_k0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "]");
editorCell.setCellId("Constant_8yz4v0_k0");
editorCell.setDefaultText("");
return editorCell;
}
}