package jetbrains.mps.lang.editor.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 jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import java.util.List; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; public class CellModel_Component_KeyMap extends KeyMapImpl { public CellModel_Component_KeyMap() { this.setApplicableToEveryModel(false); KeyMapAction action; action = new CellModel_Component_KeyMap.CellModel_Component_KeyMap_Action0(); this.putAction("ctrl+alt", "VK_N", action); } public static class CellModel_Component_KeyMap_Action0 extends KeyMapActionImpl { public CellModel_Component_KeyMap_Action0() { this.setShownInPopupMenu(false); } 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; } if (!(SNodeOperations.isInstanceOf(contextNode, MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfb35c96896L, "jetbrains.mps.lang.editor.structure.CellModel_Component")))) { return false; } return true; } public void execute(final EditorContext editorContext) { EditorCell contextCell = editorContext.getContextCell(); this.execute_internal(editorContext, contextCell.getSNode(), this.getSelectedNodes(editorContext)); } private void execute_internal(final EditorContext editorContext, final SNode node, final List<SNode> selectedNodes) { SNodeOperations.replaceWithAnother(node, SNodeOperations.copyNode(SLinkOperations.getTarget(SLinkOperations.getTarget(node, MetaAdapterFactory.getReferenceLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfb35c96896L, 0xfb35c96897L, "editorComponent")), MetaAdapterFactory.getContainmentLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0xfba0eb7c50L, 0xfba0ec5415L, "cellModel")))); } public String getKeyStroke() { return "ctrl alt N"; } } }