package jetbrains.mps.lang.editor.formsTests.editor;
/*Generated by MPS */
import jetbrains.mps.editor.runtime.cells.KeyMapImpl;
import jetbrains.mps.openapi.editor.cells.KeyMapAction;
import jetbrains.mps.editor.runtime.cells.KeyMapActionImpl;
import jetbrains.mps.openapi.editor.EditorContext;
import jetbrains.mps.openapi.editor.cells.EditorCell;
import org.jetbrains.mps.openapi.model.SNode;
import java.util.List;
import jetbrains.mps.openapi.editor.cells.EditorCell_Collection;
public class Checkbox_KeyMap_2 extends KeyMapImpl {
public Checkbox_KeyMap_2() {
this.setApplicableToEveryModel(false);
KeyMapAction action;
action = new Checkbox_KeyMap_2.Checkbox_KeyMap_2_Action0();
this.putAction("none", "VK_SPACE", action);
}
public static class Checkbox_KeyMap_2_Action0 extends KeyMapActionImpl {
public Checkbox_KeyMap_2_Action0() {
this.setShownInPopupMenu(false);
}
public String getDescriptionText() {
return "toggle checkbox";
}
public boolean isMenuAlwaysShown() {
return false;
}
public boolean canExecute(final EditorContext editorContext) {
EditorCell contextCell = editorContext.getContextCell();
if ((contextCell == null)) {
return false;
}
SNode contextNode = contextCell.getSNode();
if (contextNode == null) {
return false;
}
return this.canExecute_internal(editorContext, contextNode, this.getSelectedNodes(editorContext));
}
public void execute(final EditorContext editorContext) {
EditorCell contextCell = editorContext.getContextCell();
this.execute_internal(editorContext, contextCell.getSNode(), this.getSelectedNodes(editorContext));
}
private boolean canExecute_internal(final EditorContext editorContext, final SNode node, final List<SNode> selectedNodes) {
return editorContext.getContextCell() instanceof EditorCell_Collection;
}
private void execute_internal(final EditorContext editorContext, final SNode node, final List<SNode> selectedNodes) {
new ToggleCheckboxAction_3jyf1k_f0((SNode) node).execute(editorContext);
}
public String getKeyStroke() {
return "none SPACE";
}
}
}