当前位置: 首页>>代码示例>>Java>>正文


Java KeymapImpl.setName方法代码示例

本文整理汇总了Java中com.intellij.openapi.keymap.impl.KeymapImpl.setName方法的典型用法代码示例。如果您正苦于以下问题:Java KeymapImpl.setName方法的具体用法?Java KeymapImpl.setName怎么用?Java KeymapImpl.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.keymap.impl.KeymapImpl的用法示例。


在下文中一共展示了KeymapImpl.setName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: copyKeymap

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入方法依赖的package包/类
private void copyKeymap() {
  Keymap keymap = myEditor.getModel().getSelected();
  if (keymap == null) {
    return;
  }

  KeymapImpl newKeymap = ((KeymapImpl)keymap).deriveKeymap();

  String newKeymapName = KeyMapBundle.message("new.keymap.name", keymap.getPresentableName());
  if (!tryNewKeymapName(newKeymapName)) {
    for (int i = 0; ; i++) {
      newKeymapName = KeyMapBundle.message("new.indexed.keymap.name", keymap.getPresentableName(), i);
      if (tryNewKeymapName(newKeymapName)) {
        break;
      }
    }
  }
  newKeymap.setName(newKeymapName);
  newKeymap.setCanModify(true);
  myEditor.getModel().add(newKeymap);
  myEditor.getModel().setSelectedItem(newKeymap);
  myEditor.getComboBox().getEditor().selectAll();
  currentKeymapChanged();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:KeymapPanel.java

示例2: copyKeymap

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入方法依赖的package包/类
private void copyKeymap() {
  KeymapImpl keymap = getSelectedKeymap();
  if(keymap == null) {
    return;
  }
  KeymapImpl newKeymap = keymap.deriveKeymap();

  String newKeymapName = KeyMapBundle.message("new.keymap.name", keymap.getPresentableName());
  if(!tryNewKeymapName(newKeymapName)) {
    for(int i=0; ; i++) {
      newKeymapName = KeyMapBundle.message("new.indexed.keymap.name", keymap.getPresentableName(), i);
      if(tryNewKeymapName(newKeymapName)) {
        break;
      }
    }
  }
  newKeymap.setName(newKeymapName);
  newKeymap.setCanModify(true);
  myKeymapListModel.addElement(newKeymap);
  myKeymapList.setSelectedItem(newKeymap);
  myKeymapList.getEditor().selectAll();
  processCurrentKeymapChanged(getCurrentQuickListIds());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:KeymapPanel.java

示例3: copyKeymap

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入方法依赖的package包/类
private void copyKeymap() {
  KeymapImpl keymap = getSelectedKeymap();
  if (keymap == null) {
    return;
  }
  KeymapImpl newKeymap = keymap.deriveKeymap();

  String newKeymapName = KeyMapBundle.message("new.keymap.name", keymap.getPresentableName());
  if (!tryNewKeymapName(newKeymapName)) {
    for (int i = 0; ; i++) {
      newKeymapName = KeyMapBundle.message("new.indexed.keymap.name", keymap.getPresentableName(), i);
      if (tryNewKeymapName(newKeymapName)) {
        break;
      }
    }
  }
  newKeymap.setName(newKeymapName);
  newKeymap.setCanModify(true);
  myKeymapListModel.addElement(newKeymap);
  myKeymapList.setSelectedItem(newKeymap);
  myKeymapList.getEditor().selectAll();
  processCurrentKeymapChanged(getCurrentQuickListIds());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:KeymapPanel.java

示例4: createKeymapCopyIfNeeded

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入方法依赖的package包/类
private boolean createKeymapCopyIfNeeded() {
  if (mySelectedKeymap.canModify()) return true;

  final KeymapImpl selectedKeymap = getSelectedKeymap();
  if(selectedKeymap == null) {
    return false;
  }

  KeymapImpl newKeymap = selectedKeymap.deriveKeymap();

  String newKeymapName = KeyMapBundle.message("new.keymap.name", selectedKeymap.getPresentableName());
  if(!tryNewKeymapName(newKeymapName)) {
    for(int i=0; ; i++) {
      newKeymapName = KeyMapBundle.message("new.indexed.keymap.name", selectedKeymap.getPresentableName(), i);
      if(tryNewKeymapName(newKeymapName)) {
        break;
      }
    }
  }

  newKeymap.setName(newKeymapName);
  newKeymap.setCanModify(true);

  final int indexOf = myKeymapListModel.getIndexOf(selectedKeymap);
  if (indexOf >= 0) {
    myKeymapListModel.insertElementAt(newKeymap, indexOf + 1);
  } else {
    myKeymapListModel.addElement(newKeymap);
  }

  myKeymapList.setSelectedItem(newKeymap);
  processCurrentKeymapChanged(getCurrentQuickListIds());

  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:KeymapPanel.java

示例5: createKeymapCopyIfNeeded

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入方法依赖的package包/类
private boolean createKeymapCopyIfNeeded() {
  if (mySelectedKeymap.canModify()) return true;

  final KeymapImpl selectedKeymap = getSelectedKeymap();
  if (selectedKeymap == null) {
    return false;
  }

  KeymapImpl newKeymap = selectedKeymap.deriveKeymap();

  String newKeymapName = KeyMapBundle.message("new.keymap.name", selectedKeymap.getPresentableName());
  if (!tryNewKeymapName(newKeymapName)) {
    for (int i = 0; ; i++) {
      newKeymapName = KeyMapBundle.message("new.indexed.keymap.name", selectedKeymap.getPresentableName(), i);
      if (tryNewKeymapName(newKeymapName)) {
        break;
      }
    }
  }

  newKeymap.setName(newKeymapName);
  newKeymap.setCanModify(true);

  final int indexOf = myKeymapListModel.getIndexOf(selectedKeymap);
  if (indexOf >= 0) {
    myKeymapListModel.insertElementAt(newKeymap, indexOf + 1);
  }
  else {
    myKeymapListModel.addElement(newKeymap);
  }

  myKeymapList.setSelectedItem(newKeymap);
  processCurrentKeymapChanged(getCurrentQuickListIds());

  return true;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:37,代码来源:KeymapPanel.java

示例6: setUp

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入方法依赖的package包/类
public void setUp() throws Exception {
  super.setUp();
  // create dummy actions
  myActionWithoutTextAndDescription = new MyAction(null, null);
  myActionWithTextOnly = new MyAction("some text", null);
  myActionWithTextAndDescription = new MyAction("text", "description");
  myActionExistent = new MyAction("text", "description");
  myActionWithUseShortcutOfExistent = new MyAction("text", "description");
  myActionWithUseShortcutOfExistentRedefined = new MyAction("text", "description");
  myActionWithUseShortcutOfExistentRedefinedInParent = new MyAction("text", "description");
  myActionWithUseShortcutOfNonExistent = new MyAction("text", "description");
  myActionWithFixedShortcuts = new MyAction("text", "description");
    
  ActionManager actionManager = ActionManager.getInstance();
  actionManager.registerAction(ACTION_WITHOUT_TEXT_AND_DESCRIPTION, myActionWithoutTextAndDescription);
  actionManager.registerAction(ACTION_WITH_TEXT_ONLY, myActionWithTextOnly);
  actionManager.registerAction(ACTION_WITH_TEXT_AND_DESCRIPTION, myActionWithTextAndDescription);
  actionManager.registerAction(EXISTENT_ACTION, myActionExistent);
  actionManager.registerAction(ACTION_WITH_USE_SHORTCUT_OF_EXISTENT_ACTION, myActionWithUseShortcutOfExistent);
  actionManager.registerAction(ACTION_WITH_USE_SHORTCUT_OF_EXISTENT_ACTION_REDEFINED, myActionWithUseShortcutOfExistentRedefined);
  actionManager.registerAction(ACTION_WITH_USE_SHORTCUT_OF_EXISTENT_ACTION_REDEFINED_IN_PARENT, myActionWithUseShortcutOfExistentRedefinedInParent);
  actionManager.registerAction(ACTION_WITH_USE_SHORTCUT_OF_NON_EXISTENT_ACTION, myActionWithUseShortcutOfNonExistent);
  actionManager.registerAction(ACTION_WITH_FIXED_SHORTCUTS, myActionWithFixedShortcuts);

  KeymapManagerEx.getInstanceEx().bindShortcuts(EXISTENT_ACTION, ACTION_WITH_USE_SHORTCUT_OF_EXISTENT_ACTION);
  KeymapManagerEx.getInstanceEx().bindShortcuts(EXISTENT_ACTION, ACTION_WITH_USE_SHORTCUT_OF_EXISTENT_ACTION_REDEFINED);
  KeymapManagerEx.getInstanceEx().bindShortcuts(EXISTENT_ACTION, ACTION_WITH_USE_SHORTCUT_OF_EXISTENT_ACTION_REDEFINED_IN_PARENT);
  KeymapManagerEx.getInstanceEx().bindShortcuts(NON_EXISTENT_ACTION, ACTION_WITH_USE_SHORTCUT_OF_NON_EXISTENT_ACTION);

  mySavedRestrictions = ActionShortcutRestrictions.getInstance();
  setRestrictions(new ActionShortcutRestrictions(){
    @NotNull
    @Override
    public ShortcutRestrictions getForActionId(String actionId) {
      return ACTION_WITH_FIXED_SHORTCUTS.equals(actionId)
             ? new ShortcutRestrictions(false, false, false, false, false) : ShortcutRestrictions.NO_RESTRICTIONS;
    }
  });

  assertEquals("$Delete", KeymapManagerEx.getInstanceEx().getActionBinding(ACTION_EDITOR_DELETE_WITH_SHORTCUT));
  assertEquals("$Cut", KeymapManagerEx.getInstanceEx().getActionBinding(ACTION_EDITOR_CUT_WITHOUT_SHORTCUT));
  assertNotNull(actionManager.getAction(ACTION_EDITOR_DELETE_WITH_SHORTCUT));
  assertNotNull(actionManager.getAction(ACTION_EDITOR_CUT_WITHOUT_SHORTCUT));

  DefaultActionGroup group = (DefaultActionGroup)actionManager.getAction(IdeActions.GROUP_EDITOR);
  group.addAll(myActionWithoutTextAndDescription, 
               myActionWithTextOnly, 
               myActionWithTextAndDescription,
               myActionExistent, 
               myActionWithUseShortcutOfExistent, 
               myActionWithUseShortcutOfExistentRedefined, 
               myActionWithUseShortcutOfExistentRedefinedInParent, 
               myActionWithUseShortcutOfNonExistent,
               myActionWithFixedShortcuts);
  // populate action tree
  myActionsTree = new ActionsTree();

  KeyboardShortcut shortcut1 = new KeyboardShortcut(KeyStroke.getKeyStroke('1'), null);
  KeyboardShortcut shortcut2 = new KeyboardShortcut(KeyStroke.getKeyStroke('2'), null);
  KeymapImpl parent = new KeymapImpl();
  parent.addShortcut(ACTION_WITH_USE_SHORTCUT_OF_EXISTENT_ACTION_REDEFINED_IN_PARENT, shortcut1);
  parent.setName("parent");
  parent.setCanModify(false);
  KeymapImpl child = parent.deriveKeymap();
  child.setName("child");
  child.addShortcut(ACTION_WITH_USE_SHORTCUT_OF_EXISTENT_ACTION_REDEFINED, shortcut2);
  child.addShortcut(ACTION_EDITOR_DELETE_WITH_SHORTCUT, shortcut2);
  myActionsTree.reset(child, new QuickList[0]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:70,代码来源:ActionsTreeTest.java


注:本文中的com.intellij.openapi.keymap.impl.KeymapImpl.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。