package jetbrains.mps.lang.structure.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.lang.structure.editor.structure_StyleSheet.AnnotationNodeStyleClass; import jetbrains.mps.editor.runtime.style.Padding; import jetbrains.mps.editor.runtime.style.Measure; import jetbrains.mps.openapi.editor.style.StyleRegistry; import jetbrains.mps.nodeEditor.MPSColors; 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 DeprecatedNodeAnnotation_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public DeprecatedNodeAnnotation_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_cv1jro_a(); } private EditorCell createCollection_cv1jro_a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical()); editorCell.setCellId("Collection_cv1jro_a"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); editorCell.addEditorCell(createCollection_cv1jro_a0()); editorCell.addEditorCell(createAttributedNodeCell_cv1jro_b0()); return editorCell; } private EditorCell createCollection_cv1jro_a0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_cv1jro_a0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_cv1jro_a0a()); if (nodeCondition_cv1jro_a1a0()) { editorCell.addEditorCell(createCollection_cv1jro_b0a()); } if (nodeCondition_cv1jro_a2a0()) { editorCell.addEditorCell(createCollection_cv1jro_c0a()); } return editorCell; } private boolean nodeCondition_cv1jro_a1a0() { return SPropertyOperations.getString(myNode, MetaAdapterFactory.getProperty(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x11d0a70ae54L, 0x11d3ec760e8L, "comment")) != null; } private boolean nodeCondition_cv1jro_a2a0() { return SPropertyOperations.getString(myNode, MetaAdapterFactory.getProperty(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x11d0a70ae54L, 0x11d3ec75203L, "build")) != null; } private EditorCell createConstant_cv1jro_a0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "@Deprecated"); editorCell.setCellId("Constant_cv1jro_a0a"); Style style = new StyleImpl(); new AnnotationNodeStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.PADDING_RIGHT, new Padding(1.0, Measure.SPACES)); editorCell.getStyle().putAll(style); DeprecatedNodeAnnotation_ActionMap.setCellActions(editorCell, myNode, getEditorContext()); editorCell.setDefaultText(""); return editorCell; } private EditorCell createCollection_cv1jro_b0a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_cv1jro_b0a"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_cv1jro_a1a0()); editorCell.addEditorCell(createProperty_cv1jro_b1a0()); editorCell.addEditorCell(createConstant_cv1jro_c1a0()); return editorCell; } private EditorCell createConstant_cv1jro_a1a0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "("); editorCell.setCellId("Constant_cv1jro_a1a0"); Style style = new StyleImpl(); style.set(StyleAttributes.MATCHING_LABEL, "brace"); style.set(StyleAttributes.TEXT_COLOR, StyleRegistry.getInstance().getSimpleColor(MPSColors.DARK_GREEN)); style.set(StyleAttributes.PUNCTUATION_RIGHT, true); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_cv1jro_b1a0() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("comment"); provider.setNoTargetText("<no comment>"); provider.setAllowsEmptyTarget(true); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_comment"); Style style = new StyleImpl(); style.set(StyleAttributes.TEXT_COLOR, StyleRegistry.getInstance().getSimpleColor(MPSColors.DARK_GREEN)); style.set(StyleAttributes.PADDING_LEFT, new Padding(0.0, Measure.SPACES)); style.set(StyleAttributes.PADDING_RIGHT, new Padding(0.0, Measure.SPACES)); 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_cv1jro_c1a0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ")"); editorCell.setCellId("Constant_cv1jro_c1a0"); Style style = new StyleImpl(); style.set(StyleAttributes.MATCHING_LABEL, "brace"); style.set(StyleAttributes.TEXT_COLOR, StyleRegistry.getInstance().getSimpleColor(MPSColors.DARK_GREEN)); style.set(StyleAttributes.PUNCTUATION_LEFT, true); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createCollection_cv1jro_c0a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_cv1jro_c0a"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_cv1jro_a2a0()); editorCell.addEditorCell(createProperty_cv1jro_b2a0()); return editorCell; } private EditorCell createConstant_cv1jro_a2a0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "since build"); editorCell.setCellId("Constant_cv1jro_a2a0"); Style style = new StyleImpl(); style.set(StyleAttributes.TEXT_COLOR, StyleRegistry.getInstance().getSimpleColor(MPSColors.DARK_GREEN)); style.set(StyleAttributes.PADDING_RIGHT, new Padding(1.0, Measure.SPACES)); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_cv1jro_b2a0() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("build"); provider.setNoTargetText("<no build>"); provider.setAllowsEmptyTarget(true); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_build"); Style style = new StyleImpl(); style.set(StyleAttributes.TEXT_COLOR, StyleRegistry.getInstance().getSimpleColor(MPSColors.blue)); 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 createAttributedNodeCell_cv1jro_b0() { EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext()); EditorCell editorCell = getUpdateSession().getAttributedCell(AttributeKind.NODE, myNode); return editorCell; } }