package jetbrains.mps.lang.aspect.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.internal.collections.runtime.Sequence; import jetbrains.mps.lang.smodel.generator.smodelAdapter.AttributeOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.nodeEditor.cellLayout.CellLayout_Horizontal; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import jetbrains.mps.nodeEditor.cells.EditorCell_Constant; 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.nodeEditor.EditorManager; import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider; import jetbrains.mps.lang.editor.cellProviders.SingleRoleCellProvider; 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.CompositeSubstituteInfo; import jetbrains.mps.lang.editor.cellProviders.AggregationCellContext; import jetbrains.mps.nodeEditor.cellMenu.SubstituteInfoPartExt; import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfoPartEx; import jetbrains.mps.openapi.editor.menus.transformation.SNodeLocation; import jetbrains.mps.lang.editor.generator.internal.AbstractCellMenuPart_Generic_Item; import org.jetbrains.mps.openapi.model.SModel; import jetbrains.mps.smodel.IOperationContext; import org.jetbrains.mps.openapi.persistence.PersistenceFacade; import jetbrains.mps.smodel.SModelUtil_new; import org.jetbrains.mps.openapi.model.SNodeAccessUtil; 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.cells.EditorCell_Indent; import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfo; /*package*/ class AspectMethodDescriptor_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public AspectMethodDescriptor_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_x9dtrm_a(); } private EditorCell createCollection_x9dtrm_a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical()); editorCell.setCellId("Collection_x9dtrm_a"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); editorCell.addEditorCell(createCollection_x9dtrm_a0()); if (nodeCondition_x9dtrm_a1a()) { editorCell.addEditorCell(createCollection_x9dtrm_b0()); } return editorCell; } private boolean nodeCondition_x9dtrm_a1a() { return Sequence.fromIterable(AttributeOperations.getChildNodesAndAttributes(myNode, MetaAdapterFactory.getContainmentLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b4L, "baseConceptFunc"))).isNotEmpty(); } private EditorCell createCollection_x9dtrm_a0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_x9dtrm_a0"); editorCell.addEditorCell(createConstant_x9dtrm_a0a()); editorCell.addEditorCell(createRefCell_x9dtrm_b0a()); editorCell.addEditorCell(createConstant_x9dtrm_c0a()); editorCell.addEditorCell(createRefCell_x9dtrm_d0a()); if (nodeCondition_x9dtrm_a4a0()) { editorCell.addEditorCell(createRefNode_x9dtrm_e0a()); } return editorCell; } private boolean nodeCondition_x9dtrm_a4a0() { return (SLinkOperations.getTarget(myNode, MetaAdapterFactory.getContainmentLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b4L, "baseConceptFunc")) == null); } private EditorCell createConstant_x9dtrm_a0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "method"); editorCell.setCellId("Constant_x9dtrm_a0a"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefCell_x9dtrm_b0a() { 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 AspectMethodDescriptor_EditorBuilder_a.Inline_Builder_x9dtrm_a1a0(getEditorContext(), myNode, effectiveNode).createCell(); } }, effectiveNode, "method"); CellUtil.setupIDeprecatableStyles(effectiveNode, cell); setSemanticNodeToCells(cell, myNode); installDeleteActions_atLeastOne(cell); return cell; } }; provider.setRole("method"); provider.setNoTargetText("<no method>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); if (editorCell.getRole() == null) { editorCell.setReferenceCell(true); editorCell.setRole("method"); } 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_x9dtrm_a1a0 extends AbstractEditorBuilder { @NotNull private SNode myNode; private SNode myReferencingNode; /*package*/ Inline_Builder_x9dtrm_a1a0(@NotNull EditorContext context, SNode referencingNode, @NotNull SNode node) { super(context); myReferencingNode = referencingNode; myNode = node; } /*package*/ EditorCell createCell() { return createProperty_x9dtrm_a0b0a(); } @NotNull @Override public SNode getNode() { return myNode; } private EditorCell createProperty_x9dtrm_a0b0a() { 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; } } private EditorCell createConstant_x9dtrm_c0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "returns aspects"); editorCell.setCellId("Constant_x9dtrm_c0a"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefCell_x9dtrm_d0a() { 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 AspectMethodDescriptor_EditorBuilder_a.Inline_Builder_x9dtrm_a3a0(getEditorContext(), myNode, effectiveNode).createCell(); } }, effectiveNode, "cncpt"); CellUtil.setupIDeprecatableStyles(effectiveNode, cell); setSemanticNodeToCells(cell, myNode); installDeleteActions_atLeastOne(cell); return cell; } }; provider.setRole("cncpt"); provider.setNoTargetText("<no cncpt>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); if (editorCell.getRole() == null) { editorCell.setReferenceCell(true); editorCell.setRole("cncpt"); } 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_x9dtrm_a3a0 extends AbstractEditorBuilder { @NotNull private SNode myNode; private SNode myReferencingNode; /*package*/ Inline_Builder_x9dtrm_a3a0(@NotNull EditorContext context, SNode referencingNode, @NotNull SNode node) { super(context); myReferencingNode = referencingNode; myNode = node; } /*package*/ EditorCell createCell() { return createProperty_x9dtrm_a0d0a(); } @NotNull @Override public SNode getNode() { return myNode; } private EditorCell createProperty_x9dtrm_a0d0a() { 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_1"); 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 createRefNode_x9dtrm_e0a() { SingleRoleCellProvider provider = new AspectMethodDescriptor_EditorBuilder_a.baseConceptFuncSingleRoleHandler_x9dtrm_e0a(myNode, MetaAdapterFactory.getContainmentLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b4L, "baseConceptFunc"), getEditorContext()); return provider.createCell(); } private static class baseConceptFuncSingleRoleHandler_x9dtrm_e0a extends SingleRoleCellProvider { @NotNull private SNode myNode; public baseConceptFuncSingleRoleHandler_x9dtrm_e0a(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(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b4L, "baseConceptFunc"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b4L, "baseConceptFunc"), child)); installCellInfo(child, editorCell); return editorCell; } private void installCellInfo(SNode child, EditorCell editorCell) { if (editorCell.getSubstituteInfo() == null || editorCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) { editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new AggregationCellContext(myNode, child, MetaAdapterFactory.getContainmentLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b4L, "baseConceptFunc"), MetaAdapterFactory.getConcept(0xfd3920347849419dL, 0x907112563d152375L, 0x1174bed3125L, "jetbrains.mps.baseLanguage.closures.structure.ClosureLiteral")), new SubstituteInfoPartExt[]{new AspectMethodDescriptor_EditorBuilder_a.baseConceptFuncSingleRoleHandler_x9dtrm_e0a.AspectMethodDescriptor_generic_cellMenu_x9dtrm_a0e0a(), new SChildSubstituteInfoPartEx(editorCell)})); } if (editorCell.getRole() == null) { editorCell.setRole("baseConceptFunc"); } } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b4L, "baseConceptFunc"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_baseConceptFunc"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<all aspect classes>"; } public static class AspectMethodDescriptor_generic_cellMenu_x9dtrm_a0e0a extends AbstractCellMenuPart_Generic_Item { public AspectMethodDescriptor_generic_cellMenu_x9dtrm_a0e0a() { } public void handleAction(SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) { SLinkOperations.setTarget(node, MetaAdapterFactory.getContainmentLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b4L, "baseConceptFunc"), _quotation_createNode_x9dtrm_a0a0a0a4a0(SLinkOperations.getTarget(node, MetaAdapterFactory.getReferenceLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b9L, "cncpt")))); } public String getMatchingText() { return "per-concept method"; } private static SNode _quotation_createNode_x9dtrm_a0a0a0a4a0(Object parameter_1) { PersistenceFacade facade = PersistenceFacade.getInstance(); SNode quotedNode_2 = null; SNode quotedNode_3 = null; SNode quotedNode_4 = null; SNode quotedNode_5 = null; quotedNode_2 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xfd3920347849419dL, 0x907112563d152375L, "jetbrains.mps.baseLanguage.closures"), 0x1174bed3125L, "ClosureLiteral"), null, null, false); quotedNode_3 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8cc56b200L, "StatementList"), null, null, false); quotedNode_2.addChild(MetaAdapterFactory.getContainmentLink(0xfd3920347849419dL, 0x907112563d152375L, 0x1174bed3125L, 0x1174bf0522fL, "body"), quotedNode_3); quotedNode_4 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8c77f1e94L, "ParameterDeclaration"), null, null, false); SNodeAccessUtil.setProperty(quotedNode_4, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "aspect"); quotedNode_5 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, "jetbrains.mps.lang.smodel"), 0x108f968b3caL, "SNodeType"), null, null, false); SNodeAccessUtil.setReferenceTarget(quotedNode_5, MetaAdapterFactory.getReferenceLink(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x108f968b3caL, 0x1090e46ca51L, "concept"), (SNode) parameter_1); quotedNode_4.addChild(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x450368d90ce15bc3L, 0x4ed4d318133c80ceL, "type"), quotedNode_5); quotedNode_2.addChild(MetaAdapterFactory.getContainmentLink(0xfd3920347849419dL, 0x907112563d152375L, 0x1174bed3125L, 0x1174bf02c34L, "parameter"), quotedNode_4); return quotedNode_2; } } } private EditorCell createCollection_x9dtrm_b0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_x9dtrm_b0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createIndentCell_x9dtrm_a1a()); editorCell.addEditorCell(createConstant_x9dtrm_b1a()); editorCell.addEditorCell(createRefNode_x9dtrm_c1a()); return editorCell; } private EditorCell createIndentCell_x9dtrm_a1a() { EditorCell_Indent editorCell = new EditorCell_Indent(getEditorContext(), myNode); return editorCell; } private EditorCell createConstant_x9dtrm_b1a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "by concept"); editorCell.setCellId("Constant_x9dtrm_b1a"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNode_x9dtrm_c1a() { SingleRoleCellProvider provider = new AspectMethodDescriptor_EditorBuilder_a.baseConceptFuncSingleRoleHandler_x9dtrm_c1a(myNode, MetaAdapterFactory.getContainmentLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b4L, "baseConceptFunc"), getEditorContext()); return provider.createCell(); } private static class baseConceptFuncSingleRoleHandler_x9dtrm_c1a extends SingleRoleCellProvider { @NotNull private SNode myNode; public baseConceptFuncSingleRoleHandler_x9dtrm_c1a(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(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b4L, "baseConceptFunc"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b4L, "baseConceptFunc"), 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(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b4L, "baseConceptFunc"), child)); } if (editorCell.getRole() == null) { editorCell.setRole("baseConceptFunc"); } } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x4ac0e6949ea3f2b0L, 0x4ac0e6949ea3f2b4L, "baseConceptFunc"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_baseConceptFunc"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<no baseConceptFunc>"; } } }