package jetbrains.mps.editor.runtime.impl.cellActions; /*Generated by MPS */ import org.jetbrains.mps.openapi.model.SNode; import org.jetbrains.annotations.NotNull; import jetbrains.mps.openapi.editor.EditorContext; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.nodeEditor.selectionRestoring.RestorableSelection; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.nodeEditor.selectionRestoring.RestorableSelectionByNode; import jetbrains.mps.nodeEditor.selectionRestoring.RestorableSelectionComposite; import jetbrains.mps.openapi.editor.cells.EditorCell; /** * Used only in CellActionCommentOrUncomment * Remove when there will be no instances in generated code * * @deprecated */ @Deprecated public class CellAction_Uncomment extends AbstractCommentAction { private final SNode myNode; @Deprecated public CellAction_Uncomment(@NotNull SNode node) { myNode = node; } @Override public boolean canExecute(EditorContext context) { return SNodeOperations.getParent(myNode) != null && isNonTrivialSingleSelection(context); } protected void executeInternal(EditorContext editorContext) { CommentUtil.uncomment(myNode); } @Override protected RestorableSelection createRestorableSelection(EditorContext editorContext) { SNode commentedNode = SLinkOperations.getTarget(myNode, MetaAdapterFactory.getContainmentLink(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x3dcc194340c24debL, 0x2ab99f0d2248e89dL, "commentedNode")); if (commentedNode == null) { return new RestorableSelectionByNode(SNodeOperations.getParent(myNode)); } else { RestorableSelection firstSelection = super.createRestorableSelection(editorContext); RestorableSelection secondSelection = null; if (eq_yhitdb_a0c0a1a8(check_yhitdb_a0c0a1a8(check_yhitdb_a0a2a0b0i(editorContext)), "LEFT_COMMENT_ANCHOR")) { secondSelection = new RestorableSelectionByNode(commentedNode, RestorableSelectionByNode.SelectionAnchor.START); } else if (eq_yhitdb_a0a2a0b0i(check_yhitdb_a0a2a0b0i_0(check_yhitdb_a0a0c0a1a8(editorContext)), "RIGHT_COMMENT_ANCHOR")) { secondSelection = new RestorableSelectionByNode(commentedNode, RestorableSelectionByNode.SelectionAnchor.END); } RestorableSelectionByNode thirdSelection = new RestorableSelectionByNode(commentedNode); return new RestorableSelectionComposite(firstSelection, secondSelection, thirdSelection); } } private static boolean eq_yhitdb_a0c0a1a8(Object a, Object b) { return (a != null ? a.equals(b) : a == b); } private static String check_yhitdb_a0c0a1a8(EditorCell checkedDotOperand) { if (null != checkedDotOperand) { return checkedDotOperand.getCellId(); } return null; } private static EditorCell check_yhitdb_a0a2a0b0i(EditorContext checkedDotOperand) { if (null != checkedDotOperand) { return checkedDotOperand.getSelectedCell(); } return null; } private static boolean eq_yhitdb_a0a2a0b0i(Object a, Object b) { return (a != null ? a.equals(b) : a == b); } private static String check_yhitdb_a0a2a0b0i_0(EditorCell checkedDotOperand) { if (null != checkedDotOperand) { return checkedDotOperand.getCellId(); } return null; } private static EditorCell check_yhitdb_a0a0c0a1a8(EditorContext checkedDotOperand) { if (null != checkedDotOperand) { return checkedDotOperand.getSelectedCell(); } return null; } }