package jetbrains.mps.baseLanguage.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.lang.smodel.generator.smodelAdapter.SPropertyOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.internal.collections.runtime.Sequence; import jetbrains.mps.lang.smodel.generator.smodelAdapter.AttributeOperations; 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.editor.BaseLanguageStyle_StyleSheet.KeyWordStyleClass; import jetbrains.mps.editor.runtime.style.StyleAttributes; import jetbrains.mps.lang.editor.menus.transformation.NamedTransformationMenuLookup; import jetbrains.mps.smodel.language.LanguageRegistry; import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfo; import jetbrains.mps.lang.editor.cellProviders.SingleRoleCellProvider; import org.jetbrains.mps.openapi.language.SContainmentLink; import jetbrains.mps.openapi.editor.cells.CellActionType; import jetbrains.mps.editor.runtime.impl.cellActions.CellAction_DeleteSmart; import jetbrains.mps.openapi.editor.cells.DefaultSubstituteInfo; import jetbrains.mps.editor.runtime.style.FocusPolicy; import jetbrains.mps.openapi.editor.menus.transformation.SNodeLocation; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.FieldStyleClass; import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.OperatorStyleClass; import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.SemicolonStyleClass; /*package*/ class FieldDeclaration_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public FieldDeclaration_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_2sbeba_a(); } private EditorCell createCollection_2sbeba_a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent()); editorCell.setCellId("Collection_2sbeba_a"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); editorCell.addEditorCell(createComponent_2sbeba_a0()); editorCell.addEditorCell(createComponent_2sbeba_b0()); editorCell.addEditorCell(createComponent_2sbeba_c0()); if (nodeCondition_2sbeba_a3a()) { editorCell.addEditorCell(createConstant_2sbeba_d0()); } if (nodeCondition_2sbeba_a4a()) { editorCell.addEditorCell(createConstant_2sbeba_e0()); } if (nodeCondition_2sbeba_a5a()) { editorCell.addEditorCell(createConstant_2sbeba_f0()); } editorCell.addEditorCell(createRefNode_2sbeba_g0()); editorCell.addEditorCell(createComponent_2sbeba_h0()); if (nodeCondition_2sbeba_a8a()) { editorCell.addEditorCell(createCollection_2sbeba_i0()); } editorCell.addEditorCell(createConstant_2sbeba_j0()); return editorCell; } private boolean nodeCondition_2sbeba_a3a() { return SPropertyOperations.getBoolean(myNode, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0x111f9e9f00cL, "isFinal")); } private boolean nodeCondition_2sbeba_a4a() { return SPropertyOperations.getBoolean(myNode, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c108ca68L, 0x776fe644792f90adL, "isTransient")); } private boolean nodeCondition_2sbeba_a5a() { return SPropertyOperations.getBoolean(myNode, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c108ca68L, 0x120c4a208a1L, "isVolatile")); } private boolean nodeCondition_2sbeba_a8a() { return Sequence.fromIterable(AttributeOperations.getChildNodesAndAttributes(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0xf8c37f506eL, "initializer"))).isNotEmpty(); } private EditorCell createComponent_2sbeba_a0() { EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.baseLanguage.editor._DeprecatedPart"); return editorCell; } private EditorCell createComponent_2sbeba_b0() { EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.baseLanguage.editor.HasAnnotation_AnnotationComponent"); return editorCell; } private EditorCell createComponent_2sbeba_c0() { EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.baseLanguage.editor._Component_Visibility"); return editorCell; } private EditorCell createConstant_2sbeba_d0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "final"); editorCell.setCellId("finalModifier"); Style style = new StyleImpl(); new KeyWordStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.EDITABLE, true); editorCell.getStyle().putAll(style); DeleteFinalInField.setCellActions(editorCell, myNode, getEditorContext()); editorCell.setTransformationMenuLookup(new NamedTransformationMenuLookup(LanguageRegistry.getInstance(getEditorContext().getRepository()), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c108ca68L, "jetbrains.mps.baseLanguage.structure.FieldDeclaration"), "jetbrains.mps.baseLanguage.editor.FieldDeclaration_ApplySideTransforms")); editorCell.setDefaultText(""); editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell)); return editorCell; } private EditorCell createConstant_2sbeba_e0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "transient"); editorCell.setCellId("transientModifier"); Style style = new StyleImpl(); new KeyWordStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.EDITABLE, true); editorCell.getStyle().putAll(style); DeleteTransient.setCellActions(editorCell, myNode, getEditorContext()); editorCell.setTransformationMenuLookup(new NamedTransformationMenuLookup(LanguageRegistry.getInstance(getEditorContext().getRepository()), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c108ca68L, "jetbrains.mps.baseLanguage.structure.FieldDeclaration"), "jetbrains.mps.baseLanguage.editor.FieldDeclaration_ApplySideTransforms")); editorCell.setDefaultText(""); editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell)); return editorCell; } private EditorCell createConstant_2sbeba_f0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "volatile"); editorCell.setCellId("volatileModifier"); Style style = new StyleImpl(); new KeyWordStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.EDITABLE, true); editorCell.getStyle().putAll(style); DeleteVolatile.setCellActions(editorCell, myNode, getEditorContext()); editorCell.setTransformationMenuLookup(new NamedTransformationMenuLookup(LanguageRegistry.getInstance(getEditorContext().getRepository()), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c108ca68L, "jetbrains.mps.baseLanguage.structure.FieldDeclaration"), "jetbrains.mps.baseLanguage.editor.FieldDeclaration_ApplySideTransforms")); editorCell.setDefaultText(""); editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell)); return editorCell; } private EditorCell createRefNode_2sbeba_g0() { SingleRoleCellProvider provider = new FieldDeclaration_EditorBuilder_a.typeSingleRoleHandler_2sbeba_g0(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x450368d90ce15bc3L, 0x4ed4d318133c80ceL, "type"), getEditorContext()); return provider.createCell(); } private static class typeSingleRoleHandler_2sbeba_g0 extends SingleRoleCellProvider { @NotNull private SNode myNode; public typeSingleRoleHandler_2sbeba_g0(SNode ownerNode, SContainmentLink containmentLink, EditorContext context) { super(containmentLink, context); myNode = ownerNode; } @Override @NotNull public SNode getNode() { return myNode; } protected EditorCell createChildCell(SNode child) { EditorCell editorCell = getUpdateSession().updateChildNodeCell(child); editorCell.setAction(CellActionType.DELETE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x450368d90ce15bc3L, 0x4ed4d318133c80ceL, "type"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x450368d90ce15bc3L, 0x4ed4d318133c80ceL, "type"), child)); installCellInfo(child, editorCell); return editorCell; } private void installCellInfo(SNode child, EditorCell editorCell) { if (editorCell.getSubstituteInfo() == null || editorCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) { editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell, myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x450368d90ce15bc3L, 0x4ed4d318133c80ceL, "type"), child)); } if (editorCell.getRole() == null) { editorCell.setRole("type"); } if (nodeCondition_2sbeba_a6a()) { editorCell.getStyle().set(StyleAttributes.FOCUS_POLICY, FocusPolicy.ATTRACTS_FOCUS); } } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x450368d90ce15bc3L, 0x4ed4d318133c80ceL, "type"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_type"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<no type>"; } private boolean nodeCondition_2sbeba_a6a() { return SLinkOperations.getTarget(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x450368d90ce15bc3L, 0x4ed4d318133c80ceL, "type")) == null; } } private EditorCell createComponent_2sbeba_h0() { EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.baseLanguage.editor.VariableDeclaration_NameCellComponent"); Style style = new StyleImpl(); new FieldStyleClass(getEditorContext(), getNode()).apply(style, editorCell); editorCell.getStyle().putAll(style); FieldDeclaration_Name_Actions.setCellActions(editorCell, myNode, getEditorContext()); return editorCell; } private EditorCell createCollection_2sbeba_i0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent()); editorCell.setCellId("Collection_2sbeba_i0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_2sbeba_a8a()); editorCell.addEditorCell(createRefNode_2sbeba_b8a()); return editorCell; } private EditorCell createConstant_2sbeba_a8a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "="); editorCell.setCellId("Constant_2sbeba_a8a"); Style style = new StyleImpl(); new OperatorStyleClass(getEditorContext(), getNode()).apply(style, editorCell); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNode_2sbeba_b8a() { SingleRoleCellProvider provider = new FieldDeclaration_EditorBuilder_a.initializerSingleRoleHandler_2sbeba_b8a(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0xf8c37f506eL, "initializer"), getEditorContext()); return provider.createCell(); } private static class initializerSingleRoleHandler_2sbeba_b8a extends SingleRoleCellProvider { @NotNull private SNode myNode; public initializerSingleRoleHandler_2sbeba_b8a(SNode ownerNode, SContainmentLink containmentLink, EditorContext context) { super(containmentLink, context); myNode = ownerNode; } @Override @NotNull public SNode getNode() { return myNode; } protected EditorCell createChildCell(SNode child) { EditorCell editorCell = getUpdateSession().updateChildNodeCell(child); editorCell.setAction(CellActionType.DELETE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0xf8c37f506eL, "initializer"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0xf8c37f506eL, "initializer"), child)); installCellInfo(child, editorCell); return editorCell; } private void installCellInfo(SNode child, EditorCell editorCell) { if (editorCell.getSubstituteInfo() == null || editorCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) { editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell, myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0xf8c37f506eL, "initializer"), child)); } if (editorCell.getRole() == null) { editorCell.setRole("initializer"); } Style style = new StyleImpl(); style.set(StyleAttributes.AUTO_DELETABLE, false); editorCell.getStyle().putAll(style); } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0xf8c37f506eL, "initializer"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_initializer"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<no initializer>"; } } private EditorCell createConstant_2sbeba_j0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ";"); editorCell.setCellId("Constant_2sbeba_j0"); Style style = new StyleImpl(); new SemicolonStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.INDENT_LAYOUT_NEW_LINE, true); editorCell.getStyle().putAll(style); DeleteClassifierMember.setCellActions(editorCell, myNode, getEditorContext()); editorCell.setDefaultText(""); return editorCell; } }