package jetbrains.mps.core.xml.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_Indent; import jetbrains.mps.core.xml.behavior.XmlValuePart__BehaviorDescriptor; import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole; import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider; import jetbrains.mps.openapi.editor.style.Style; import jetbrains.mps.editor.runtime.style.StyleImpl; import jetbrains.mps.core.xml.editor.XmlSS_StyleSheet.xmlAttributeValueStyleClass; import jetbrains.mps.editor.runtime.style.StyleAttributes; 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_ReplaceNode_CustomNodeConcept; import org.jetbrains.mps.openapi.language.SAbstractConcept; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.nodeEditor.cells.EditorCell_Constant; /*package*/ class XmlTextValue_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public XmlTextValue_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_qyzwn3_a(); } private EditorCell createCollection_qyzwn3_a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent()); editorCell.setCellId("Collection_qyzwn3_a"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); editorCell.addEditorCell(createAlternation_qyzwn3_a0()); if (nodeCondition_qyzwn3_a1a()) { editorCell.addEditorCell(createConstant_qyzwn3_b0()); } return editorCell; } private boolean nodeCondition_qyzwn3_a1a() { return (boolean) XmlValuePart__BehaviorDescriptor.hasNewLineAfter_id2EZ251g0bSd.invoke(myNode); } private EditorCell createAlternation_qyzwn3_a0() { boolean alternationCondition = true; alternationCondition = nodeCondition_qyzwn3_a0a(); EditorCell editorCell = null; if (alternationCondition) { editorCell = createProperty_qyzwn3_a0a(); } else { editorCell = createProperty_qyzwn3_a0a_0(); } return editorCell; } private boolean nodeCondition_qyzwn3_a0a() { return (boolean) XmlValuePart__BehaviorDescriptor.onNewLine_id2EZ251g0bS6.invoke(myNode); } private EditorCell createProperty_qyzwn3_a0a() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("text"); provider.setNoTargetText(""); provider.setAllowsEmptyTarget(true); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_text"); Style style = new StyleImpl(); new xmlAttributeValueStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.INDENT_LAYOUT_ON_NEW_LINE, true); editorCell.getStyle().putAll(style); editorCell.addKeyMap(new XmlTextValue_text()); editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), provider.getCellContext(), new SubstituteInfoPartExt[]{new XmlTextValue_EditorBuilder_a.ReplaceWith_XmlValuePart_cellMenu_qyzwn3_a0a0a(), 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 ReplaceWith_XmlValuePart_cellMenu_qyzwn3_a0a0a extends AbstractCellMenuPart_ReplaceNode_CustomNodeConcept { public ReplaceWith_XmlValuePart_cellMenu_qyzwn3_a0a0a() { } public SAbstractConcept getReplacementConcept() { return MetaAdapterFactory.getConcept(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x5c842a42c54cfd1cL, "jetbrains.mps.core.xml.structure.XmlValuePart"); } } private EditorCell createProperty_qyzwn3_a0a_0() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("text"); provider.setNoTargetText(""); provider.setAllowsEmptyTarget(true); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_text_1"); Style style = new StyleImpl(); new xmlAttributeValueStyleClass(getEditorContext(), getNode()).apply(style, editorCell); editorCell.getStyle().putAll(style); editorCell.addKeyMap(new XmlTextValue_text()); editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), provider.getCellContext(), new SubstituteInfoPartExt[]{new XmlTextValue_EditorBuilder_a.ReplaceWith_XmlValuePart_cellMenu_qyzwn3_a0a0a_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 ReplaceWith_XmlValuePart_cellMenu_qyzwn3_a0a0a_0 extends AbstractCellMenuPart_ReplaceNode_CustomNodeConcept { public ReplaceWith_XmlValuePart_cellMenu_qyzwn3_a0a0a_0() { } public SAbstractConcept getReplacementConcept() { return MetaAdapterFactory.getConcept(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x5c842a42c54cfd1cL, "jetbrains.mps.core.xml.structure.XmlValuePart"); } } private EditorCell createConstant_qyzwn3_b0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ""); editorCell.setCellId("Constant_qyzwn3_b0"); Style style = new StyleImpl(); style.set(StyleAttributes.INDENT_LAYOUT_NEW_LINE, true); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } }