package jetbrains.mps.lang.test.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.nodeEditor.cells.EditorCell_Constant; import jetbrains.mps.nodeEditor.cells.ModelAccessor; import jetbrains.mps.baseLanguage.unitTest.behavior.ITestCase__BehaviorDescriptor; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.nodeEditor.cells.EditorCell_Property; import jetbrains.mps.openapi.editor.cells.CellActionType; import jetbrains.mps.editor.runtime.cells.EmptyCellAction; import jetbrains.mps.nodeEditor.cellMenu.CompositeSubstituteInfo; import jetbrains.mps.nodeEditor.cellMenu.BasicCellContext; import jetbrains.mps.nodeEditor.cellMenu.SubstituteInfoPartExt; import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfoPartEx; import jetbrains.mps.lang.editor.generator.internal.AbstractCellMenuPart_Generic_Item; import org.jetbrains.mps.openapi.model.SModel; import jetbrains.mps.smodel.IOperationContext; import jetbrains.mps.nodeEditor.cellLayout.CellLayout_Indent; 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.cellProviders.AbstractCellListHandler; import jetbrains.mps.lang.editor.cellProviders.RefNodeListHandler; import jetbrains.mps.smodel.action.NodeFactoryManager; import jetbrains.mps.openapi.editor.menus.transformation.SNodeLocation; import jetbrains.mps.nodeEditor.cellActions.CellAction_DeleteNode; import jetbrains.mps.openapi.editor.cells.DefaultSubstituteInfo; import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfo; /*package*/ class EditorTestCase_InspectorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public EditorTestCase_InspectorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_6iwt9a_a_0(); } private EditorCell createCollection_6iwt9a_a_0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical()); editorCell.setCellId("Collection_6iwt9a_a_0"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); editorCell.addEditorCell(createCollection_6iwt9a_a0()); editorCell.addEditorCell(createConstant_6iwt9a_b0()); editorCell.addEditorCell(createCollection_6iwt9a_c0()); return editorCell; } private EditorCell createCollection_6iwt9a_a0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_6iwt9a_a0"); editorCell.addEditorCell(createConstant_6iwt9a_a0a()); editorCell.addEditorCell(createModelAccess_6iwt9a_b0a()); return editorCell; } private EditorCell createConstant_6iwt9a_a0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "Can execute-in-process:"); editorCell.setCellId("Constant_6iwt9a_a0a"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createModelAccess_6iwt9a_b0a() { ModelAccessor modelAccessor = new ModelAccessor() { public String getText() { return (boolean) ITestCase__BehaviorDescriptor.canRunInProcess_id5_jSk8paieB.invoke(myNode) + ""; } public void setText(String text) { if (text.equals("true")) { SPropertyOperations.set(myNode, MetaAdapterFactory.getProperty(0xf61473f9130f42f6L, 0xb98d6c438812c2f6L, 0x11b2709bd56L, 0x59337dc8dffe0d9dL, "canNotRunInProcess"), "" + (false)); } else if (text.equals("false")) { SPropertyOperations.set(myNode, MetaAdapterFactory.getProperty(0xf61473f9130f42f6L, 0xb98d6c438812c2f6L, 0x11b2709bd56L, 0x59337dc8dffe0d9dL, "canNotRunInProcess"), "" + (true)); } } public boolean isValidText(String text) { return text.equals("true") || text.equals("false"); } }; EditorCell_Property editorCell = EditorCell_Property.create(getEditorContext(), modelAccessor, myNode); editorCell.setAction(CellActionType.DELETE, EmptyCellAction.getInstance()); editorCell.setAction(CellActionType.BACKSPACE, EmptyCellAction.getInstance()); editorCell.setCellId("ModelAccess_6iwt9a_b0a"); editorCell.setDefaultText(" "); editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new EditorTestCase_InspectorBuilder_a.EditorTestCase_generic_cellMenu_6iwt9a_a0b0a(), new EditorTestCase_InspectorBuilder_a.EditorTestCase_generic_cellMenu_6iwt9a_b0b0a(), new SChildSubstituteInfoPartEx(editorCell)})); return editorCell; } public static class EditorTestCase_generic_cellMenu_6iwt9a_a0b0a extends AbstractCellMenuPart_Generic_Item { public EditorTestCase_generic_cellMenu_6iwt9a_a0b0a() { } public void handleAction(SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) { SPropertyOperations.set(node, MetaAdapterFactory.getProperty(0xf61473f9130f42f6L, 0xb98d6c438812c2f6L, 0x11b2709bd56L, 0x59337dc8dffe0d9dL, "canNotRunInProcess"), "" + (true)); } public String getMatchingText() { return "false"; } } public static class EditorTestCase_generic_cellMenu_6iwt9a_b0b0a extends AbstractCellMenuPart_Generic_Item { public EditorTestCase_generic_cellMenu_6iwt9a_b0b0a() { } public void handleAction(SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) { SPropertyOperations.set(node, MetaAdapterFactory.getProperty(0xf61473f9130f42f6L, 0xb98d6c438812c2f6L, 0x11b2709bd56L, 0x59337dc8dffe0d9dL, "canNotRunInProcess"), "" + (false)); } public String getMatchingText() { return "true"; } } private EditorCell createConstant_6iwt9a_b0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ""); editorCell.setCellId("Constant_6iwt9a_b0"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createCollection_6iwt9a_c0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent()); editorCell.setCellId("Collection_6iwt9a_c0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_6iwt9a_a2a()); editorCell.addEditorCell(createRefNodeList_6iwt9a_b2a()); return editorCell; } private EditorCell createConstant_6iwt9a_a2a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "Expected log events:"); editorCell.setCellId("Constant_6iwt9a_a2a"); Style style = new StyleImpl(); style.set(StyleAttributes.INDENT_LAYOUT_NEW_LINE, true); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createRefNodeList_6iwt9a_b2a() { AbstractCellListHandler handler = new EditorTestCase_InspectorBuilder_a.logEventsListHandler_6iwt9a_b2a(myNode, "logEvents", getEditorContext()); EditorCell_Collection editorCell = handler.createCells(new CellLayout_Indent(), false); editorCell.setCellId("refNodeList_logEvents"); Style style = new StyleImpl(); style.set(StyleAttributes.INDENT_LAYOUT_INDENT, true); style.set(StyleAttributes.INDENT_LAYOUT_CHILDREN_NEWLINE, true); editorCell.getStyle().putAll(style); editorCell.setRole(handler.getElementRole()); return editorCell; } private static class logEventsListHandler_6iwt9a_b2a extends RefNodeListHandler { @NotNull private SNode myNode; public logEventsListHandler_6iwt9a_b2a(SNode ownerNode, String childRole, EditorContext context) { super(ownerNode, childRole, context, false); myNode = ownerNode; } @Override @NotNull public SNode getNode() { return myNode; } public SNode createNodeToInsert(EditorContext editorContext) { return NodeFactoryManager.createNode(MetaAdapterFactory.getConcept(0x8585453e6bfb4d80L, 0x98deb16074f1d86cL, 0x486f8079df2fd630L, "jetbrains.mps.lang.test.structure.LogEvent"), null, getNode(), getNode().getModel()); } public EditorCell createNodeCell(SNode elementNode) { EditorCell elementCell = getUpdateSession().updateChildNodeCell(elementNode); installElementCellActions(elementNode, elementCell); return elementCell; } public EditorCell createEmptyCell() { getCellFactory().pushCellContext(); getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(logEventsListHandler_6iwt9a_b2a.this.getNode(), MetaAdapterFactory.getContainmentLink(0x8585453e6bfb4d80L, 0x98deb16074f1d86cL, 0x11e314b20e0L, 0x486f8079df2fd868L, "logEvents"))); try { EditorCell emptyCell = null; emptyCell = super.createEmptyCell(); installElementCellActions(null, emptyCell); setCellContext(emptyCell); return emptyCell; } finally { getCellFactory().popCellContext(); } } public void installElementCellActions(SNode elementNode, EditorCell elementCell) { if (elementCell.getUserObject(AbstractCellListHandler.ELEMENT_CELL_ACTIONS_SET) == null) { elementCell.putUserObject(AbstractCellListHandler.ELEMENT_CELL_ACTIONS_SET, AbstractCellListHandler.ELEMENT_CELL_ACTIONS_SET); if (elementNode != null) { elementCell.setAction(CellActionType.DELETE, new CellAction_DeleteNode(elementNode, CellAction_DeleteNode.DeleteDirection.FORWARD)); elementCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteNode(elementNode, CellAction_DeleteNode.DeleteDirection.BACKWARD)); } if (elementCell.getSubstituteInfo() == null || elementCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) { elementCell.setSubstituteInfo(new SChildSubstituteInfo(elementCell, getNode(), MetaAdapterFactory.getContainmentLink(0x8585453e6bfb4d80L, 0x98deb16074f1d86cL, 0x11e314b20e0L, 0x486f8079df2fd868L, "logEvents"), elementNode)); } } } } }