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.openapi.editor.style.Style; import jetbrains.mps.editor.runtime.style.StyleImpl; import jetbrains.mps.editor.runtime.style.StyleAttributes; import jetbrains.mps.nodeEditor.cells.EditorCell_Constant; import jetbrains.mps.nodeEditor.cellProviders.AbstractCellListHandler; import jetbrains.mps.lang.editor.cellProviders.RefNodeListHandler; import jetbrains.mps.smodel.action.NodeFactoryManager; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.openapi.editor.menus.transformation.SNodeLocation; import jetbrains.mps.openapi.editor.cells.CellActionType; import jetbrains.mps.nodeEditor.cellActions.CellAction_DeleteNode; import jetbrains.mps.lang.editor.cellProviders.RefNodeListHandlerElementKeyMap; import jetbrains.mps.openapi.editor.cells.DefaultSubstituteInfo; import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfo; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; import jetbrains.mps.lang.editor.cellProviders.SingleRoleCellProvider; import org.jetbrains.mps.openapi.language.SContainmentLink; import jetbrains.mps.editor.runtime.impl.cellActions.CellAction_DeleteSmart; import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole; import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider; import jetbrains.mps.nodeEditor.EditorManager; import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.CommentStyleClass; /*package*/ class OverloadedOpTypeRule_OneTypeSpecified_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public OverloadedOpTypeRule_OneTypeSpecified_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_38fsuu_a(); } private EditorCell createCollection_38fsuu_a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical()); editorCell.setCellId("Collection_38fsuu_a"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); editorCell.addEditorCell(createCollection_38fsuu_a0()); editorCell.addEditorCell(createCollection_38fsuu_b0()); editorCell.addEditorCell(createConstant_38fsuu_c0()); editorCell.addEditorCell(createRefNode_38fsuu_d0()); editorCell.addEditorCell(createConstant_38fsuu_e0()); editorCell.addEditorCell(createRefNode_38fsuu_f0()); editorCell.addEditorCell(createConstant_38fsuu_g0()); return editorCell; } private EditorCell createCollection_38fsuu_a0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_38fsuu_a0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_38fsuu_a0a()); editorCell.addEditorCell(createRefNodeList_38fsuu_b0a()); return editorCell; } private EditorCell createConstant_38fsuu_a0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "operation concepts:"); editorCell.setCellId("Constant_38fsuu_a0a"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNodeList_38fsuu_b0a() { AbstractCellListHandler handler = new OverloadedOpTypeRule_OneTypeSpecified_EditorBuilder_a.operationConceptListHandler_38fsuu_b0a(myNode, "operationConcept", getEditorContext()); EditorCell_Collection editorCell = handler.createCells(new CellLayout_Horizontal(), false); editorCell.setCellId("refNodeList_operationConcept"); editorCell.setRole(handler.getElementRole()); return editorCell; } private static class operationConceptListHandler_38fsuu_b0a extends RefNodeListHandler { @NotNull private SNode myNode; public operationConceptListHandler_38fsuu_b0a(SNode ownerNode, String childRole, EditorContext context) { super(ownerNode, childRole, context, false); myNode = ownerNode; } @Override @NotNull public SNode getNode() { return myNode; } public SNode createNodeToInsert(EditorContext editorContext) { return NodeFactoryManager.createNode(MetaAdapterFactory.getConcept(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x10cd05c601dL, "jetbrains.mps.lang.smodel.structure.ConceptReference"), null, getNode(), getNode().getModel()); } public EditorCell createNodeCell(SNode elementNode) { EditorCell elementCell = getUpdateSession().updateChildNodeCell(elementNode); installElementCellActions(elementNode, elementCell); return elementCell; } public EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(operationConceptListHandler_38fsuu_b0a.this.getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x70bfdafbb2c9449bL, 0x70bfdafbb2c9449dL, "operationConcept"))); try { EditorCell emptyCell = null; emptyCell = super.createEmptyCell(); installElementCellActions(null, emptyCell); setCellContext(emptyCell); return emptyCell; } finally { getCellFactory().popCellContext(); } } public void installElementCellActions(SNode elementNode, EditorCell elementCell) { if (elementCell.getUserObject(AbstractCellListHandler.ELEMENT_CELL_ACTIONS_SET) == null) { elementCell.putUserObject(AbstractCellListHandler.ELEMENT_CELL_ACTIONS_SET, AbstractCellListHandler.ELEMENT_CELL_ACTIONS_SET); if (elementNode != null) { elementCell.setAction(CellActionType.DELETE, new CellAction_DeleteNode(elementNode, CellAction_DeleteNode.DeleteDirection.FORWARD)); elementCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteNode(elementNode, CellAction_DeleteNode.DeleteDirection.BACKWARD)); elementCell.addKeyMap(new RefNodeListHandlerElementKeyMap(this, "|")); } if (elementCell.getSubstituteInfo() == null || elementCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) { elementCell.setSubstituteInfo(new SChildSubstituteInfo(elementCell, getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x70bfdafbb2c9449bL, 0x70bfdafbb2c9449dL, "operationConcept"), elementNode)); } } } @Override public EditorCell createSeparatorCell(SNode prevNode, SNode nextNode) { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), getNode(), "|"); editorCell.setSelectable(false); Style style = new StyleImpl(); style.set(StyleAttributes.LAYOUT_CONSTRAINT, ""); style.set(StyleAttributes.PUNCTUATION_LEFT, true); editorCell.getStyle().putAll(style); editorCell.setAction(CellActionType.DELETE, new CellAction_DeleteNode(prevNode, CellAction_DeleteNode.DeleteDirection.FORWARD)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteNode(prevNode, CellAction_DeleteNode.DeleteDirection.BACKWARD)); return editorCell; } } private EditorCell createCollection_38fsuu_b0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_38fsuu_b0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_38fsuu_a1a()); editorCell.addEditorCell(createRefNode_38fsuu_b1a()); editorCell.addEditorCell(createConstant_38fsuu_c1a()); editorCell.addEditorCell(createProperty_38fsuu_d1a()); if (nodeCondition_38fsuu_a4b0()) { editorCell.addEditorCell(createCollection_38fsuu_e1a()); } editorCell.addEditorCell(createConstant_38fsuu_f1a()); return editorCell; } private boolean nodeCondition_38fsuu_a4b0() { return !(SPropertyOperations.getBoolean(myNode, MetaAdapterFactory.getProperty(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x70bfdafbb2c80edcL, 0x70bfdafbb2c80eddL, "isExact"))); } private EditorCell createConstant_38fsuu_a1a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "one operand type:"); editorCell.setCellId("Constant_38fsuu_a1a"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNode_38fsuu_b1a() { SingleRoleCellProvider provider = new OverloadedOpTypeRule_OneTypeSpecified_EditorBuilder_a.operandTypeSingleRoleHandler_38fsuu_b1a(myNode, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x70bfdafbb2c80edcL, 0x70bfdafbb2c944b6L, "operandType"), getEditorContext()); return provider.createCell(); } private static class operandTypeSingleRoleHandler_38fsuu_b1a extends SingleRoleCellProvider { @NotNull private SNode myNode; public operandTypeSingleRoleHandler_38fsuu_b1a(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, 0x70bfdafbb2c80edcL, 0x70bfdafbb2c944b6L, "operandType"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x70bfdafbb2c80edcL, 0x70bfdafbb2c944b6L, "operandType"), 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, 0x70bfdafbb2c80edcL, 0x70bfdafbb2c944b6L, "operandType"), child)); } if (editorCell.getRole() == null) { editorCell.setRole("operandType"); } } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x70bfdafbb2c80edcL, 0x70bfdafbb2c944b6L, "operandType"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_operandType"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<no operandType>"; } } private EditorCell createConstant_38fsuu_c1a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "is exact:"); editorCell.setCellId("Constant_38fsuu_c1a"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_38fsuu_d1a() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("isExact"); provider.setNoTargetText("<no isExact>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_isExact"); 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 createCollection_38fsuu_e1a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_38fsuu_e1a"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_38fsuu_a4b0()); editorCell.addEditorCell(createProperty_38fsuu_b4b0()); return editorCell; } private EditorCell createConstant_38fsuu_a4b0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "use strong subtyping"); editorCell.setCellId("Constant_38fsuu_a4b0"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_38fsuu_b4b0() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("isStrong"); provider.setNoTargetText("<no isStrong>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_isStrong"); 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_38fsuu_f1a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, " "); editorCell.setCellId("Constant_38fsuu_f1a"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createConstant_38fsuu_c0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "is applicable:"); editorCell.setCellId("Constant_38fsuu_c0"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNode_38fsuu_d0() { SingleRoleCellProvider provider = new OverloadedOpTypeRule_OneTypeSpecified_EditorBuilder_a.isApplicableSingleRoleHandler_38fsuu_d0(myNode, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x70bfdafbb2c9449bL, 0x5529dae323134a31L, "isApplicable"), getEditorContext()); return provider.createCell(); } private static class isApplicableSingleRoleHandler_38fsuu_d0 extends SingleRoleCellProvider { @NotNull private SNode myNode; public isApplicableSingleRoleHandler_38fsuu_d0(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, 0x70bfdafbb2c9449bL, 0x5529dae323134a31L, "isApplicable"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x70bfdafbb2c9449bL, 0x5529dae323134a31L, "isApplicable"), 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, 0x70bfdafbb2c9449bL, 0x5529dae323134a31L, "isApplicable"), child)); } if (editorCell.getRole() == null) { editorCell.setRole("isApplicable"); } } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x70bfdafbb2c9449bL, 0x5529dae323134a31L, "isApplicable"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_isApplicable"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<no isApplicable>"; } } private EditorCell createConstant_38fsuu_e0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "operation type:"); editorCell.setCellId("Constant_38fsuu_e0"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNode_38fsuu_f0() { SingleRoleCellProvider provider = new OverloadedOpTypeRule_OneTypeSpecified_EditorBuilder_a.functionSingleRoleHandler_38fsuu_f0(myNode, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x70bfdafbb2c9449bL, 0x70bfdafbb2c9449fL, "function"), getEditorContext()); return provider.createCell(); } private static class functionSingleRoleHandler_38fsuu_f0 extends SingleRoleCellProvider { @NotNull private SNode myNode; public functionSingleRoleHandler_38fsuu_f0(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, 0x70bfdafbb2c9449bL, 0x70bfdafbb2c9449fL, "function"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x70bfdafbb2c9449bL, 0x70bfdafbb2c9449fL, "function"), 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, 0x70bfdafbb2c9449bL, 0x70bfdafbb2c9449fL, "function"), child)); } if (editorCell.getRole() == null) { editorCell.setRole("function"); } } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x70bfdafbb2c9449bL, 0x70bfdafbb2c9449fL, "function"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_function"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<no function>"; } } private EditorCell createConstant_38fsuu_g0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "-----------------------------------------------"); editorCell.setCellId("Constant_38fsuu_g0"); Style style = new StyleImpl(); new CommentStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } }