package jetbrains.mps.lang.editor.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.nodeEditor.MPSFonts; 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_ReplaceNode_CustomNodeConcept; import org.jetbrains.mps.openapi.language.SAbstractConcept; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole; import jetbrains.mps.lang.editor.cellProviders.RefCellCellProvider; import jetbrains.mps.util.Computable; import jetbrains.mps.editor.runtime.impl.CellUtil; import jetbrains.mps.lang.editor.menus.transformation.NamedTransformationMenuLookup; import jetbrains.mps.smodel.language.LanguageRegistry; import jetbrains.mps.nodeEditor.EditorManager; import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider; import jetbrains.mps.lang.editor.generator.internal.PrimaryReferentMenuCellMenuPart; import jetbrains.mps.lang.editor.generator.internal.AbstractCellMenuPart_Generic_Group; import java.util.List; import jetbrains.mps.smodel.IOperationContext; import java.util.Collections; import org.jetbrains.mps.openapi.model.SModel; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.editor.runtime.selection.SelectionUtil; /*package*/ class PropertyDeclarationCellSelector_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public PropertyDeclarationCellSelector_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_c8nh03_a(); } private EditorCell createCollection_c8nh03_a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent()); editorCell.setCellId("Collection_c8nh03_a"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); editorCell.addEditorCell(createConstant_c8nh03_a0()); editorCell.addEditorCell(createRefCell_c8nh03_b0()); editorCell.addEditorCell(createConstant_c8nh03_c0()); return editorCell; } private EditorCell createConstant_c8nh03_a0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "{"); editorCell.setCellId("Constant_c8nh03_a0"); Style style = new StyleImpl(); style.set(StyleAttributes.PUNCTUATION_RIGHT, true); style.set(StyleAttributes.FONT_STYLE, MPSFonts.PLAIN); style.set(StyleAttributes.MATCHING_LABEL, "curl"); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new PropertyDeclarationCellSelector_EditorBuilder_a.ReplaceWith_AbstractCellSelector_cellMenu_c8nh03_a0a0(), new SChildSubstituteInfoPartEx(editorCell)})); return editorCell; } public static class ReplaceWith_AbstractCellSelector_cellMenu_c8nh03_a0a0 extends AbstractCellMenuPart_ReplaceNode_CustomNodeConcept { public ReplaceWith_AbstractCellSelector_cellMenu_c8nh03_a0a0() { } public SAbstractConcept getReplacementConcept() { return MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x1b0a9b8c0eb8e726L, "jetbrains.mps.lang.editor.structure.AbstractCellSelector"); } } private EditorCell createRefCell_c8nh03_b0() { 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 PropertyDeclarationCellSelector_EditorBuilder_a.Inline_Builder_c8nh03_a1a(getEditorContext(), myNode, effectiveNode).createCell(); } }, effectiveNode, "propertyDeclaration"); CellUtil.setupIDeprecatableStyles(effectiveNode, cell); setSemanticNodeToCells(cell, myNode); installDeleteActions_atLeastOne(cell); return cell; } }; provider.setRole("propertyDeclaration"); provider.setNoTargetText("<no propertyDeclaration>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); if (editorCell.getRole() == null) { editorCell.setReferenceCell(true); editorCell.setRole("propertyDeclaration"); } ConcreteCellSelector_Actions.setCellActions(editorCell, myNode, getEditorContext()); editorCell.setTransformationMenuLookup(new NamedTransformationMenuLookup(LanguageRegistry.getInstance(getEditorContext().getRepository()), MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x3e970bbc3009e3a3L, "jetbrains.mps.lang.editor.structure.PropertyDeclarationCellSelector"), "jetbrains.mps.lang.editor.editor.PropertyDeclarationCellSelector_Empty_SideTransformMenu")); editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), provider.getCellContext(), new SubstituteInfoPartExt[]{new PropertyDeclarationCellSelector_EditorBuilder_a.PropertyDeclarationCellSelector_propertyDeclaration_cellMenu_c8nh03_a0b0(), new PropertyDeclarationCellSelector_EditorBuilder_a.PropertyDeclarationCellSelector_generic_cellMenu_c8nh03_b0b0(), new SChildSubstituteInfoPartEx(editorCell)})); 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_c8nh03_a1a extends AbstractEditorBuilder { @NotNull private SNode myNode; private SNode myReferencingNode; /*package*/ Inline_Builder_c8nh03_a1a(@NotNull EditorContext context, SNode referencingNode, @NotNull SNode node) { super(context); myReferencingNode = referencingNode; myNode = node; } /*package*/ EditorCell createCell() { return createProperty_c8nh03_a0b0(); } @NotNull @Override public SNode getNode() { return myNode; } private EditorCell createProperty_c8nh03_a0b0() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("name"); provider.setNoTargetText("<no name>"); provider.setReadOnly(true); 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; } } public static class PropertyDeclarationCellSelector_propertyDeclaration_cellMenu_c8nh03_a0b0 extends PrimaryReferentMenuCellMenuPart { public PropertyDeclarationCellSelector_propertyDeclaration_cellMenu_c8nh03_a0b0() { } } public static class PropertyDeclarationCellSelector_generic_cellMenu_c8nh03_b0b0 extends AbstractCellMenuPart_Generic_Group { public PropertyDeclarationCellSelector_generic_cellMenu_c8nh03_b0b0() { } public List<?> createParameterObjects(SNode node, IOperationContext operationContext, EditorContext editorContext) { return Collections.singletonList("#"); } protected void handleAction(Object parameterObject, SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) { this.handleAction_impl((String) parameterObject, node, model, operationContext, editorContext); } public void handleAction_impl(String parameterObject, SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) { SNode propertyExpression = SNodeOperations.replaceWithNewChild(node, MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x3e970bbc30443a0aL, "jetbrains.mps.lang.editor.structure.PropertyExpressionCellSelector")); SelectionUtil.selectLabelCellAnSetCaret(editorContext, propertyExpression, "sharp", -1); } public boolean isReferentPresentation() { return false; } public String getMatchingText(Object parameterObject) { return this.getMatchingText_internal((String) parameterObject); } public String getMatchingText_internal(String parameterObject) { return "#"; } public String getDescriptionText(Object parameterObject) { return this.getDescriptionText_internal((String) parameterObject); } public String getDescriptionText_internal(String parameterObject) { return "specify property declaration by expression"; } } private EditorCell createConstant_c8nh03_c0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "}"); editorCell.setCellId("Constant_c8nh03_c0"); Style style = new StyleImpl(); style.set(StyleAttributes.PUNCTUATION_LEFT, true); style.set(StyleAttributes.FONT_STYLE, MPSFonts.PLAIN); style.set(StyleAttributes.MATCHING_LABEL, "curl"); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } }