package jetbrains.mps.execution.settings.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.lang.smodel.generator.smodelAdapter.SPropertyOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.nodeEditor.cells.EditorCell_Constant; import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.AnnotationStyleClass; import jetbrains.mps.nodeEditor.MPSFonts; import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole; import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider; import jetbrains.mps.nodeEditor.EditorManager; import jetbrains.mps.openapi.editor.update.AttributeKind; /*package*/ class DeprecatedAnnotation_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public DeprecatedAnnotation_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_lchw91_a(); } private EditorCell createCollection_lchw91_a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical()); editorCell.setCellId("Collection_lchw91_a"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); editorCell.addEditorCell(createCollection_lchw91_a0()); editorCell.addEditorCell(createAttributedNodeCell_lchw91_b0()); return editorCell; } private EditorCell createCollection_lchw91_a0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_lchw91_a0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_lchw91_a0a()); if (nodeCondition_lchw91_a1a0()) { editorCell.addEditorCell(createCollection_lchw91_b0a()); } if (nodeCondition_lchw91_a2a0()) { editorCell.addEditorCell(createCollection_lchw91_c0a()); } return editorCell; } private boolean nodeCondition_lchw91_a1a0() { return isNotEmptyString(SPropertyOperations.getString(myNode, MetaAdapterFactory.getProperty(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0x7f8de21e263f5819L, 0x7f8de21e263f581bL, "since"))); } private boolean nodeCondition_lchw91_a2a0() { return isNotEmptyString(SPropertyOperations.getString(myNode, MetaAdapterFactory.getProperty(0x756e911c3f1f4a48L, 0xbdf5a2ceb91b723cL, 0x7f8de21e263f5819L, 0x7f8de21e263f581cL, "comment"))); } private EditorCell createConstant_lchw91_a0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "@Deprecated"); editorCell.setCellId("Constant_lchw91_a0a"); Style style = new StyleImpl(); new AnnotationStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.FONT_STYLE, MPSFonts.PLAIN); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createCollection_lchw91_b0a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_lchw91_b0a"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_lchw91_a1a0()); editorCell.addEditorCell(createProperty_lchw91_b1a0()); return editorCell; } private EditorCell createConstant_lchw91_a1a0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "since"); editorCell.setCellId("Constant_lchw91_a1a0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); style.set(StyleAttributes.FONT_STYLE, MPSFonts.PLAIN); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_lchw91_b1a0() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("since"); provider.setNoTargetText("<no since>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_since"); 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_lchw91_c0a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_lchw91_c0a"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_lchw91_a2a0()); editorCell.addEditorCell(createProperty_lchw91_b2a0()); editorCell.addEditorCell(createConstant_lchw91_c2a0()); return editorCell; } private EditorCell createConstant_lchw91_a2a0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "("); editorCell.setCellId("Constant_lchw91_a2a0"); Style style = new StyleImpl(); style.set(StyleAttributes.FONT_STYLE, MPSFonts.PLAIN); style.set(StyleAttributes.PUNCTUATION_RIGHT, true); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_lchw91_b2a0() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("comment"); provider.setNoTargetText("<no comment>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_comment"); 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_lchw91_c2a0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ")"); editorCell.setCellId("Constant_lchw91_c2a0"); Style style = new StyleImpl(); style.set(StyleAttributes.FONT_STYLE, MPSFonts.PLAIN); style.set(StyleAttributes.PUNCTUATION_LEFT, true); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createAttributedNodeCell_lchw91_b0() { EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext()); EditorCell editorCell = getUpdateSession().getAttributedCell(AttributeKind.NODE, myNode); return editorCell; } private static boolean isNotEmptyString(String str) { return str != null && str.length() > 0; } }