本文整理汇总了Java中com.intellij.openapi.keymap.KeymapManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java KeymapManager.getInstance方法的具体用法?Java KeymapManager.getInstance怎么用?Java KeymapManager.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.keymap.KeymapManager
的用法示例。
在下文中一共展示了KeymapManager.getInstance方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillActions
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的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);
}
}
}
示例2: isMouseActionEvent
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的package包/类
private static boolean isMouseActionEvent(@Nonnull MouseEvent e, String actionId) {
KeymapManager keymapManager = KeymapManager.getInstance();
if (keymapManager == null) return false;
Keymap keymap = keymapManager.getActiveKeymap();
if (keymap == null) return false;
MouseShortcut mouseShortcut = KeymapUtil.createMouseShortcut(e);
String[] mappedActions = keymap.getActionIds(mouseShortcut);
if (!ArrayUtil.contains(actionId, mappedActions)) return false;
if (mappedActions.length < 2) return true;
ActionManager actionManager = ActionManager.getInstance();
for (String mappedActionId : mappedActions) {
if (actionId.equals(mappedActionId)) continue;
AnAction action = actionManager.getAction(mappedActionId);
AnActionEvent actionEvent =
AnActionEvent.createFromAnAction(action, e, ActionPlaces.MAIN_MENU, DataManager.getInstance().getDataContext(e.getComponent()));
if (ActionUtil.lastUpdateAndCheckDumb(action, actionEvent, false)) return false;
}
return true;
}
示例3: fillActionsList
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的package包/类
private void fillActionsList(MouseShortcut mouseShortcut, boolean isModalContext) {
myActions.clear();
// search in main keymap
if (KeymapManagerImpl.ourKeymapManagerInitialized) {
final KeymapManager keymapManager = KeymapManager.getInstance();
if (keymapManager != null) {
final Keymap keymap = keymapManager.getActiveKeymap();
final String[] actionIds = keymap.getActionIds(mouseShortcut);
ActionManager actionManager = ActionManager.getInstance();
for (String actionId : actionIds) {
AnAction action = actionManager.getAction(actionId);
if (action == null) continue;
if (isModalContext && !action.isEnabledInModalContext()) continue;
if (!myActions.contains(action)) {
myActions.add(action);
}
}
}
}
}
示例4: ExternalSystemKeyMapListener
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的package包/类
private ExternalSystemKeyMapListener() {
KeymapManager keymapManager = KeymapManager.getInstance();
if (keymapManager != null) {
listenTo(keymapManager.getActiveKeymap());
keymapManager.addKeymapManagerListener(this, ExternalSystemShortcutsManager.this);
}
}
示例5: fillActions
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的package包/类
@Override
protected void fillActions(Project project, @NotNull DefaultActionGroup group, @NotNull DataContext dataContext) {
KeymapManagerEx manager = (KeymapManagerEx) KeymapManager.getInstance();
Keymap current = manager.getActiveKeymap();
for (Keymap keymap : manager.getAllKeymaps()) {
addKeymapAction(group, manager, current, keymap, false);
}
}
示例6: getShowMoreShortCut
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的package包/类
private String getShowMoreShortCut() {
if (myShortcutText == null) {
final KeymapManager keymapManager = KeymapManager.getInstance();
if (keymapManager != null) {
final Keymap keymap = keymapManager.getActiveKeymap();
myShortcutText =
keymap == null ? "" : "(" + KeymapUtil.getShortcutsText(keymap.getShortcuts(IdeActions.ACTION_SHOW_ERROR_DESCRIPTION)) + ")";
}
else {
myShortcutText = "";
}
}
return myShortcutText;
}
示例7: setDefaultMacKeymap
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的package包/类
private static void setDefaultMacKeymap() {
KeymapManagerImpl instance = (KeymapManagerImpl)KeymapManager.getInstance();
Keymap mac105Keymap = getMac105Keymap();
if (mac105Keymap != null) {
instance.setActiveKeymap(mac105Keymap);
}
}
示例8: initComponent
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的package包/类
public void initComponent() {
myModifiersValue = Registry.get("actionSystem.quickAccessModifiers");
myModifiersValue.addListener(new RegistryValueListener.Adapter() {
public void afterValueChanged(RegistryValue value) {
applyModifiersFromRegistry();
}
}, this);
KeymapManager kmMgr = KeymapManager.getInstance();
kmMgr.addKeymapManagerListener(this);
activeKeymapChanged(kmMgr.getActiveKeymap());
applyModifiersFromRegistry();
}
示例9: apply
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的package包/类
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();
}
示例10: fillActions
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的package包/类
@Override
protected void fillActions(Project project, @Nonnull DefaultActionGroup group, @Nonnull DataContext dataContext) {
KeymapManagerEx manager = (KeymapManagerEx) KeymapManager.getInstance();
Keymap current = manager.getActiveKeymap();
for (Keymap keymap : manager.getAllKeymaps()) {
addKeymapAction(group, manager, current, keymap, false);
}
}
示例11: getKeymapManager
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的package包/类
@Nullable
private static KeymapManager getKeymapManager() {
if (ApplicationManager.getApplication().isDisposed()) return null;
return KeymapManager.getInstance();
}
示例12: MyKeymapListener
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的package包/类
public MyKeymapListener() {
KeymapManager keymapManager = KeymapManager.getInstance();
listenTo(keymapManager.getActiveKeymap());
keymapManager.addKeymapManagerListener(this, MavenShortcutsManager.this);
}
示例13: activeKeymapChanged
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的package包/类
public void activeKeymapChanged(Keymap keymap) {
KeymapManager mgr = KeymapManager.getInstance();
myKeymap = mgr.getActiveKeymap();
}
示例14: MyKeymapListener
import com.intellij.openapi.keymap.KeymapManager; //导入方法依赖的package包/类
public MyKeymapListener() {
KeymapManager keymapManager = KeymapManager.getInstance();
listenTo(keymapManager.getActiveKeymap());
keymapManager.addKeymapManagerListener(this);
}