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


Java KeymapImpl类代码示例

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


KeymapImpl类属于com.intellij.openapi.keymap.impl包,在下文中一共展示了KeymapImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: NameEditor

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
public NameEditor() {
  getField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      if (item != null && itemEditor.isEditable(item)) {
        String newName = getField().getText();
        if (newName.equals(itemEditor.getName(item))) {
          return;
        }

        if (!mutated) {
          mutated = true;
          item = getMutable(item);
        }
        ((KeymapImpl)item).setName(newName);
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ComboBoxModelEditor.java

示例3: patchKeymap

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
private static void patchKeymap() {
  Set<String> droppedActions = ContainerUtil.newHashSet(
    "AddToFavoritesPopup",
    "DatabaseView.ImportDataSources",
    "CompileDirty", "Compile",
    // hidden
    "AddNewFavoritesList", "EditFavorites", "RenameFavoritesList", "RemoveFavoritesList");
  KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();


  for (Keymap keymap : keymapManager.getAllKeymaps()) {
    if (keymap.canModify()) continue;

    KeymapImpl keymapImpl = (KeymapImpl)keymap;

    for (String id : keymapImpl.getOwnActionIds()) {
      if (droppedActions.contains(id)) keymapImpl.clearOwnActionsId(id);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PyCharmEduInitialConfigurator.java

示例4: quickListRenamed

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
@Override
public void quickListRenamed(final QuickList oldQuickList, final QuickList newQuickList){

  for (Keymap keymap : getAllKeymaps()) {
    KeymapImpl impl = (KeymapImpl)keymap;

    String actionId = oldQuickList.getActionId();
    String newActionId = newQuickList.getActionId();

    Shortcut[] shortcuts = impl.getShortcuts(actionId);

    if (shortcuts != null) {
      for (Shortcut shortcut : shortcuts) {
        impl.removeShortcut(actionId,  shortcut);
        impl.addShortcut(newActionId, shortcut);
      }
    }
  }

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

示例5: 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

示例6: fillActions

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
protected void fillActions(Project project, @NotNull DefaultActionGroup group, @NotNull DataContext dataContext) {
  final KeymapManagerEx manager = (KeymapManagerEx) KeymapManager.getInstance();
  final Keymap current = manager.getActiveKeymap();

  for (final Keymap keymap : manager.getAllKeymaps()) {
    addKeymapAction(group, manager, current, keymap, false);
  }

  Collection<SharedScheme<KeymapImpl>> sharedSchemes = ((KeymapManagerEx)KeymapManagerEx.getInstance()).getSchemesManager().loadSharedSchemes();

  if (!sharedSchemes.isEmpty()) {
    group.add(Separator.getInstance());
    for (SharedScheme<KeymapImpl> sharedScheme : sharedSchemes) {
      addKeymapAction(group, manager,current, sharedScheme.getScheme(), true);
    }
  }

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:QuickChangeKeymapAction.java

示例7: quickListRenamed

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
@Override
public void quickListRenamed(final QuickList oldQuickList, final QuickList newQuickList) {

  for (Keymap keymap : getAllKeymaps()) {
    KeymapImpl impl = (KeymapImpl)keymap;

    String actionId = oldQuickList.getActionId();
    String newActionId = newQuickList.getActionId();

    Shortcut[] shortcuts = impl.getShortcuts(actionId);

    if (shortcuts != null) {
      for (Shortcut shortcut : shortcuts) {
        impl.removeShortcut(actionId, shortcut);
        impl.addShortcut(newActionId, shortcut);
      }
    }
  }

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

示例8: 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

示例9: apply

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
@Override
public void apply() throws ConfigurationException {
  ensureNonEmptyKeymapNames();
  ensureUniqueKeymapNames();
  final KeymapManagerImpl keymapManager = (KeymapManagerImpl)KeymapManager.getInstance();
  keymapManager.removeAllKeymapsExceptUnmodifiable();
  for (int i = 0; i < myKeymapListModel.getSize(); i++) {
    final Keymap modelKeymap = (Keymap)myKeymapListModel.getElementAt(i);
    if (modelKeymap.canModify()) {
      final KeymapImpl keymapToAdd = ((KeymapImpl)modelKeymap).copy(true);
      keymapManager.addKeymap(keymapToAdd);
    }
  }
  keymapManager.setActiveKeymap(mySelectedKeymap);
  ActionToolbarImpl.updateAllToolbarsImmediately();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:KeymapPanel.java

示例10: getText

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
private static String getText(Shortcut shortcut) {
  if (shortcut instanceof KeyboardShortcut) {
    KeyStroke fst = ((KeyboardShortcut)shortcut).getFirstKeyStroke();
    String s = KeymapImpl.getKeyShortcutString(fst);

    KeyStroke snd = ((KeyboardShortcut)shortcut).getSecondKeyStroke();
    if (snd != null) {
      s += "," + KeymapImpl.getKeyShortcutString(snd);
    }
    return s;
  }
  return KeymapUtil.getShortcutText(shortcut);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:KeymapsTestCase.java

示例11: currentKeymapChanged

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
private void currentKeymapChanged() {
  myResetToDefault.setEnabled(false);

  Keymap selectedKeymap = myEditor.getModel().getSelected();

  boolean editable = selectedKeymap != null && selectedKeymap.canModify();
  myDeleteButton.setEnabled(editable);
  myCopyButton.setEnabled(selectedKeymap != null);
  myEditor.getComboBox().setEditable(editable);

  if (selectedKeymap == null) {
    myActionsTree.reset(new KeymapImpl(), myQuickLists);
    return;
  }

  Keymap parent = selectedKeymap.getParent();
  if (parent == null || !selectedKeymap.canModify()) {
    myBaseKeymapLabel.setText("");
  }
  else {
    myBaseKeymapLabel.setText(KeyMapBundle.message("based.on.keymap.label", parent.getPresentableName()));
    if (selectedKeymap.canModify() && ((KeymapImpl)selectedKeymap).getOwnActionIds().length > 0) {
      myResetToDefault.setEnabled(true);
    }
  }

  myActionsTree.reset(selectedKeymap, myQuickLists);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:KeymapPanel.java

示例12: resetKeymap

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
private void resetKeymap() {
  Keymap keymap = myEditor.getModel().getSelected();
  if (keymap == null) {
    return;
  }
  ((KeymapImpl)keymap).clearOwnActionsIds();
  currentKeymapChanged();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:KeymapPanel.java

示例13: hasAssociatedShortcutsInHierarchy

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
private static boolean hasAssociatedShortcutsInHierarchy(String id, Keymap keymap) {
  while (keymap != null) {
    if (((KeymapImpl)keymap).hasOwnActionId(id)) return true;
    keymap = keymap.getParent();
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ActionsTreeUtil.java

示例14: getActionBinding

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
@Nullable
private static String getActionBinding(final Keymap keymap, final String id) {
  if (keymap == null) return null;
  
  Keymap parent = keymap.getParent();
  String result = ((KeymapImpl)keymap).getActionBinding(id);
  if (result == null && parent != null) {
    result = ((KeymapImpl)parent).getActionBinding(id);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ActionsTreeUtil.java

示例15: processCurrentKeymapChanged

import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
@Override
public void processCurrentKeymapChanged(QuickList[] ids) {
  myQuickLists = ids;
  myCopyButton.setEnabled(false);
  myDeleteButton.setEnabled(false);
  myResetToDefault.setEnabled(false);

  if (myExportButton != null) {
    myExportButton.setEnabled(false);
  }

  KeymapImpl selectedKeymap = getSelectedKeymap();
  mySelectedKeymap = selectedKeymap;
  if (selectedKeymap == null) {
    myActionsTree.reset(new KeymapImpl(), getCurrentQuickListIds());
    return;
  }
  myKeymapList.setEditable(mySelectedKeymap.canModify());

  myCopyButton.setEnabled(true);
  myBaseKeymapLabel.setText("");
  Keymap parent = mySelectedKeymap.getParent();
  if (parent != null && mySelectedKeymap.canModify()) {
    myBaseKeymapLabel.setText(KeyMapBundle.message("based.on.keymap.label", parent.getPresentableName()));
    if (mySelectedKeymap.canModify() && mySelectedKeymap.getOwnActionIds().length > 0){
      myResetToDefault.setEnabled(true);
    }
  }
  if(mySelectedKeymap.canModify()) {
    myDeleteButton.setEnabled(true);

    if (!getSchemesManager().isShared(mySelectedKeymap)) {
      if (myExportButton != null) {
        myExportButton.setEnabled(true);
      }
    }
  }

  myActionsTree.reset(mySelectedKeymap, getCurrentQuickListIds());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:41,代码来源:KeymapPanel.java


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