package jetbrains.mps.debugger.java.customViewers.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.SPropertyOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.nodeEditor.cells.EditorCell_Constant;
import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole;
import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider;
import jetbrains.mps.nodeEditor.EditorManager;
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 HighLevelCustomViewer_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public HighLevelCustomViewer_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_5jxfrn_a();
}
private EditorCell createCollection_5jxfrn_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical());
editorCell.setCellId("Collection_5jxfrn_a");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
editorCell.addEditorCell(createCollection_5jxfrn_a0());
editorCell.addEditorCell(createConstant_5jxfrn_b0());
editorCell.addEditorCell(createCollection_5jxfrn_c0());
editorCell.addEditorCell(createCollection_5jxfrn_d0());
editorCell.addEditorCell(createConstant_5jxfrn_e0());
editorCell.addEditorCell(createConstant_5jxfrn_f0());
editorCell.addEditorCell(createRefNode_5jxfrn_g0());
editorCell.addEditorCell(createConstant_5jxfrn_h0());
editorCell.addEditorCell(createConstant_5jxfrn_i0());
editorCell.addEditorCell(createRefNode_5jxfrn_j0());
editorCell.addEditorCell(createConstant_5jxfrn_k0());
editorCell.addEditorCell(createConstant_5jxfrn_l0());
editorCell.addEditorCell(createRefNode_5jxfrn_m0());
return editorCell;
}
private EditorCell createCollection_5jxfrn_a0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal());
editorCell.setCellId("Collection_5jxfrn_a0");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.addEditorCell(createConstant_5jxfrn_a0a());
editorCell.addEditorCell(createProperty_5jxfrn_b0a());
if (nodeCondition_5jxfrn_a2a0()) {
editorCell.addEditorCell(createCollection_5jxfrn_c0a());
}
return editorCell;
}
private boolean nodeCondition_5jxfrn_a2a0() {
return isNotEmptyString(SPropertyOperations.getString(myNode, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x10802efe25aL, 0x10d34fa226eL, "alias")));
}
private EditorCell createConstant_5jxfrn_a0a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "custom viewer");
editorCell.setCellId("Constant_5jxfrn_a0a");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createProperty_5jxfrn_b0a() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("name");
provider.setNoTargetText("<no name>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_name");
editorCell.setSubstituteInfo(provider.createDefaultSubstituteInfo());
SNode attributeConcept = provider.getRoleAttribute();
if (attributeConcept != null) {
EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext());
return manager.createNodeRoleAttributeCell(attributeConcept, provider.getRoleAttributeKind(), editorCell);
} else
return editorCell;
}
private EditorCell createCollection_5jxfrn_c0a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal());
editorCell.setCellId("Collection_5jxfrn_c0a");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.addEditorCell(createConstant_5jxfrn_a2a0());
editorCell.addEditorCell(createProperty_5jxfrn_b2a0());
return editorCell;
}
private EditorCell createConstant_5jxfrn_a2a0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "as");
editorCell.setCellId("Constant_5jxfrn_a2a0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createProperty_5jxfrn_b2a0() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("alias");
provider.setNoTargetText("default");
provider.setAllowsEmptyTarget(true);
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_alias");
editorCell.setSubstituteInfo(provider.createDefaultSubstituteInfo());
SNode attributeConcept = provider.getRoleAttribute();
if (attributeConcept != null) {
EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext());
return manager.createNodeRoleAttributeCell(attributeConcept, provider.getRoleAttributeKind(), editorCell);
} else
return editorCell;
}
private EditorCell createConstant_5jxfrn_b0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "");
editorCell.setCellId("Constant_5jxfrn_b0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createCollection_5jxfrn_c0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal());
editorCell.setCellId("Collection_5jxfrn_c0");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.addEditorCell(createConstant_5jxfrn_a2a());
editorCell.addEditorCell(createProperty_5jxfrn_b2a());
return editorCell;
}
private EditorCell createConstant_5jxfrn_a2a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "show as:");
editorCell.setCellId("Constant_5jxfrn_a2a");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createProperty_5jxfrn_b2a() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("caption");
provider.setNoTargetText("<use name>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_caption");
editorCell.setSubstituteInfo(provider.createDefaultSubstituteInfo());
SNode attributeConcept = provider.getRoleAttribute();
if (attributeConcept != null) {
EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext());
return manager.createNodeRoleAttributeCell(attributeConcept, provider.getRoleAttributeKind(), editorCell);
} else
return editorCell;
}
private EditorCell createCollection_5jxfrn_d0() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal());
editorCell.setCellId("Collection_5jxfrn_d0");
editorCell.addEditorCell(createConstant_5jxfrn_a3a());
editorCell.addEditorCell(createRefNode_5jxfrn_b3a());
return editorCell;
}
private EditorCell createConstant_5jxfrn_a3a() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "for type:");
editorCell.setCellId("Constant_5jxfrn_a3a");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNode_5jxfrn_b3a() {
SingleRoleCellProvider provider = new HighLevelCustomViewer_EditorBuilder_a.valueTypeSingleRoleHandler_5jxfrn_b3a(myNode, MetaAdapterFactory.getContainmentLink(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043fbc1aL, "valueType"), getEditorContext());
return provider.createCell();
}
private static class valueTypeSingleRoleHandler_5jxfrn_b3a extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public valueTypeSingleRoleHandler_5jxfrn_b3a(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(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043fbc1aL, "valueType"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043fbc1aL, "valueType"), 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(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043fbc1aL, "valueType"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("valueType");
}
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043fbc1aL, "valueType")));
try {
EditorCell editorCell = super.createEmptyCell();
editorCell.setCellId("empty_valueType");
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
protected String getNoTargetText() {
return "<no valueType>";
}
}
private EditorCell createConstant_5jxfrn_e0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "");
editorCell.setCellId("Constant_5jxfrn_e0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_5jxfrn_f0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "can wrap:");
editorCell.setCellId("Constant_5jxfrn_f0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNode_5jxfrn_g0() {
SingleRoleCellProvider provider = new HighLevelCustomViewer_EditorBuilder_a.canWrapSingleRoleHandler_5jxfrn_g0(myNode, MetaAdapterFactory.getContainmentLink(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecbdfL, "canWrap"), getEditorContext());
return provider.createCell();
}
private static class canWrapSingleRoleHandler_5jxfrn_g0 extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public canWrapSingleRoleHandler_5jxfrn_g0(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(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecbdfL, "canWrap"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecbdfL, "canWrap"), 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(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecbdfL, "canWrap"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("canWrap");
}
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecbdfL, "canWrap")));
try {
EditorCell editorCell = super.createEmptyCell();
editorCell.setCellId("empty_canWrap");
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
protected String getNoTargetText() {
return "<no canWrap>";
}
}
private EditorCell createConstant_5jxfrn_h0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "");
editorCell.setCellId("Constant_5jxfrn_h0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_5jxfrn_i0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "get presentation:");
editorCell.setCellId("Constant_5jxfrn_i0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNode_5jxfrn_j0() {
SingleRoleCellProvider provider = new HighLevelCustomViewer_EditorBuilder_a.getPresentationSingleRoleHandler_5jxfrn_j0(myNode, MetaAdapterFactory.getContainmentLink(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecc32L, "getPresentation"), getEditorContext());
return provider.createCell();
}
private static class getPresentationSingleRoleHandler_5jxfrn_j0 extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public getPresentationSingleRoleHandler_5jxfrn_j0(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(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecc32L, "getPresentation"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecc32L, "getPresentation"), 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(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecc32L, "getPresentation"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("getPresentation");
}
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecc32L, "getPresentation")));
try {
EditorCell editorCell = super.createEmptyCell();
editorCell.setCellId("empty_getPresentation");
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
protected String getNoTargetText() {
return "<no getPresentation>";
}
}
private EditorCell createConstant_5jxfrn_k0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "");
editorCell.setCellId("Constant_5jxfrn_k0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createConstant_5jxfrn_l0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "get custom watchables");
editorCell.setCellId("Constant_5jxfrn_l0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNode_5jxfrn_m0() {
SingleRoleCellProvider provider = new HighLevelCustomViewer_EditorBuilder_a.getWatchablesSingleRoleHandler_5jxfrn_m0(myNode, MetaAdapterFactory.getContainmentLink(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecc33L, "getWatchables"), getEditorContext());
return provider.createCell();
}
private static class getWatchablesSingleRoleHandler_5jxfrn_m0 extends SingleRoleCellProvider {
@NotNull
private SNode myNode;
public getWatchablesSingleRoleHandler_5jxfrn_m0(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(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecc33L, "getWatchables"), child));
editorCell.setAction(CellActionType.BACKSPACE, new CellAction_DeleteSmart(getNode(), MetaAdapterFactory.getContainmentLink(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecc33L, "getWatchables"), 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(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecc33L, "getWatchables"), child));
}
if (editorCell.getRole() == null) {
editorCell.setRole("getWatchables");
}
}
@Override
protected EditorCell createEmptyCell() {
getCellFactory().pushCellContext();
getCellFactory().setNodeLocation(new SNodeLocation.FromParentAndLink(getNode(), MetaAdapterFactory.getContainmentLink(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x97038071a3bfa40L, 0x9a1514043ecc33L, "getWatchables")));
try {
EditorCell editorCell = super.createEmptyCell();
editorCell.setCellId("empty_getWatchables");
installCellInfo(null, editorCell);
setCellContext(editorCell);
return editorCell;
} finally {
getCellFactory().popCellContext();
}
}
protected String getNoTargetText() {
return "<no getWatchables>";
}
}
private static boolean isNotEmptyString(String str) {
return str != null && str.length() > 0;
}
}