package jetbrains.mps.lang.pattern.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.nodeEditor.cellProviders.CellProviderWithRole;
import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider;
import jetbrains.mps.nodeEditor.EditorManager;
import jetbrains.mps.lang.editor.cellProviders.RefCellCellProvider;
import jetbrains.mps.util.Computable;
import jetbrains.mps.editor.runtime.impl.CellUtil;
import jetbrains.mps.nodeEditor.cells.EditorCell_Property;
import jetbrains.mps.nodeEditor.cells.EditorCell_RefPresentation;
import jetbrains.mps.smodel.action.IReferentPresentationProvider;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.openapi.editor.style.Style;
import jetbrains.mps.editor.runtime.style.StyleImpl;
import jetbrains.mps.editor.runtime.style.StyleAttributes;
/*package*/ class GeneratorInternal_ReferenceDescriptor_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public GeneratorInternal_ReferenceDescriptor_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_vh2hfk_a();
}
private EditorCell createCollection_vh2hfk_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_vh2hfk_a");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
editorCell.addEditorCell(createConstant_vh2hfk_a0());
editorCell.addEditorCell(createProperty_vh2hfk_b0());
editorCell.addEditorCell(createConstant_vh2hfk_c0());
editorCell.addEditorCell(createRefCell_vh2hfk_d0());
editorCell.addEditorCell(createConstant_vh2hfk_e0());
editorCell.addEditorCell(createConstant_vh2hfk_f0());
editorCell.addEditorCell(createConstant_vh2hfk_g0());
editorCell.addEditorCell(createRefCell_vh2hfk_h0());
editorCell.addEditorCell(createConstant_vh2hfk_i0());
editorCell.addEditorCell(createConstant_vh2hfk_j0());
editorCell.addEditorCell(createConstant_vh2hfk_k0());
editorCell.addEditorCell(createProperty_vh2hfk_l0());
editorCell.addEditorCell(createConstant_vh2hfk_m0());
return editorCell;
}
private EditorCell createConstant_vh2hfk_a0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "generator internal_ reference descriptor");
editorCell.setCellId("Constant_vh2hfk_a0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createProperty_vh2hfk_b0() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("model");
provider.setNoTargetText("<no model>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_model");
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_vh2hfk_c0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "main node");
editorCell.setCellId("Constant_vh2hfk_c0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefCell_vh2hfk_d0() {
CellProviderWithRole provider = new RefCellCellProvider(myNode, getEditorContext()) {
@Override
protected EditorCell createRefCell(EditorContext context, final SNode effectiveNode, SNode node) {
EditorCell cell = getUpdateSession().updateReferencedNodeCell(new Computable<EditorCell>() {
public EditorCell compute() {
return new GeneratorInternal_ReferenceDescriptor_EditorBuilder_a.Inline_Builder_vh2hfk_a3a(getEditorContext(), myNode, effectiveNode).createCell();
}
}, effectiveNode, "mainNode");
CellUtil.setupIDeprecatableStyles(effectiveNode, cell);
setSemanticNodeToCells(cell, myNode);
installDeleteActions_atLeastOne(cell);
return cell;
}
};
provider.setRole("mainNode");
provider.setNoTargetText("<no mainNode>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
if (editorCell.getRole() == null) {
editorCell.setReferenceCell(true);
editorCell.setRole("mainNode");
}
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;
}
/*package*/ static class Inline_Builder_vh2hfk_a3a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
private SNode myReferencingNode;
/*package*/ Inline_Builder_vh2hfk_a3a(@NotNull EditorContext context, SNode referencingNode, @NotNull SNode node) {
super(context);
myReferencingNode = referencingNode;
myNode = node;
}
/*package*/ EditorCell createCell() {
return createReferencePresentation_vh2hfk_a0d0();
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
private EditorCell createReferencePresentation_vh2hfk_a0d0() {
EditorCell_Property editorCell = EditorCell_RefPresentation.create(getEditorContext(), myNode, myReferencingNode, IReferentPresentationProvider.getDefaultPresentation(MetaAdapterFactory.getReferenceLink(0xd4615e3bd6714ba9L, 0xaf012b78369b0ba7L, 0x7e881d31a4198b56L, 0x7e881d31a4198b58L, "mainNode")));
editorCell.setCellId("ReferencePresentation_vh2hfk_a0d0");
return editorCell;
}
}
private EditorCell createConstant_vh2hfk_e0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "(");
editorCell.setCellId("Constant_vh2hfk_e0");
Style style = new StyleImpl();
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
style.set(StyleAttributes.MATCHING_LABEL, "body-paren");
style.set(StyleAttributes.PUNCTUATION_RIGHT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_vh2hfk_f0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "role");
editorCell.setCellId("Constant_vh2hfk_f0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_vh2hfk_g0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ":");
editorCell.setCellId("Constant_vh2hfk_g0");
Style style = new StyleImpl();
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefCell_vh2hfk_h0() {
CellProviderWithRole provider = new RefCellCellProvider(myNode, getEditorContext()) {
@Override
protected EditorCell createRefCell(EditorContext context, final SNode effectiveNode, SNode node) {
EditorCell cell = getUpdateSession().updateReferencedNodeCell(new Computable<EditorCell>() {
public EditorCell compute() {
return new GeneratorInternal_ReferenceDescriptor_EditorBuilder_a.Inline_Builder_vh2hfk_a7a(getEditorContext(), myNode, effectiveNode).createCell();
}
}, effectiveNode, "referenceLinkDeclaration");
CellUtil.setupIDeprecatableStyles(effectiveNode, cell);
setSemanticNodeToCells(cell, myNode);
installDeleteActions_atLeastOne(cell);
return cell;
}
};
provider.setRole("referenceLinkDeclaration");
provider.setNoTargetText("<no referenceLinkDeclaration>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
if (editorCell.getRole() == null) {
editorCell.setReferenceCell(true);
editorCell.setRole("referenceLinkDeclaration");
}
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;
}
/*package*/ static class Inline_Builder_vh2hfk_a7a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
private SNode myReferencingNode;
/*package*/ Inline_Builder_vh2hfk_a7a(@NotNull EditorContext context, SNode referencingNode, @NotNull SNode node) {
super(context);
myReferencingNode = referencingNode;
myNode = node;
}
/*package*/ EditorCell createCell() {
return createProperty_vh2hfk_a0h0();
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
private EditorCell createProperty_vh2hfk_a0h0() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("role");
provider.setNoTargetText("<no role>");
provider.setReadOnly(true);
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_role");
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_vh2hfk_i0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ",");
editorCell.setCellId("Constant_vh2hfk_i0");
Style style = new StyleImpl();
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_vh2hfk_j0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "id");
editorCell.setCellId("Constant_vh2hfk_j0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_vh2hfk_k0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ":");
editorCell.setCellId("Constant_vh2hfk_k0");
Style style = new StyleImpl();
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createProperty_vh2hfk_l0() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("id");
provider.setNoTargetText("<no id>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_id");
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_vh2hfk_m0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ")");
editorCell.setCellId("Constant_vh2hfk_m0");
Style style = new StyleImpl();
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
style.set(StyleAttributes.MATCHING_LABEL, "body-paren");
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
}