package jetbrains.mps.lang.editor.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_Horizontal; import jetbrains.mps.openapi.editor.style.Style; import jetbrains.mps.editor.runtime.style.StyleImpl; import jetbrains.mps.lang.editor.editor.Styles_StyleSheet.rootCellModelStyleStyleClass; 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.cellLayout.CellLayout_Vertical; import jetbrains.mps.openapi.editor.style.StyleRegistry; import java.awt.Color; import jetbrains.mps.lang.editor.editor.Styles_StyleSheet.borderedCollectionStyleClass; import jetbrains.mps.nodeEditor.cells.EditorCell_Constant; import jetbrains.mps.lang.editor.editor.Styles_StyleSheet.borderedStyleClass; 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.nodeEditor.cellMenu.SChildSubstituteInfo; import jetbrains.mps.openapi.editor.menus.transformation.SNodeLocation; /*package*/ class CellModel_Alternation_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public CellModel_Alternation_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_zgm7s3_a(); } private EditorCell createCollection_zgm7s3_a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_zgm7s3_a"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); Style style = new StyleImpl(); new rootCellModelStyleStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.DRAW_BORDER, true); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createComponent_zgm7s3_a0()); if (nodeCondition_zgm7s3_a1a()) { editorCell.addEditorCell(createCollection_zgm7s3_b0()); } if (nodeCondition_zgm7s3_a2a()) { editorCell.addEditorCell(createCollection_zgm7s3_c0()); } editorCell.addEditorCell(createComponent_zgm7s3_d0()); return editorCell; } private boolean nodeCondition_zgm7s3_a1a() { return SPropertyOperations.getBoolean(myNode, MetaAdapterFactory.getProperty(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd76656383L, "vertical")); } private boolean nodeCondition_zgm7s3_a2a() { return !(SPropertyOperations.getBoolean(myNode, MetaAdapterFactory.getProperty(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd76656383L, "vertical"))); } private EditorCell createComponent_zgm7s3_a0() { EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.lang.editor.editor._OpenTag"); Style style = new StyleImpl(); style.set(StyleAttributes.DRAW_BORDER, true); editorCell.getStyle().putAll(style); return editorCell; } private EditorCell createCollection_zgm7s3_b0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical()); editorCell.setCellId("Collection_zgm7s3_b0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); style.set(StyleAttributes.DRAW_BORDER, true); style.set(StyleAttributes.BACKGROUND_COLOR, StyleRegistry.getInstance().getSimpleColor(_StyleParameter_QueryFunction_zgm7s3_a2b0())); editorCell.getStyle().putAll(style); editorCell.setGridLayout(true); editorCell.addEditorCell(createCollection_zgm7s3_a1a()); editorCell.addEditorCell(createCollection_zgm7s3_b1a()); return editorCell; } private Color _StyleParameter_QueryFunction_zgm7s3_a2b0() { return _EditorUtil.grayIfNotSelectable(getNode()); } private EditorCell createCollection_zgm7s3_a1a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_zgm7s3_a1a"); Style style = new StyleImpl(); new borderedCollectionStyleClass(getEditorContext(), getNode()).apply(style, editorCell); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_zgm7s3_a0b0()); editorCell.addEditorCell(createRefNode_zgm7s3_b0b0()); return editorCell; } private EditorCell createConstant_zgm7s3_a0b0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "true:"); editorCell.setCellId("Constant_zgm7s3_a0b0"); Style style = new StyleImpl(); new borderedStyleClass(getEditorContext(), getNode()).apply(style, editorCell); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNode_zgm7s3_b0b0() { SingleRoleCellProvider provider = new CellModel_Alternation_EditorBuilder_a.ifTrueCellModelSingleRoleHandler_zgm7s3_b0b0(myNode, MetaAdapterFactory.getContainmentLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd76638039L, "ifTrueCellModel"), getEditorContext()); return provider.createCell(); } private static class ifTrueCellModelSingleRoleHandler_zgm7s3_b0b0 extends SingleRoleCellProvider { @NotNull private SNode myNode; public ifTrueCellModelSingleRoleHandler_zgm7s3_b0b0(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(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd76638039L, "ifTrueCellModel"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd76638039L, "ifTrueCellModel"), 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(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd76638039L, "ifTrueCellModel"), child)); } if (editorCell.getRole() == null) { editorCell.setRole("ifTrueCellModel"); } Style style = new StyleImpl(); style.set(StyleAttributes.DRAW_BORDER, true); editorCell.getStyle().putAll(style); } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd76638039L, "ifTrueCellModel"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_ifTrueCellModel"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<no cell model>"; } } private EditorCell createCollection_zgm7s3_b1a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_zgm7s3_b1a"); Style style = new StyleImpl(); new borderedCollectionStyleClass(getEditorContext(), getNode()).apply(style, editorCell); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_zgm7s3_a1b0()); editorCell.addEditorCell(createRefNode_zgm7s3_b1b0()); return editorCell; } private EditorCell createConstant_zgm7s3_a1b0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "false:"); editorCell.setCellId("Constant_zgm7s3_a1b0"); Style style = new StyleImpl(); new borderedStyleClass(getEditorContext(), getNode()).apply(style, editorCell); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNode_zgm7s3_b1b0() { SingleRoleCellProvider provider = new CellModel_Alternation_EditorBuilder_a.ifFalseCellModelSingleRoleHandler_zgm7s3_b1b0(myNode, MetaAdapterFactory.getContainmentLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd7663bd83L, "ifFalseCellModel"), getEditorContext()); return provider.createCell(); } private static class ifFalseCellModelSingleRoleHandler_zgm7s3_b1b0 extends SingleRoleCellProvider { @NotNull private SNode myNode; public ifFalseCellModelSingleRoleHandler_zgm7s3_b1b0(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(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd7663bd83L, "ifFalseCellModel"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd7663bd83L, "ifFalseCellModel"), 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(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd7663bd83L, "ifFalseCellModel"), child)); } if (editorCell.getRole() == null) { editorCell.setRole("ifFalseCellModel"); } Style style = new StyleImpl(); style.set(StyleAttributes.DRAW_BORDER, true); editorCell.getStyle().putAll(style); } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd7663bd83L, "ifFalseCellModel"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_ifFalseCellModel"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<none>"; } } private EditorCell createCollection_zgm7s3_c0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_zgm7s3_c0"); Style style = new StyleImpl(); new borderedCollectionStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.SELECTABLE, false); style.set(StyleAttributes.BACKGROUND_COLOR, StyleRegistry.getInstance().getSimpleColor(_StyleParameter_QueryFunction_zgm7s3_a1c0())); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createCollection_zgm7s3_a2a()); editorCell.addEditorCell(createCollection_zgm7s3_b2a()); return editorCell; } private Color _StyleParameter_QueryFunction_zgm7s3_a1c0() { return _EditorUtil.grayIfNotSelectable(getNode()); } private EditorCell createCollection_zgm7s3_a2a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_zgm7s3_a2a"); Style style = new StyleImpl(); style.set(StyleAttributes.DRAW_BORDER, true); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_zgm7s3_a0c0()); editorCell.addEditorCell(createRefNode_zgm7s3_b0c0()); return editorCell; } private EditorCell createConstant_zgm7s3_a0c0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "true:"); editorCell.setCellId("Constant_zgm7s3_a0c0"); Style style = new StyleImpl(); new borderedStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.DRAW_BORDER, true); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNode_zgm7s3_b0c0() { SingleRoleCellProvider provider = new CellModel_Alternation_EditorBuilder_a.ifTrueCellModelSingleRoleHandler_zgm7s3_b0c0(myNode, MetaAdapterFactory.getContainmentLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd76638039L, "ifTrueCellModel"), getEditorContext()); return provider.createCell(); } private static class ifTrueCellModelSingleRoleHandler_zgm7s3_b0c0 extends SingleRoleCellProvider { @NotNull private SNode myNode; public ifTrueCellModelSingleRoleHandler_zgm7s3_b0c0(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(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd76638039L, "ifTrueCellModel"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd76638039L, "ifTrueCellModel"), 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(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd76638039L, "ifTrueCellModel"), child)); } if (editorCell.getRole() == null) { editorCell.setRole("ifTrueCellModel"); } Style style = new StyleImpl(); style.set(StyleAttributes.DRAW_BORDER, true); editorCell.getStyle().putAll(style); } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd76638039L, "ifTrueCellModel"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_ifTrueCellModel"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<no cell model>"; } } private EditorCell createCollection_zgm7s3_b2a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_zgm7s3_b2a"); Style style = new StyleImpl(); style.set(StyleAttributes.DRAW_BORDER, true); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_zgm7s3_a1c0()); editorCell.addEditorCell(createRefNode_zgm7s3_b1c0()); return editorCell; } private EditorCell createConstant_zgm7s3_a1c0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "false:"); editorCell.setCellId("Constant_zgm7s3_a1c0"); Style style = new StyleImpl(); new borderedStyleClass(getEditorContext(), getNode()).apply(style, editorCell); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNode_zgm7s3_b1c0() { SingleRoleCellProvider provider = new CellModel_Alternation_EditorBuilder_a.ifFalseCellModelSingleRoleHandler_zgm7s3_b1c0(myNode, MetaAdapterFactory.getContainmentLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd7663bd83L, "ifFalseCellModel"), getEditorContext()); return provider.createCell(); } private static class ifFalseCellModelSingleRoleHandler_zgm7s3_b1c0 extends SingleRoleCellProvider { @NotNull private SNode myNode; public ifFalseCellModelSingleRoleHandler_zgm7s3_b1c0(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(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd7663bd83L, "ifFalseCellModel"), child)); editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd7663bd83L, "ifFalseCellModel"), 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(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd7663bd83L, "ifFalseCellModel"), child)); } if (editorCell.getRole() == null) { editorCell.setRole("ifFalseCellModel"); } Style style = new StyleImpl(); style.set(StyleAttributes.DRAW_BORDER, true); editorCell.getStyle().putAll(style); } @Override protected EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfd766383e4L, 0xfd7663bd83L, "ifFalseCellModel"))); try { EditorCell editorCell = super.createEmptyCell(); editorCell.setCellId("empty_ifFalseCellModel"); installCellInfo(null, editorCell); setCellContext(editorCell); return editorCell; } finally { getCellFactory().popCellContext(); } } protected String getNoTargetText() { return "<no cell model>"; } } private EditorCell createComponent_zgm7s3_d0() { EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.lang.editor.editor._CloseTag"); Style style = new StyleImpl(); style.set(StyleAttributes.DRAW_BORDER, true); editorCell.getStyle().putAll(style); return editorCell; } }