Example usage for com.intellij.openapi.keymap KeymapManager getActiveKeymap

List of usage examples for com.intellij.openapi.keymap KeymapManager getActiveKeymap

Introduction

In this page you can find the example usage for com.intellij.openapi.keymap KeymapManager getActiveKeymap.

Prototype

@NotNull
    public abstract Keymap getActiveKeymap();

Source Link

Usage

From source file:com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.java

License:Apache License

public LocalInspectionsPass(@NotNull PsiFile file, @Nullable Document document, int startOffset, int endOffset,
        @NotNull TextRange priorityRange, boolean ignoreSuppressed,
        @NotNull HighlightInfoProcessor highlightInfoProcessor) {
    super(file.getProject(), document, PRESENTABLE_NAME, file, null, new TextRange(startOffset, endOffset),
            true, highlightInfoProcessor);
    myStartOffset = startOffset;//  w w w.ja  v a  2  s .c  om
    myEndOffset = endOffset;
    myPriorityRange = priorityRange;
    myIgnoreSuppressed = ignoreSuppressed;
    setId(Pass.LOCAL_INSPECTIONS);

    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 = "";
    }
    InspectionProfileWrapper profileToUse = InspectionProjectProfileManagerImpl.getInstanceImpl(myProject)
            .getProfileWrapper();

    Function<InspectionProfileWrapper, InspectionProfileWrapper> custom = file
            .getUserData(InspectionProfileWrapper.CUSTOMIZATION_KEY);
    if (custom != null) {
        profileToUse = custom.fun(profileToUse);
    }

    myProfileWrapper = profileToUse;
    assert myProfileWrapper != null;
    mySeverityRegistrar = ((SeverityProvider) myProfileWrapper.getInspectionProfile().getProfileManager())
            .getSeverityRegistrar();

    // initial guess
    setProgressLimit(300 * 2);
}

From source file:com.intellij.ui.switcher.QuickAccessSettings.java

License:Apache License

public void initComponent() {
    myModifiersValue = Registry.get("actionSystem.quickAccessModifiers");
    myModifiersValue.addListener(new RegistryValueListener.Adapter() {
        public void afterValueChanged(RegistryValue value) {
            applyModifiersFromRegistry();
        }//www  .  jav a  2  s.c  o  m
    }, this);

    KeymapManager kmMgr = KeymapManager.getInstance();
    kmMgr.addKeymapManagerListener(this);

    activeKeymapChanged(kmMgr.getActiveKeymap());

    applyModifiersFromRegistry();
}

From source file:com.intellij.ui.switcher.QuickAccessSettings.java

License:Apache License

public void activeKeymapChanged(Keymap keymap) {
    KeymapManager mgr = KeymapManager.getInstance();
    myKeymap = mgr.getActiveKeymap();
}

From source file:com.vladsch.MissingInActions.util.CommonUIShortcuts.java

License:Apache License

@NotNull
private static CustomShortcutSet shortcutsById(String actionId) {
    Application application = ApplicationManager.getApplication();
    KeymapManager keymapManager = application == null ? null : application.getComponent(KeymapManager.class);
    if (keymapManager == null) {
        return new CustomShortcutSet(Shortcut.EMPTY_ARRAY);
    }//  w  w  w. ja  v a  2s. co  m
    return new CustomShortcutSet(keymapManager.getActiveKeymap().getShortcuts(actionId));
}