package jetbrains.mps.lang.smodel.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.nodeEditor.cells.EditorCell_Constant;
import jetbrains.mps.openapi.editor.style.Style;
import jetbrains.mps.editor.runtime.style.StyleImpl;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.KeyWordStyleClass;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.LeftParenAfterNameStyleClass;
import jetbrains.mps.nodeEditor.cells.EditorCell_Property;
import jetbrains.mps.nodeEditor.cells.ModelAccessor;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.lang.core.behavior.INamedConcept__BehaviorDescriptor;
import jetbrains.mps.util.EqualUtil;
import jetbrains.mps.openapi.editor.cells.CellActionType;
import jetbrains.mps.editor.runtime.cells.EmptyCellAction;
import jetbrains.mps.lang.sharedConcepts.editor.SharedStyles_StyleSheet.ReferenceOnConceptStyleClass;
import jetbrains.mps.editor.runtime.style.StyleAttributes;
import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.RightParenStyleClass;
/*package*/ class SNodeType_InspectorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public SNodeType_InspectorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_x5m1a6_a_0();
}
private EditorCell createCollection_x5m1a6_a_0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_x5m1a6_a_0");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
editorCell.addEditorCell(createConstant_x5m1a6_a0_0());
editorCell.addEditorCell(createConstant_x5m1a6_b0_0());
editorCell.addEditorCell(createReadOnlyModelAccessor_x5m1a6_c0());
editorCell.addEditorCell(createConstant_x5m1a6_d0_0());
return editorCell;
}
private EditorCell createConstant_x5m1a6_a0_0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "node");
editorCell.setCellId("Constant_x5m1a6_a0_0");
Style style = new StyleImpl();
new KeyWordStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_x5m1a6_b0_0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "<");
editorCell.setCellId("Constant_x5m1a6_b0_0");
Style style = new StyleImpl();
new LeftParenAfterNameStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createReadOnlyModelAccessor_x5m1a6_c0() {
EditorCell_Property editorCell = EditorCell_Property.create(getEditorContext(), new ModelAccessor() {
public String getText() {
return ((SLinkOperations.getTarget(myNode, MetaAdapterFactory.getReferenceLink(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x108f968b3caL, 0x1090e46ca51L, "concept")) != null) ? INamedConcept__BehaviorDescriptor.getFqName_idhEwIO9y.invoke(SLinkOperations.getTarget(myNode, MetaAdapterFactory.getReferenceLink(0x7866978ea0f04cc7L, 0x81bc4d213d9375e1L, 0x108f968b3caL, 0x1090e46ca51L, "concept"))) : "");
}
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.setCellId("ReadOnlyModelAccessor_x5m1a6_c0");
Style style = new StyleImpl();
new ReferenceOnConceptStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.EDITABLE, false);
editorCell.getStyle().putAll(style);
return editorCell;
}
private EditorCell createConstant_x5m1a6_d0_0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ">");
editorCell.setCellId("Constant_x5m1a6_d0_0");
Style style = new StyleImpl();
new RightParenStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
}