package jetbrains.mps.lang.quotation.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.openapi.editor.style.Style;
import jetbrains.mps.editor.runtime.style.StyleImpl;
import jetbrains.mps.editor.runtime.style.StyleAttributes;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.nodeEditor.cells.EditorCell_Constant;
import jetbrains.mps.nodeEditor.cells.EditorCell_Property;
import jetbrains.mps.nodeEditor.cells.ModelAccessor;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.util.EqualUtil;
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 java.util.List;
import jetbrains.mps.openapi.editor.cells.SubstituteAction;
import jetbrains.mps.nodeEditor.cellMenu.CellContext;
import jetbrains.mps.nodeEditor.cells.EditorCell_Error;
/*package*/ class Quotation_InspectorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public Quotation_InspectorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_29llnk_a_0();
}
private EditorCell createCollection_29llnk_a_0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical());
editorCell.setCellId("Collection_29llnk_a_0");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
editorCell.addEditorCell(createCollection_29llnk_a0());
return editorCell;
}
private EditorCell createCollection_29llnk_a0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal());
editorCell.setCellId("Collection_29llnk_a0");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.addEditorCell(createConstant_29llnk_a0a());
if (nodeCondition_29llnk_a1a0()) {
editorCell.addEditorCell(createReadOnlyModelAccessor_29llnk_b0a());
}
if (nodeCondition_29llnk_a2a0()) {
editorCell.addEditorCell(createError_29llnk_c0a());
}
return editorCell;
}
private boolean nodeCondition_29llnk_a1a0() {
return SLinkOperations.getTarget(myNode, MetaAdapterFactory.getContainmentLink(0x3a13115c633c4c5cL, 0xbbcc75c4219e9555L, 0x1168c104659L, 0x1168c10465aL, "quotedNode")) != null;
}
private boolean nodeCondition_29llnk_a2a0() {
return SLinkOperations.getTarget(myNode, MetaAdapterFactory.getContainmentLink(0x3a13115c633c4c5cL, 0xbbcc75c4219e9555L, 0x1168c104659L, 0x1168c10465aL, "quotedNode")) == null;
}
private EditorCell createConstant_29llnk_a0a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "concept:");
editorCell.setCellId("Constant_29llnk_a0a");
Style style = new StyleImpl();
style.set(StyleAttributes.EDITABLE, false);
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createReadOnlyModelAccessor_29llnk_b0a() {
EditorCell_Property editorCell = EditorCell_Property.create(getEditorContext(), new ModelAccessor() {
public String getText() {
return (SLinkOperations.getTarget(myNode, MetaAdapterFactory.getContainmentLink(0x3a13115c633c4c5cL, 0xbbcc75c4219e9555L, 0x1168c104659L, 0x1168c10465aL, "quotedNode")) != null ? SNodeOperations.getConcept(SLinkOperations.getTarget(myNode, MetaAdapterFactory.getContainmentLink(0x3a13115c633c4c5cL, 0xbbcc75c4219e9555L, 0x1168c104659L, 0x1168c10465aL, "quotedNode"))).getName() : "<not specitied>");
}
public void setText(String s) {
}
public boolean isValidText(String s) {
return EqualUtil.equals(s, getText());
}
}, myNode);
editorCell.setAction(CellActionType.DELETE, EmptyCellAction.getInstance());
editorCell.setAction(CellActionType.BACKSPACE, EmptyCellAction.getInstance());
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new Quotation_InspectorBuilder_a.Quotation_component_cellMenu_29llnk_a0b0a(), new SChildSubstituteInfoPartEx(editorCell)}));
editorCell.setCellId("ReadOnlyModelAccessor_29llnk_b0a");
Style style = new StyleImpl();
style.set(StyleAttributes.EDITABLE, false);
editorCell.getStyle().putAll(style);
return editorCell;
}
public static class Quotation_component_cellMenu_29llnk_a0b0a implements SubstituteInfoPartExt {
private Quotation_quotedNode myComponent;
public Quotation_component_cellMenu_29llnk_a0b0a() {
this.myComponent = new Quotation_quotedNode();
}
public List<SubstituteAction> createActions(CellContext cellContext, EditorContext editorContext) {
return this.myComponent.createSubstituteActions(cellContext, editorContext);
}
}
private EditorCell createError_29llnk_c0a() {
EditorCell_Error editorCell = new EditorCell_Error(getEditorContext(), myNode, "<not specified>");
editorCell.setCellId("Error_29llnk_c0a");
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new Quotation_InspectorBuilder_a.Quotation_component_cellMenu_29llnk_a0c0a(), new SChildSubstituteInfoPartEx(editorCell)}));
return editorCell;
}
public static class Quotation_component_cellMenu_29llnk_a0c0a implements SubstituteInfoPartExt {
private Quotation_quotedNode myComponent;
public Quotation_component_cellMenu_29llnk_a0c0a() {
this.myComponent = new Quotation_quotedNode();
}
public List<SubstituteAction> createActions(CellContext cellContext, EditorContext editorContext) {
return this.myComponent.createSubstituteActions(cellContext, editorContext);
}
}
}