package jetbrains.mps.lang.smodelTests.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.openapi.editor.style.Style; import jetbrains.mps.editor.runtime.style.StyleImpl; import jetbrains.mps.editor.runtime.style.StyleAttributes; import jetbrains.mps.nodeEditor.BlockCells; import jetbrains.mps.nodeEditor.cellLayout.CellLayout_Horizontal; import jetbrains.mps.nodeEditor.cells.EditorCell_Constant; import jetbrains.mps.nodeEditor.MPSFonts; import jetbrains.mps.nodeEditor.cells.EditorCell_Indent; 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; /*package*/ class ReferenceContainerSubConcept_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public ReferenceContainerSubConcept_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_j13i3b_a(); } private EditorCell createCollection_j13i3b_a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical()); editorCell.setCellId("Collection_j13i3b_a"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createCollection_j13i3b_a0()); editorCell.addEditorCell(createCollection_j13i3b_b0()); if (nodeCondition_j13i3b_a2a()) { editorCell.addEditorCell(createConstant_j13i3b_c0()); } return editorCell; } private boolean nodeCondition_j13i3b_a2a() { return BlockCells.useBraces(); } private EditorCell createCollection_j13i3b_a0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_j13i3b_a0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_j13i3b_a0a()); if (nodeCondition_j13i3b_a1a0()) { editorCell.addEditorCell(createConstant_j13i3b_b0a()); } return editorCell; } private boolean nodeCondition_j13i3b_a1a0() { return BlockCells.useBraces(); } private EditorCell createConstant_j13i3b_a0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "referenceContainerSubConcept"); editorCell.setCellId("Constant_j13i3b_a0a"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createConstant_j13i3b_b0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "{"); editorCell.setCellId("Constant_j13i3b_b0a"); Style style = new StyleImpl(); style.set(StyleAttributes.MATCHING_LABEL, "brace"); style.set(StyleAttributes.INDENT_LAYOUT_NO_WRAP, true); style.set(StyleAttributes.FONT_STYLE, MPSFonts.PLAIN); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createCollection_j13i3b_b0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_j13i3b_b0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createIndentCell_j13i3b_a1a()); editorCell.addEditorCell(createCollection_j13i3b_b1a()); return editorCell; } private EditorCell createIndentCell_j13i3b_a1a() { EditorCell_Indent editorCell = new EditorCell_Indent(getEditorContext(), myNode); return editorCell; } private EditorCell createCollection_j13i3b_b1a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical()); editorCell.setCellId("Collection_j13i3b_b1a"); editorCell.addEditorCell(createCollection_j13i3b_a1b0()); editorCell.addEditorCell(createCollection_j13i3b_b1b0()); editorCell.addEditorCell(createCollection_j13i3b_c1b0()); return editorCell; } private EditorCell createCollection_j13i3b_a1b0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_j13i3b_a1b0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_j13i3b_a0b1a()); editorCell.addEditorCell(createRefCell_j13i3b_b0b1a()); return editorCell; } private EditorCell createConstant_j13i3b_a0b1a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "root:"); editorCell.setCellId("Constant_j13i3b_a0b1a"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefCell_j13i3b_b0b1a() { 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 ReferenceContainerSubConcept_EditorBuilder_a.Inline_Builder_j13i3b_a1a1b0(getEditorContext(), myNode, effectiveNode).createCell(); } }, effectiveNode, "root"); CellUtil.setupIDeprecatableStyles(effectiveNode, cell); setSemanticNodeToCells(cell, myNode); installDeleteActions_atLeastOne(cell); return cell; } }; provider.setRole("root"); provider.setNoTargetText("<no root>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); if (editorCell.getRole() == null) { editorCell.setReferenceCell(true); editorCell.setRole("root"); } 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_j13i3b_a1a1b0 extends AbstractEditorBuilder { @NotNull private SNode myNode; private SNode myReferencingNode; /*package*/ Inline_Builder_j13i3b_a1a1b0(@NotNull EditorContext context, SNode referencingNode, @NotNull SNode node) { super(context); myReferencingNode = referencingNode; myNode = node; } /*package*/ EditorCell createCell() { return createProperty_j13i3b_a0b0b1a(); } @NotNull @Override public SNode getNode() { return myNode; } private EditorCell createProperty_j13i3b_a0b0b1a() { 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 createCollection_j13i3b_b1b0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_j13i3b_b1b0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_j13i3b_a1b1a()); editorCell.addEditorCell(createRefCell_j13i3b_b1b1a()); return editorCell; } private EditorCell createConstant_j13i3b_a1b1a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "leftChild:"); editorCell.setCellId("Constant_j13i3b_a1b1a"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefCell_j13i3b_b1b1a() { 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 ReferenceContainerSubConcept_EditorBuilder_a.Inline_Builder_j13i3b_a1b1b0(getEditorContext(), myNode, effectiveNode).createCell(); } }, effectiveNode, "leftChild"); CellUtil.setupIDeprecatableStyles(effectiveNode, cell); setSemanticNodeToCells(cell, myNode); installDeleteActions_nullable_reference(cell); return cell; } }; provider.setRole("leftChild"); provider.setNoTargetText("<no leftChild>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); if (editorCell.getRole() == null) { editorCell.setReferenceCell(true); editorCell.setRole("leftChild"); } 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_j13i3b_a1b1b0 extends AbstractEditorBuilder { @NotNull private SNode myNode; private SNode myReferencingNode; /*package*/ Inline_Builder_j13i3b_a1b1b0(@NotNull EditorContext context, SNode referencingNode, @NotNull SNode node) { super(context); myReferencingNode = referencingNode; myNode = node; } /*package*/ EditorCell createCell() { return createProperty_j13i3b_a0b1b1a(); } @NotNull @Override public SNode getNode() { return myNode; } private EditorCell createProperty_j13i3b_a0b1b1a() { 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 createCollection_j13i3b_c1b0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_j13i3b_c1b0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_j13i3b_a2b1a()); editorCell.addEditorCell(createRefCell_j13i3b_b2b1a()); return editorCell; } private EditorCell createConstant_j13i3b_a2b1a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "specializedRightChild:"); editorCell.setCellId("Constant_j13i3b_a2b1a"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefCell_j13i3b_b2b1a() { 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 ReferenceContainerSubConcept_EditorBuilder_a.Inline_Builder_j13i3b_a1c1b0(getEditorContext(), myNode, effectiveNode).createCell(); } }, effectiveNode, "rightChild"); CellUtil.setupIDeprecatableStyles(effectiveNode, cell); setSemanticNodeToCells(cell, myNode); installDeleteActions_nullable_reference(cell); return cell; } }; provider.setRole("specializedRightChild"); provider.setNoTargetText("<no specializedRightChild>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); if (editorCell.getRole() == null) { editorCell.setReferenceCell(true); editorCell.setRole("rightChild"); } 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_j13i3b_a1c1b0 extends AbstractEditorBuilder { @NotNull private SNode myNode; private SNode myReferencingNode; /*package*/ Inline_Builder_j13i3b_a1c1b0(@NotNull EditorContext context, SNode referencingNode, @NotNull SNode node) { super(context); myReferencingNode = referencingNode; myNode = node; } /*package*/ EditorCell createCell() { return createProperty_j13i3b_a0b2b1a(); } @NotNull @Override public SNode getNode() { return myNode; } private EditorCell createProperty_j13i3b_a0b2b1a() { 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_2"); 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_j13i3b_c0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "}"); editorCell.setCellId("Constant_j13i3b_c0"); Style style = new StyleImpl(); style.set(StyleAttributes.MATCHING_LABEL, "brace"); style.set(StyleAttributes.INDENT_LAYOUT_NO_WRAP, true); style.set(StyleAttributes.FONT_STYLE, MPSFonts.PLAIN); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } }