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.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.cellProviders.CellProviderWithRole; import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider; import jetbrains.mps.nodeEditor.EditorManager; import jetbrains.mps.lang.editor.cellProviders.SingleRoleCellProvider; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; 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.SChildSubstituteInfo; import jetbrains.mps.openapi.editor.menus.transformation.SNodeLocation; import jetbrains.mps.nodeEditor.cellLayout.CellLayout_Flow; import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.KeyWordStyleClass; import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.MatchingStyleClass; /*package*/ class ComparisonRule_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public ComparisonRule_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_c2v57n_a(); } private EditorCell createCollection_c2v57n_a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical()); editorCell.setCellId("Collection_c2v57n_a"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); editorCell.addEditorCell(createCollection_c2v57n_a0()); editorCell.addEditorCell(createConstant_c2v57n_b0()); editorCell.addEditorCell(createCollection_c2v57n_c0()); editorCell.addEditorCell(createConstant_c2v57n_d0()); editorCell.addEditorCell(createCollection_c2v57n_e0()); editorCell.addEditorCell(createCollection_c2v57n_f0()); editorCell.addEditorCell(createConstant_c2v57n_g0()); editorCell.addEditorCell(createCollection_c2v57n_h0()); return editorCell; } private EditorCell createCollection_c2v57n_a0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_c2v57n_a0"); editorCell.addEditorCell(createConstant_c2v57n_a0a()); editorCell.addEditorCell(createProperty_c2v57n_b0a()); return editorCell; } private EditorCell createConstant_c2v57n_a0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "comparison rule "); editorCell.setCellId("Constant_c2v57n_a0a"); Style style = new StyleImpl(); style.set(StyleAttributes.EDITABLE, false); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_c2v57n_b0a() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("name"); provider.setNoTargetText("<no name>"); 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_c2v57n_b0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, " "); editorCell.setCellId("Constant_c2v57n_b0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createCollection_c2v57n_c0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_c2v57n_c0"); editorCell.addEditorCell(createConstant_c2v57n_a2a()); editorCell.addEditorCell(createRefNode_c2v57n_b2a()); editorCell.addEditorCell(createConstant_c2v57n_c2a()); editorCell.addEditorCell(createRefNode_c2v57n_d2a()); return editorCell; } private EditorCell createConstant_c2v57n_a2a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "applicable for "); editorCell.setCellId("Constant_c2v57n_a2a"); Style style = new StyleImpl(); style.set(StyleAttributes.EDITABLE, false); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNode_c2v57n_b2a() { SingleRoleCellProvider provider = new ComparisonRule_EditorBuilder_a.applicableNodeSingleRoleHandler_c2v57n_b2a(myNode, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1117e7b5c73L, 0x1117e7b9c40L, "applicableNode"), getEditorContext()); return provider.createCell(); } private static class applicableNodeSingleRoleHandler_c2v57n_b2a extends SingleRoleCellProvider { @NotNull private SNode myNode; public applicableNodeSingleRoleHandler_c2v57n_b2a(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, 0x1117e7b5c73L, 0x1117e7b9c40L, "applicableNode"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1117e7b5c73L, 0x1117e7b9c40L, "applicableNode"), 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, 0x1117e7b5c73L, 0x1117e7b9c40L, "applicableNode"), child)); } if (editorCell.getRole() == null) { editorCell.setRole("applicableNode"); } } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1117e7b5c73L, 0x1117e7b9c40L, "applicableNode"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_applicableNode"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<no applicableNode>"; } } private EditorCell createConstant_c2v57n_c2a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ","); editorCell.setCellId("Constant_c2v57n_c2a"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNode_c2v57n_d2a() { SingleRoleCellProvider provider = new ComparisonRule_EditorBuilder_a.anotherNodeSingleRoleHandler_c2v57n_d2a(myNode, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x114caade477L, 0x114cb3d0f37L, "anotherNode"), getEditorContext()); return provider.createCell(); } private static class anotherNodeSingleRoleHandler_c2v57n_d2a extends SingleRoleCellProvider { @NotNull private SNode myNode; public anotherNodeSingleRoleHandler_c2v57n_d2a(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, 0x114caade477L, 0x114cb3d0f37L, "anotherNode"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x114caade477L, 0x114cb3d0f37L, "anotherNode"), 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, 0x114caade477L, 0x114cb3d0f37L, "anotherNode"), child)); } if (editorCell.getRole() == null) { editorCell.setRole("anotherNode"); } } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x114caade477L, 0x114cb3d0f37L, "anotherNode"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_anotherNode"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<no anotherNode>"; } } private EditorCell createConstant_c2v57n_d0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, " "); editorCell.setCellId("Constant_c2v57n_d0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createCollection_c2v57n_e0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Flow()); editorCell.setCellId("Collection_c2v57n_e0"); editorCell.addEditorCell(createConstant_c2v57n_a4a()); editorCell.addEditorCell(createConstant_c2v57n_b4a()); return editorCell; } private EditorCell createConstant_c2v57n_a4a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "rule"); editorCell.setCellId("Constant_c2v57n_a4a"); Style style = new StyleImpl(); new KeyWordStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.EDITABLE, false); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createConstant_c2v57n_b4a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "{"); editorCell.setCellId("Constant_c2v57n_b4a"); Style style = new StyleImpl(); new MatchingStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.EDITABLE, false); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createCollection_c2v57n_f0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_c2v57n_f0"); editorCell.addEditorCell(createConstant_c2v57n_a5a()); editorCell.addEditorCell(createRefNode_c2v57n_b5a()); return editorCell; } private EditorCell createConstant_c2v57n_a5a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, " "); editorCell.setCellId("Constant_c2v57n_a5a"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNode_c2v57n_b5a() { SingleRoleCellProvider provider = new ComparisonRule_EditorBuilder_a.bodySingleRoleHandler_c2v57n_b5a(myNode, MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1119c40dfb0L, 0x1119c41b754L, "body"), getEditorContext()); return provider.createCell(); } private static class bodySingleRoleHandler_c2v57n_b5a extends SingleRoleCellProvider { @NotNull private SNode myNode; public bodySingleRoleHandler_c2v57n_b5a(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, 0x1119c40dfb0L, 0x1119c41b754L, "body"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1119c40dfb0L, 0x1119c41b754L, "body"), 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, 0x1119c40dfb0L, 0x1119c41b754L, "body"), child)); } if (editorCell.getRole() == null) { editorCell.setRole("body"); } } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x1119c40dfb0L, 0x1119c41b754L, "body"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_body"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<no body>"; } } private EditorCell createConstant_c2v57n_g0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "}"); editorCell.setCellId("Constant_c2v57n_g0"); Style style = new StyleImpl(); new MatchingStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.EDITABLE, false); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createCollection_c2v57n_h0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_c2v57n_h0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createCollection_c2v57n_a7a()); editorCell.addEditorCell(createProperty_c2v57n_b7a()); return editorCell; } private EditorCell createCollection_c2v57n_a7a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Flow()); editorCell.setCellId("Collection_c2v57n_a7a"); editorCell.addEditorCell(createConstant_c2v57n_a0h0()); editorCell.addEditorCell(createConstant_c2v57n_b0h0()); return editorCell; } private EditorCell createConstant_c2v57n_a0h0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "weak"); editorCell.setCellId("Constant_c2v57n_a0h0"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createConstant_c2v57n_b0h0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "="); editorCell.setCellId("Constant_c2v57n_b0h0"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_c2v57n_b7a() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("isWeak"); provider.setNoTargetText("<no isWeak>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_isWeak"); 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; } }