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.SNodeOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; import jetbrains.mps.internal.collections.runtime.Sequence; import jetbrains.mps.lang.smodel.generator.smodelAdapter.AttributeOperations; import jetbrains.mps.openapi.editor.style.Style; import jetbrains.mps.editor.runtime.style.StyleImpl; import jetbrains.mps.editor.runtime.style.StyleAttributes; import jetbrains.mps.nodeEditor.cells.EditorCell_Constant; import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.KeyWordStyleClass; 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.StaticFieldStyleClass; import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.OperatorStyleClass; import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.SemicolonStyleClass; /*package*/ class StaticFieldDeclaration_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public StaticFieldDeclaration_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_t6d1qn_a(); } private EditorCell createCollection_t6d1qn_a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent()); editorCell.setCellId("Collection_t6d1qn_a"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); editorCell.addEditorCell(createComponent_t6d1qn_a0()); editorCell.addEditorCell(createComponent_t6d1qn_b0()); if (nodeCondition_t6d1qn_a2a()) { editorCell.addEditorCell(createComponent_t6d1qn_c0()); } editorCell.addEditorCell(createConstant_t6d1qn_d0()); if (nodeCondition_t6d1qn_a4a()) { editorCell.addEditorCell(createConstant_t6d1qn_e0()); } if (nodeCondition_t6d1qn_a5a()) { editorCell.addEditorCell(createConstant_t6d1qn_f0()); } if (nodeCondition_t6d1qn_a6a()) { editorCell.addEditorCell(createConstant_t6d1qn_g0()); } editorCell.addEditorCell(createRefNode_t6d1qn_h0()); editorCell.addEditorCell(createComponent_t6d1qn_i0()); if (nodeCondition_t6d1qn_a9a()) { editorCell.addEditorCell(createCollection_t6d1qn_j0()); } editorCell.addEditorCell(createConstant_t6d1qn_k0()); return editorCell; } private boolean nodeCondition_t6d1qn_a2a() { return !(SNodeOperations.isInstanceOf(SNodeOperations.getParent(myNode), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101edd46144L, "jetbrains.mps.baseLanguage.structure.Interface"))); } private boolean nodeCondition_t6d1qn_a4a() { return SPropertyOperations.getBoolean(myNode, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0x111f9e9f00cL, "isFinal")); } private boolean nodeCondition_t6d1qn_a5a() { return SPropertyOperations.getBoolean(myNode, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93c84351fL, 0x59c57f2ed491ae1aL, "isTransient")); } private boolean nodeCondition_t6d1qn_a6a() { return SPropertyOperations.getBoolean(myNode, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93c84351fL, 0x59c57f2ed491b12fL, "isVolatile")); } private boolean nodeCondition_t6d1qn_a9a() { return Sequence.fromIterable(AttributeOperations.getChildNodesAndAttributes(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0xf8c37f506eL, "initializer"))).isNotEmpty(); } private EditorCell createComponent_t6d1qn_a0() { EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.baseLanguage.editor._DeprecatedPart"); Style style = new StyleImpl(); style.set(StyleAttributes.INDENT_LAYOUT_NEW_LINE, true); editorCell.getStyle().putAll(style); return editorCell; } private EditorCell createComponent_t6d1qn_b0() { EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.baseLanguage.editor.HasAnnotation_AnnotationComponent"); return editorCell; } private EditorCell createComponent_t6d1qn_c0() { EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.baseLanguage.editor._Component_Visibility"); return editorCell; } private EditorCell createConstant_t6d1qn_d0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "static"); editorCell.setCellId("staticModifier"); Style style = new StyleImpl(); new KeyWordStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.EDITABLE, _StyleParameter_QueryFunction_t6d1qn_a0d0()); editorCell.getStyle().putAll(style); DeleteStaticInField.setCellActions(editorCell, myNode, getEditorContext()); editorCell.setTransformationMenuLookup(new NamedTransformationMenuLookup(LanguageRegistry.getInstance(getEditorContext().getRepository()), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93c84351fL, "jetbrains.mps.baseLanguage.structure.StaticFieldDeclaration"), "jetbrains.mps.baseLanguage.editor.StaticFieldDeclaration_ApplySideTransforms")); editorCell.setDefaultText(""); editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell)); return editorCell; } private boolean _StyleParameter_QueryFunction_t6d1qn_a0d0() { return !(SNodeOperations.isInstanceOf(SNodeOperations.getParent(getNode()), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101edd46144L, "jetbrains.mps.baseLanguage.structure.Interface"))); } private EditorCell createConstant_t6d1qn_e0() { 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, _StyleParameter_QueryFunction_t6d1qn_a0e0()); editorCell.getStyle().putAll(style); DeleteFinalInStaticField.setCellActions(editorCell, myNode, getEditorContext()); editorCell.setTransformationMenuLookup(new NamedTransformationMenuLookup(LanguageRegistry.getInstance(getEditorContext().getRepository()), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93c84351fL, "jetbrains.mps.baseLanguage.structure.StaticFieldDeclaration"), "jetbrains.mps.baseLanguage.editor.StaticFieldDeclaration_ApplySideTransforms")); editorCell.setDefaultText(""); editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell)); return editorCell; } private boolean _StyleParameter_QueryFunction_t6d1qn_a0e0() { return !(SNodeOperations.isInstanceOf(SNodeOperations.getParent(getNode()), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101edd46144L, "jetbrains.mps.baseLanguage.structure.Interface"))); } private EditorCell createConstant_t6d1qn_f0() { 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); DeleteStaticTransient.setCellActions(editorCell, myNode, getEditorContext()); editorCell.setTransformationMenuLookup(new NamedTransformationMenuLookup(LanguageRegistry.getInstance(getEditorContext().getRepository()), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93c84351fL, "jetbrains.mps.baseLanguage.structure.StaticFieldDeclaration"), "jetbrains.mps.baseLanguage.editor.StaticFieldDeclaration_ApplySideTransforms")); editorCell.setDefaultText(""); editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell)); return editorCell; } private EditorCell createConstant_t6d1qn_g0() { 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); DeleteStaticVolatile.setCellActions(editorCell, myNode, getEditorContext()); editorCell.setTransformationMenuLookup(new NamedTransformationMenuLookup(LanguageRegistry.getInstance(getEditorContext().getRepository()), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93c84351fL, "jetbrains.mps.baseLanguage.structure.StaticFieldDeclaration"), "jetbrains.mps.baseLanguage.editor.StaticFieldDeclaration_ApplySideTransforms")); editorCell.setDefaultText(""); editorCell.setSubstituteInfo(new SChildSubstituteInfo(editorCell)); return editorCell; } private EditorCell createRefNode_t6d1qn_h0() { SingleRoleCellProvider provider = new StaticFieldDeclaration_EditorBuilder_a.typeSingleRoleHandler_t6d1qn_h0(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x450368d90ce15bc3L, 0x4ed4d318133c80ceL, "type"), getEditorContext()); return provider.createCell(); } private static class typeSingleRoleHandler_t6d1qn_h0 extends SingleRoleCellProvider { @NotNull private SNode myNode; public typeSingleRoleHandler_t6d1qn_h0(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_t6d1qn_a7a()) { 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_t6d1qn_a7a() { return SLinkOperations.getTarget(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x450368d90ce15bc3L, 0x4ed4d318133c80ceL, "type")) == null; } } private EditorCell createComponent_t6d1qn_i0() { EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.baseLanguage.editor.VariableDeclaration_NameCellComponent"); Style style = new StyleImpl(); new StaticFieldStyleClass(getEditorContext(), getNode()).apply(style, editorCell); editorCell.getStyle().putAll(style); StaticFieldDeclaration_Name_Actions.setCellActions(editorCell, myNode, getEditorContext()); return editorCell; } private EditorCell createCollection_t6d1qn_j0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent()); editorCell.setCellId("Collection_t6d1qn_j0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_t6d1qn_a9a()); editorCell.addEditorCell(createRefNode_t6d1qn_b9a()); return editorCell; } private EditorCell createConstant_t6d1qn_a9a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "="); editorCell.setCellId("Constant_t6d1qn_a9a"); Style style = new StyleImpl(); new OperatorStyleClass(getEditorContext(), getNode()).apply(style, editorCell); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNode_t6d1qn_b9a() { SingleRoleCellProvider provider = new StaticFieldDeclaration_EditorBuilder_a.initializerSingleRoleHandler_t6d1qn_b9a(myNode, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0xf8c37f506eL, "initializer"), getEditorContext()); return provider.createCell(); } private static class initializerSingleRoleHandler_t6d1qn_b9a extends SingleRoleCellProvider { @NotNull private SNode myNode; public initializerSingleRoleHandler_t6d1qn_b9a(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_t6d1qn_k0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ";"); editorCell.setCellId("Constant_t6d1qn_k0"); 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; } }