package jetbrains.mps.lang.pattern.testLang.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;
/*package*/ class PatternTest_InspectorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public PatternTest_InspectorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_kasahx_a_0();
}
private EditorCell createCollection_kasahx_a_0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical());
editorCell.setCellId("Collection_kasahx_a_0");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
editorCell.addEditorCell(createCollection_kasahx_a0());
return editorCell;
}
private EditorCell createCollection_kasahx_a0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal());
editorCell.setCellId("Collection_kasahx_a0");
editorCell.addEditorCell(createConstant_kasahx_a0a());
editorCell.addEditorCell(createModelAccess_kasahx_b0a());
return editorCell;
}
private EditorCell createConstant_kasahx_a0a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "Can execute-in-process:");
editorCell.setCellId("Constant_kasahx_a0a");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createModelAccess_kasahx_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_kasahx_b0a");
editorCell.setDefaultText(" ");
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new PatternTest_InspectorBuilder_a.PatternTest_generic_cellMenu_kasahx_a0b0a(), new PatternTest_InspectorBuilder_a.PatternTest_generic_cellMenu_kasahx_b0b0a(), new SChildSubstituteInfoPartEx(editorCell)}));
return editorCell;
}
public static class PatternTest_generic_cellMenu_kasahx_a0b0a extends AbstractCellMenuPart_Generic_Item {
public PatternTest_generic_cellMenu_kasahx_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 PatternTest_generic_cellMenu_kasahx_b0b0a extends AbstractCellMenuPart_Generic_Item {
public PatternTest_generic_cellMenu_kasahx_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";
}
}
}