package jetbrains.mps.lang.structure.editor;
/*Generated by MPS */
import jetbrains.mps.openapi.editor.cells.EditorCell;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.openapi.editor.EditorContext;
import jetbrains.mps.openapi.editor.cells.CellActionType;
import jetbrains.mps.editor.runtime.cells.AbstractCellAction;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.editor.runtime.selection.SelectionUtil;
public class PropertyDeclarationDeleteActions {
public static void setCellActions(EditorCell editorCell, SNode node, EditorContext context) {
editorCell.setAction(CellActionType.DELETE, new PropertyDeclarationDeleteActions.PropertyDeclarationDeleteActions_DELETE(node));
editorCell.setAction(CellActionType.BACKSPACE, new PropertyDeclarationDeleteActions.PropertyDeclarationDeleteActions_BACKSPACE(node));
}
public static class PropertyDeclarationDeleteActions_DELETE extends AbstractCellAction {
/*package*/ SNode myNode;
public PropertyDeclarationDeleteActions_DELETE(SNode node) {
this.myNode = node;
}
public void execute(EditorContext editorContext) {
this.execute_internal(editorContext, this.myNode);
}
public void execute_internal(EditorContext editorContext, SNode node) {
if (!(CustomActionsHandler.canHandleAbstractConceptDeclarationMemberActions(node, editorContext))) {
return;
}
SNode containingAbstractConcept = SNodeOperations.cast(SNodeOperations.getParent(node), MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x1103553c5ffL, "jetbrains.mps.lang.structure.structure.AbstractConceptDeclaration"));
if (!(CustomActionsHandler.deleteElementFromCollectionAndSetSelection(node, SLinkOperations.getChildren(containingAbstractConcept, MetaAdapterFactory.getContainmentLink(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x1103553c5ffL, 0xf979c3ba6cL, "propertyDeclaration")), editorContext))) {
if (SNodeOperations.isInstanceOf(containingAbstractConcept, MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xf979ba0450L, "jetbrains.mps.lang.structure.structure.ConceptDeclaration"))) {
SNode cd = SNodeOperations.cast(containingAbstractConcept, MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xf979ba0450L, "jetbrains.mps.lang.structure.structure.ConceptDeclaration"));
SelectionUtil.selectLabelCellAnSetCaret(editorContext, cd, "emptyPropertiesPlaceHolder", 0);
} else if (SNodeOperations.isInstanceOf(containingAbstractConcept, MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x1103556dcafL, "jetbrains.mps.lang.structure.structure.InterfaceConceptDeclaration"))) {
SNode id = SNodeOperations.cast(containingAbstractConcept, MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x1103556dcafL, "jetbrains.mps.lang.structure.structure.InterfaceConceptDeclaration"));
SelectionUtil.selectLabelCellAnSetCaret(editorContext, id, "emptyPropertiesPlaceHolder", 0);
}
}
}
}
public static class PropertyDeclarationDeleteActions_BACKSPACE extends AbstractCellAction {
/*package*/ SNode myNode;
public PropertyDeclarationDeleteActions_BACKSPACE(SNode node) {
this.myNode = node;
}
public void execute(EditorContext editorContext) {
this.execute_internal(editorContext, this.myNode);
}
public void execute_internal(EditorContext editorContext, SNode node) {
if (!(CustomActionsHandler.canHandleAbstractConceptDeclarationMemberActions(node, editorContext))) {
return;
}
SNode containingAbstractConcept = SNodeOperations.cast(SNodeOperations.getParent(node), MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x1103553c5ffL, "jetbrains.mps.lang.structure.structure.AbstractConceptDeclaration"));
if (!(CustomActionsHandler.backspaceElementFromCollectionAndSetSelection(node, SLinkOperations.getChildren(containingAbstractConcept, MetaAdapterFactory.getContainmentLink(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x1103553c5ffL, 0xf979c3ba6cL, "propertyDeclaration")), editorContext))) {
if (SNodeOperations.isInstanceOf(containingAbstractConcept, MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xf979ba0450L, "jetbrains.mps.lang.structure.structure.ConceptDeclaration"))) {
SNode cd = SNodeOperations.cast(containingAbstractConcept, MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xf979ba0450L, "jetbrains.mps.lang.structure.structure.ConceptDeclaration"));
SelectionUtil.selectLabelCellAnSetCaret(editorContext, cd, "emptyPropertiesPlaceHolder", 0);
} else if (SNodeOperations.isInstanceOf(containingAbstractConcept, MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x1103556dcafL, "jetbrains.mps.lang.structure.structure.InterfaceConceptDeclaration"))) {
SNode id = SNodeOperations.cast(containingAbstractConcept, MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x1103556dcafL, "jetbrains.mps.lang.structure.structure.InterfaceConceptDeclaration"));
SelectionUtil.selectLabelCellAnSetCaret(editorContext, id, "emptyPropertiesPlaceHolder", 0);
}
}
}
}
}