本文整理汇总了Java中com.intellij.openapi.keymap.Keymap类的典型用法代码示例。如果您正苦于以下问题:Java Keymap类的具体用法?Java Keymap怎么用?Java Keymap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Keymap类属于com.intellij.openapi.keymap包,在下文中一共展示了Keymap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getKeyboardShortcutsText
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
/**
* Uses an actionID to access the key-map of IDEA and find possible short-cuts
* @param myIdeaActionID ActionID to look the shortcut up
* @return a string combining one or more shortcuts
*/
static String getKeyboardShortcutsText(String myIdeaActionID) {
final Keymap activeKeymap = keyMapManager.getActiveKeymap();
Shortcut[] shortcuts = activeKeymap.getShortcuts(myIdeaActionID);
if (shortcuts.length == 0) {
return "";
}
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < shortcuts.length; i++) {
Shortcut shortcut = shortcuts[i];
if (i > 0) {
buffer.append(" or ");
}
buffer.append("'").append(KeymapUtil.getShortcutText(shortcut)).append("'");
}
return buffer.toString();
}
开发者ID:halirutan,项目名称:IntelliJ-Key-Promoter-X,代码行数:22,代码来源:KeyPromoterUtils.java
示例2: addShortcut
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
private void addShortcut(@NotNull final String actionIdString, @NotNull final String[] shortcuts) {
KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
for (Keymap keymap : keymapManager.getAllKeymaps()) {
List<Pair<String, String>> pairs = myDeletedShortcuts.get(keymap);
if (pairs == null) {
pairs = new ArrayList<>();
myDeletedShortcuts.put(keymap, pairs);
}
for (String shortcutString : shortcuts) {
Shortcut studyActionShortcut = new KeyboardShortcut(KeyStroke.getKeyStroke(shortcutString), null);
String[] actionsIds = keymap.getActionIds(studyActionShortcut);
for (String actionId : actionsIds) {
pairs.add(Pair.create(actionId, shortcutString));
keymap.removeShortcut(actionId, studyActionShortcut);
}
keymap.addShortcut(actionIdString, studyActionShortcut);
}
}
}
开发者ID:medvector,项目名称:educational-plugin,代码行数:20,代码来源:StudyProjectComponent.java
示例3: projectClosed
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
@Override
public void projectClosed() {
final Course course = StudyTaskManager.getInstance(myProject).getCourse();
if (course != null) {
final ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW);
if (toolWindow != null) {
toolWindow.getContentManager().removeAllContents(false);
}
KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
for (Keymap keymap : keymapManager.getAllKeymaps()) {
List<Pair<String, String>> pairs = myDeletedShortcuts.get(keymap);
if (pairs != null && !pairs.isEmpty()) {
for (Pair<String, String> actionShortcut : pairs) {
keymap.addShortcut(actionShortcut.first, new KeyboardShortcut(KeyStroke.getKeyStroke(actionShortcut.second), null));
}
}
}
}
myListener = null;
}
开发者ID:medvector,项目名称:educational-plugin,代码行数:21,代码来源:StudyProjectComponent.java
示例4: getActivateToolWindowVKs
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
public static Set<Integer> getActivateToolWindowVKs() {
if (ApplicationManager.getApplication() == null) return new HashSet<Integer>();
Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
Shortcut[] baseShortcut = keymap.getShortcuts("ActivateProjectToolWindow");
int baseModifiers = 0;
for (Shortcut each : baseShortcut) {
if (each instanceof KeyboardShortcut) {
KeyStroke keyStroke = ((KeyboardShortcut)each).getFirstKeyStroke();
baseModifiers = keyStroke.getModifiers();
if (baseModifiers > 0) {
break;
}
}
}
return QuickAccessSettings.getModifiersVKs(baseModifiers);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ToolWindowManagerImpl.java
示例5: EditorsSplitters
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
EditorsSplitters(final FileEditorManagerImpl manager, DockManager dockManager, boolean createOwnDockableContainer) {
super(new BorderLayout());
myManager = manager;
myFocusWatcher = new MyFocusWatcher();
setFocusTraversalPolicy(new MyFocusTraversalPolicy());
clear();
if (createOwnDockableContainer) {
DockableEditorTabbedContainer dockable = new DockableEditorTabbedContainer(myManager.getProject(), this, false);
Disposer.register(manager.getProject(), dockable);
dockManager.register(dockable);
}
KeymapManagerListener keymapListener = new KeymapManagerListener() {
@Override
public void activeKeymapChanged(Keymap keymap) {
invalidate();
repaint();
}
};
KeymapManager.getInstance().addKeymapManagerListener(keymapListener, this);
UISettings.getInstance().addUISettingsListener(this, this);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:EditorsSplitters.java
示例6: reset
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
private void reset(@NotNull Keymap keymap, @NotNull QuickList[] allQuickLists, String filter, @Nullable KeyboardShortcut shortcut) {
myKeymap = keymap;
final PathsKeeper pathsKeeper = new PathsKeeper();
pathsKeeper.storePaths();
myRoot.removeAllChildren();
ActionManager actionManager = ActionManager.getInstance();
Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myComponent));
Group mainGroup = ActionsTreeUtil.createMainGroup(project, keymap, allQuickLists, filter, true,
ActionsTreeUtil.isActionFiltered(actionManager, keymap, shortcut, filter, true));
if ((filter != null && filter.length() > 0 || shortcut != null) && mainGroup.initIds().isEmpty()){
mainGroup = ActionsTreeUtil.createMainGroup(project, keymap, allQuickLists, filter, false,
ActionsTreeUtil.isActionFiltered(actionManager, keymap, shortcut, filter, false));
}
myRoot = ActionsTreeUtil.createNode(mainGroup);
myMainGroup = mainGroup;
MyModel model = (MyModel)myTree.getModel();
model.setRoot(myRoot);
model.nodeStructureChanged(myRoot);
pathsKeeper.restorePaths();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ActionsTree.java
示例7: isActionFiltered
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
public static Condition<AnAction> isActionFiltered(final ActionManager actionManager,
final Keymap keymap,
final KeyboardShortcut keyboardShortcut) {
return new Condition<AnAction>() {
public boolean value(final AnAction action) {
if (keyboardShortcut == null) return true;
if (action == null) return false;
final Shortcut[] actionShortcuts =
keymap.getShortcuts(action instanceof ActionStub ? ((ActionStub)action).getId() : actionManager.getId(action));
for (Shortcut shortcut : actionShortcuts) {
if (shortcut instanceof KeyboardShortcut) {
final KeyboardShortcut keyboardActionShortcut = (KeyboardShortcut)shortcut;
if (Comparing.equal(keyboardActionShortcut, keyboardShortcut)) {
return true;
}
}
}
return false;
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ActionsTreeUtil.java
示例8: ChooseActionsDialog
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
public ChooseActionsDialog(Component parent, Keymap keymap, QuickList[] quicklists) {
super(parent, true);
myKeymap = keymap;
myQuicklists = quicklists;
myActionsTree = new ActionsTree();
myActionsTree.reset(keymap, quicklists);
myActionsTree.getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent e) {
doOKAction();
return true;
}
}.installOn(myActionsTree.getTree());
myTreeExpansionMonitor = TreeExpansionMonitor.install(myActionsTree.getTree());
setTitle("Add Actions to Quick List");
init();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ChooseActionsDialog.java
示例9: getMnemonicForToolWindow
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
/**
* @return mnemonic for action if it has Alt+digit/Meta+digit shortcut.
* Otherwise the method returns <code>-1</code>. Meta mask is OK for
* Mac OS X user, because Alt+digit types strange characters into the
* editor.
*/
public static int getMnemonicForToolWindow(String id) {
Keymap activeKeymap = KeymapManager.getInstance().getActiveKeymap();
Shortcut[] shortcuts = activeKeymap.getShortcuts(getActionIdForToolWindow(id));
for (Shortcut shortcut : shortcuts) {
if (shortcut instanceof KeyboardShortcut) {
KeyStroke keyStroke = ((KeyboardShortcut)shortcut).getFirstKeyStroke();
int modifiers = keyStroke.getModifiers();
if (
modifiers == (InputEvent.ALT_DOWN_MASK | InputEvent.ALT_MASK) ||
modifiers == InputEvent.ALT_MASK ||
modifiers == InputEvent.ALT_DOWN_MASK ||
modifiers == (InputEvent.META_DOWN_MASK | InputEvent.META_MASK) ||
modifiers == InputEvent.META_MASK ||
modifiers == InputEvent.META_DOWN_MASK
) {
int keyCode = keyStroke.getKeyCode();
if (KeyEvent.VK_0 <= keyCode && keyCode <= KeyEvent.VK_9) {
char c = (char)('0' + keyCode - KeyEvent.VK_0);
return (int)c;
}
}
}
}
return -1;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:ActivateToolWindowAction.java
示例10: getShortcuts
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
@NotNull
private static Set<KeyStroke> getShortcuts(@NotNull String actionId) {
Set<KeyStroke> result = new HashSet<KeyStroke>();
Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
Shortcut[] shortcuts = keymap.getShortcuts(actionId);
if (shortcuts == null) {
return result;
}
for (Shortcut shortcut : shortcuts) {
if (shortcut instanceof KeyboardShortcut) {
KeyboardShortcut keyboardShortcut = (KeyboardShortcut)shortcut;
result.add(keyboardShortcut.getFirstKeyStroke());
}
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ChooseByNameBase.java
示例11: patchKeymap
import com.intellij.openapi.keymap.Keymap; //导入依赖的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
示例12: addShortcut
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
private void addShortcut(@NotNull final String actionIdString, @NotNull final String[] shortcuts) {
KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
for (Keymap keymap : keymapManager.getAllKeymaps()) {
List<Pair<String, String>> pairs = myDeletedShortcuts.get(keymap);
if (pairs == null) {
pairs = new ArrayList<Pair<String, String>>();
myDeletedShortcuts.put(keymap, pairs);
}
for (String shortcutString : shortcuts) {
Shortcut studyActionShortcut = new KeyboardShortcut(KeyStroke.getKeyStroke(shortcutString), null);
String[] actionsIds = keymap.getActionIds(studyActionShortcut);
for (String actionId : actionsIds) {
pairs.add(Pair.create(actionId, shortcutString));
keymap.removeShortcut(actionId, studyActionShortcut);
}
keymap.addShortcut(actionIdString, studyActionShortcut);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:StudyProjectComponent.java
示例13: projectClosed
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
@Override
public void projectClosed() {
final Course course = StudyTaskManager.getInstance(myProject).getCourse();
if (course != null) {
final ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW);
if (toolWindow != null) {
toolWindow.getContentManager().removeAllContents(false);
}
final ToolWindow progressToolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(StudyProgressToolWindowFactory.ID);
if (progressToolWindow != null) {
progressToolWindow.getContentManager().removeAllContents(false);
}
KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
for (Keymap keymap : keymapManager.getAllKeymaps()) {
List<Pair<String, String>> pairs = myDeletedShortcuts.get(keymap);
if (pairs != null && !pairs.isEmpty()) {
for (Pair<String, String> actionShortcut : pairs) {
keymap.addShortcut(actionShortcut.first, new KeyboardShortcut(KeyStroke.getKeyStroke(actionShortcut.second), null));
}
}
}
}
myListener = null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:StudyProjectComponent.java
示例14: setActivateAndroidToolWindowShortcut
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
private static void setActivateAndroidToolWindowShortcut() {
// The IntelliJ keymap implementation behaves as follows:
// - getting a shortcut from a keymap gets the shortcut only from that keymap, and not from its parent, unless no shortcuts
// are defined in the keymap itself
// - however, adding a shortcut to a keymap explicitly copies all the shortcuts for that action from the parent keymap to this keymap
// The upshot of all this is that to add a shortcut, we should do so in all the child keymaps first, then the parent keymap.
// The following code does a simplified implementation of this behavior by changing the default keymap last after all the other
// keymaps have been changed.
Keymap defaultKeymap = null;
for (Keymap keymap: KeymapManagerEx.getInstanceEx().getAllKeymaps()) {
if (KeymapManager.DEFAULT_IDEA_KEYMAP.equals(keymap.getName())) {
defaultKeymap = keymap;
continue;
}
setActivateAndroidToolWindowShortcut(keymap);
}
if (defaultKeymap != null) {
setActivateAndroidToolWindowShortcut(defaultKeymap);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AndroidInitialConfigurator.java
示例15: reset
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
private void reset(final Keymap keymap, final QuickList[] allQuickLists, String filter, @Nullable KeyboardShortcut shortcut) {
myKeymap = keymap;
final PathsKeeper pathsKeeper = new PathsKeeper();
pathsKeeper.storePaths();
myRoot.removeAllChildren();
ActionManager actionManager = ActionManager.getInstance();
Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myComponent));
Group mainGroup = ActionsTreeUtil.createMainGroup(project, myKeymap, allQuickLists, filter, true, filter != null && filter.length() > 0 ?
ActionsTreeUtil.isActionFiltered(filter, true) :
(shortcut != null ? ActionsTreeUtil.isActionFiltered(actionManager, myKeymap, shortcut) : null));
if ((filter != null && filter.length() > 0 || shortcut != null) && mainGroup.initIds().isEmpty()){
mainGroup = ActionsTreeUtil.createMainGroup(project, myKeymap, allQuickLists, filter, false, filter != null && filter.length() > 0 ?
ActionsTreeUtil.isActionFiltered(filter, false) :
ActionsTreeUtil.isActionFiltered(actionManager, myKeymap, shortcut));
}
myRoot = ActionsTreeUtil.createNode(mainGroup);
myMainGroup = mainGroup;
MyModel model = (MyModel)myTree.getModel();
model.setRoot(myRoot);
model.nodeStructureChanged(myRoot);
pathsKeeper.restorePaths();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:ActionsTree.java
示例16: quickListRenamed
import com.intellij.openapi.keymap.Keymap; //导入依赖的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
示例17: wrapFilter
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
@Nullable
private static Condition<AnAction> wrapFilter(@Nullable final Condition<AnAction> filter, final Keymap keymap, final ActionManager actionManager) {
if (Registry.is("keymap.show.alias.actions")) return filter;
return new Condition<AnAction>() {
@Override
public boolean value(final AnAction action) {
if (action == null) return false;
final String id = action instanceof ActionStub ? ((ActionStub)action).getId() : actionManager.getId(action);
if (id != null) {
boolean actionBound = isActionBound(keymap, id);
return filter == null ? !actionBound : !actionBound && filter.value(action);
}
return filter == null ? true : filter.value(action);
}
};
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:ActionsTreeUtil.java
示例18: fillActions
import com.intellij.openapi.keymap.Keymap; //导入依赖的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
示例19: isOpenInNewWindow
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
private static boolean isOpenInNewWindow() {
AWTEvent event = IdeEventQueue.getInstance().getTrueCurrentEvent();
// Shift was used while clicking
if (event instanceof MouseEvent &&
((MouseEvent)event).isShiftDown() &&
(event.getID() == MouseEvent.MOUSE_CLICKED || event.getID() == MouseEvent.MOUSE_PRESSED || event.getID() == MouseEvent.MOUSE_RELEASED)) {
return true;
}
if (event instanceof KeyEvent) {
KeyEvent ke = (KeyEvent)event;
Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
String[] ids = keymap.getActionIds(KeyStroke.getKeyStroke(ke.getKeyCode(), ke.getModifiers()));
return Arrays.asList(ids).contains("OpenElementInNewWindow");
}
return false;
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:FileEditorManagerImpl.java
示例20: reset
import com.intellij.openapi.keymap.Keymap; //导入依赖的package包/类
private void reset(final Keymap keymap, final QuickList[] allQuickLists, String filter, @Nullable KeyboardShortcut shortcut) {
myKeymap = keymap;
final PathsKeeper pathsKeeper = new PathsKeeper();
pathsKeeper.storePaths();
myRoot.removeAllChildren();
ActionManager actionManager = ActionManager.getInstance();
Project project = DataManager.getInstance().getDataContext(myComponent).getData(CommonDataKeys.PROJECT);
Group mainGroup = ActionsTreeUtil.createMainGroup(project, myKeymap, allQuickLists, filter, true, filter != null && filter.length() > 0 ?
ActionsTreeUtil.isActionFiltered(filter, true) :
(shortcut != null ? ActionsTreeUtil.isActionFiltered(actionManager, myKeymap, shortcut) : null));
if ((filter != null && filter.length() > 0 || shortcut != null) && mainGroup.initIds().isEmpty()){
mainGroup = ActionsTreeUtil.createMainGroup(project, myKeymap, allQuickLists, filter, false, filter != null && filter.length() > 0 ?
ActionsTreeUtil.isActionFiltered(filter, false) :
ActionsTreeUtil.isActionFiltered(actionManager, myKeymap, shortcut));
}
myRoot = ActionsTreeUtil.createNode(mainGroup);
myMainGroup = mainGroup;
MyModel model = (MyModel)myTree.getModel();
model.setRoot(myRoot);
model.nodeStructureChanged(myRoot);
pathsKeeper.restorePaths();
}
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:ActionsTree.java
注:本文中的com.intellij.openapi.keymap.Keymap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论