package jetbrains.mps.baseLanguage.javadoc.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.editor.runtime.cells.BigCellUtil; import jetbrains.mps.internal.collections.runtime.ListSequence; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; 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.baseLanguage.javadoc.editor.DocumentationCommentStyleSheet_StyleSheet.CommentHTMLTagStyleClass; import jetbrains.mps.editor.runtime.style.StyleAttributes; import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole; import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider; import jetbrains.mps.nodeEditor.cellMenu.CompositeSubstituteInfo; import jetbrains.mps.nodeEditor.cellMenu.SubstituteInfoPartExt; import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfoPartEx; import jetbrains.mps.nodeEditor.EditorManager; import jetbrains.mps.lang.editor.generator.internal.AbstractCellMenuPart_PropertyValues; import java.util.List; import jetbrains.mps.smodel.IOperationContext; import java.util.ArrayList; import jetbrains.mps.nodeEditor.cellProviders.AbstractCellListHandler; import jetbrains.mps.lang.editor.cellProviders.RefNodeListHandler; import jetbrains.mps.smodel.action.NodeFactoryManager; 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.openapi.editor.cells.DefaultSubstituteInfo; import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfo; import jetbrains.mps.nodeEditor.MPSFonts; /*package*/ class HTMLElement_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public HTMLElement_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createAlternation_h096ql_a(); } private EditorCell createAlternation_h096ql_a() { boolean alternationCondition = true; alternationCondition = nodeCondition_h096ql_a0(); EditorCell editorCell = null; if (alternationCondition) { editorCell = createCollection_h096ql_a0(); } else { editorCell = createCollection_h096ql_a0_0(); } EditorCell bigCell = BigCellUtil.findBigCell(editorCell, getNode()); if (bigCell != null) { bigCell.setBig(true); bigCell.setCellContext(getCellFactory().getCellContext()); } return editorCell; } private boolean nodeCondition_h096ql_a0() { return ListSequence.fromList(SLinkOperations.getChildren(myNode, MetaAdapterFactory.getContainmentLink(0xf280165065d5424eL, 0xbb1b463a8781b786L, 0x5bc4aa08e154b399L, 0x5bc4aa08e154b39bL, "line"))).isEmpty(); } private EditorCell createCollection_h096ql_a0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent()); editorCell.setCellId("Collection_h096ql_a0"); editorCell.addEditorCell(createConstant_h096ql_a0a()); editorCell.addEditorCell(createProperty_h096ql_b0a()); editorCell.addEditorCell(createConstant_h096ql_c0a()); return editorCell; } private EditorCell createConstant_h096ql_a0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "<"); editorCell.setCellId("Constant_h096ql_a0a"); Style style = new StyleImpl(); new CommentHTMLTagStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.PUNCTUATION_LEFT, true); style.set(StyleAttributes.PUNCTUATION_RIGHT, true); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_h096ql_b0a() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("name"); provider.setNoTargetText("tag name"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_name"); Style style = new StyleImpl(); new CommentHTMLTagStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.MATCHING_LABEL, "html-tag"); editorCell.getStyle().putAll(style); editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), provider.getCellContext(), new SubstituteInfoPartExt[]{new HTMLElement_EditorBuilder_a.HTMLElement_name_cellMenu_h096ql_a0b0a(), 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; } public static class HTMLElement_name_cellMenu_h096ql_a0b0a extends AbstractCellMenuPart_PropertyValues { public HTMLElement_name_cellMenu_h096ql_a0b0a() { } public List<String> getPropertyValues(SNode node, IOperationContext operationContext, EditorContext editorContext) { return ListSequence.fromListAndArray(new ArrayList<String>(), "p", "em", "strong", "b", "i", "br", "code"); } } private EditorCell createConstant_h096ql_c0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, " />"); editorCell.setCellId("Constant_h096ql_c0a"); Style style = new StyleImpl(); new CommentHTMLTagStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.PUNCTUATION_LEFT, true); style.set(StyleAttributes.PUNCTUATION_RIGHT, true); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createCollection_h096ql_a0_0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent()); editorCell.setCellId("Collection_h096ql_a0_0"); editorCell.addEditorCell(createConstant_h096ql_a0a_0()); editorCell.addEditorCell(createProperty_h096ql_b0a_0()); editorCell.addEditorCell(createConstant_h096ql_c0a_0()); editorCell.addEditorCell(createRefNodeList_h096ql_d0a()); editorCell.addEditorCell(createConstant_h096ql_e0a()); editorCell.addEditorCell(createProperty_h096ql_f0a()); editorCell.addEditorCell(createConstant_h096ql_g0a()); return editorCell; } private EditorCell createConstant_h096ql_a0a_0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "<"); editorCell.setCellId("Constant_h096ql_a0a_0"); Style style = new StyleImpl(); new CommentHTMLTagStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.PUNCTUATION_LEFT, true); style.set(StyleAttributes.PUNCTUATION_RIGHT, true); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_h096ql_b0a_0() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("name"); provider.setNoTargetText("tag name"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_name_1"); Style style = new StyleImpl(); new CommentHTMLTagStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.MATCHING_LABEL, "html-tag"); editorCell.getStyle().putAll(style); editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), provider.getCellContext(), new SubstituteInfoPartExt[]{new HTMLElement_EditorBuilder_a.HTMLElement_name_cellMenu_h096ql_a0b0a_0(), 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; } public static class HTMLElement_name_cellMenu_h096ql_a0b0a_0 extends AbstractCellMenuPart_PropertyValues { public HTMLElement_name_cellMenu_h096ql_a0b0a_0() { } public List<String> getPropertyValues(SNode node, IOperationContext operationContext, EditorContext editorContext) { return ListSequence.fromListAndArray(new ArrayList<String>(), "p", "em", "strong", "b", "i", "br", "code"); } } private EditorCell createConstant_h096ql_c0a_0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ">"); editorCell.setCellId("Constant_h096ql_c0a_0"); Style style = new StyleImpl(); new CommentHTMLTagStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.PUNCTUATION_LEFT, true); style.set(StyleAttributes.PUNCTUATION_RIGHT, true); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNodeList_h096ql_d0a() { AbstractCellListHandler handler = new HTMLElement_EditorBuilder_a.lineListHandler_h096ql_d0a(myNode, "line", getEditorContext()); EditorCell_Collection editorCell = handler.createCells(new CellLayout_Indent(), false); editorCell.setCellId("refNodeList_line"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); HandleEnterInTheEnd_Actions.setCellActions(editorCell, myNode, getEditorContext()); editorCell.setRole(handler.getElementRole()); return editorCell; } private static class lineListHandler_h096ql_d0a extends RefNodeListHandler { @NotNull private SNode myNode; public lineListHandler_h096ql_d0a(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(0xf280165065d5424eL, 0xbb1b463a8781b786L, 0x757ba20a4c87f96cL, "jetbrains.mps.baseLanguage.javadoc.structure.CommentLine"), 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(lineListHandler_h096ql_d0a.this.getNode(), MetaAdapterFactory.getContainmentLink(0xf280165065d5424eL, 0xbb1b463a8781b786L, 0x5bc4aa08e154b399L, 0x5bc4aa08e154b39bL, "line"))); 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)); } if (elementCell.getSubstituteInfo() == null || elementCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) { elementCell.setSubstituteInfo(new SChildSubstituteInfo(elementCell, getNode(), MetaAdapterFactory.getContainmentLink(0xf280165065d5424eL, 0xbb1b463a8781b786L, 0x5bc4aa08e154b399L, 0x5bc4aa08e154b39bL, "line"), elementNode)); } } } } private EditorCell createConstant_h096ql_e0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "</"); editorCell.setCellId("Constant_h096ql_e0a"); Style style = new StyleImpl(); new CommentHTMLTagStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.PUNCTUATION_LEFT, true); style.set(StyleAttributes.PUNCTUATION_RIGHT, true); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_h096ql_f0a() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("name"); provider.setNoTargetText("tag name"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_name_2"); Style style = new StyleImpl(); new CommentHTMLTagStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.MATCHING_LABEL, "html-tag"); editorCell.getStyle().putAll(style); 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_h096ql_g0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ">"); editorCell.setCellId("Constant_h096ql_g0a"); Style style = new StyleImpl(); new CommentHTMLTagStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.FONT_STYLE, MPSFonts.PLAIN); style.set(StyleAttributes.PUNCTUATION_LEFT, true); style.set(StyleAttributes.PUNCTUATION_RIGHT, true); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } }