Search in sources :

Example 1 with ShortcutSet

use of com.intellij.openapi.actionSystem.ShortcutSet in project intellij-community by JetBrains.

the class SettingsSearch method updateToolTipText.

void updateToolTipText() {
    ShortcutSet set = SettingsDialog.getFindActionShortcutSet();
    String text = set == null ? null : StringUtil.join(set.getShortcuts(), KeymapUtil::getShortcutText, "\n");
    getTextEditor().setToolTipText(StringUtil.isEmpty(text) ? null : text);
}
Also used : ShortcutSet(com.intellij.openapi.actionSystem.ShortcutSet)

Example 2 with ShortcutSet

use of com.intellij.openapi.actionSystem.ShortcutSet in project intellij-community by JetBrains.

the class XValueHint method showHint.

@Override
protected boolean showHint(final JComponent component) {
    boolean result = super.showHint(component);
    if (result && getType() == ValueHintType.MOUSE_OVER_HINT) {
        myDisposable = Disposer.newDisposable();
        ShortcutSet shortcut = ActionManager.getInstance().getAction("ShowErrorDescription").getShortcutSet();
        new DumbAwareAction() {

            @Override
            public void actionPerformed(@NotNull AnActionEvent e) {
                hideHint();
                final Point point = new Point(myPoint.x, myPoint.y + getEditor().getLineHeight());
                new XValueHint(getProject(), getEditor(), point, ValueHintType.MOUSE_CLICK_HINT, myExpressionInfo, myEvaluator, myDebugSession).invokeHint();
            }
        }.registerCustomShortcutSet(shortcut, getEditor().getContentComponent(), myDisposable);
    }
    if (result) {
        XValueHint prev = getEditor().getUserData(HINT_KEY);
        if (prev != null) {
            prev.hideHint();
        }
        getEditor().putUserData(HINT_KEY, this);
    }
    return result;
}
Also used : ShortcutSet(com.intellij.openapi.actionSystem.ShortcutSet) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) DumbAwareAction(com.intellij.openapi.project.DumbAwareAction)

Example 3 with ShortcutSet

use of com.intellij.openapi.actionSystem.ShortcutSet in project intellij-community by JetBrains.

the class SettingsDialog method init.

private void init(Configurable configurable, @Nullable Project project) {
    String name = configurable == null ? null : configurable.getDisplayName();
    String title = CommonBundle.settingsTitle();
    if (project != null && project.isDefault())
        title = "Default " + title;
    setTitle(name == null ? title : name.replace('\n', ' '));
    ShortcutSet set = getFindActionShortcutSet();
    if (set != null)
        new FindAction().registerCustomShortcutSet(set, getRootPane(), myDisposable);
    init();
}
Also used : FindAction(com.intellij.ui.SearchTextField.FindAction) ShortcutSet(com.intellij.openapi.actionSystem.ShortcutSet)

Example 4 with ShortcutSet

use of com.intellij.openapi.actionSystem.ShortcutSet in project intellij-community by JetBrains.

the class PopupListElementRenderer method customizeComponent.

@Override
protected void customizeComponent(JList<? extends E> list, E value, boolean isSelected) {
    ListPopupStep<Object> step = myPopup.getListStep();
    boolean isSelectable = step.isSelectable(value);
    myTextLabel.setEnabled(isSelectable);
    if (!isSelected && step instanceof BaseListPopupStep) {
        Color bg = ((BaseListPopupStep) step).getBackgroundFor(value);
        Color fg = ((BaseListPopupStep) step).getForegroundFor(value);
        if (fg != null)
            myTextLabel.setForeground(fg);
        if (bg != null)
            UIUtil.setBackgroundRecursively(myComponent, bg);
    }
    if (step.isMnemonicsNavigationEnabled()) {
        final int pos = step.getMnemonicNavigationFilter().getMnemonicPos(value);
        if (pos != -1) {
            String text = myTextLabel.getText();
            text = text.substring(0, pos) + text.substring(pos + 1);
            myTextLabel.setText(text);
            myTextLabel.setDisplayedMnemonicIndex(pos);
        }
    } else {
        myTextLabel.setDisplayedMnemonicIndex(-1);
    }
    if (step.hasSubstep(value) && isSelectable) {
        myNextStepLabel.setVisible(true);
        final boolean isDark = ColorUtil.isDark(UIUtil.getListSelectionBackground());
        myNextStepLabel.setIcon(isSelected ? isDark ? AllIcons.Icons.Ide.NextStepInverted : AllIcons.Icons.Ide.NextStep : AllIcons.Icons.Ide.NextStepGrayed);
    } else {
        myNextStepLabel.setVisible(false);
    //myNextStepLabel.setIcon(PopupIcons.EMPTY_ICON);
    }
    setSelected(myNextStepLabel, isSelected);
    if (myShortcutLabel != null) {
        myShortcutLabel.setText("");
        if (value instanceof ShortcutProvider) {
            ShortcutSet set = ((ShortcutProvider) value).getShortcut();
            if (set != null) {
                Shortcut shortcut = ArrayUtil.getFirstElement(set.getShortcuts());
                if (shortcut != null) {
                    myShortcutLabel.setText("     " + KeymapUtil.getShortcutText(shortcut));
                }
            }
        }
        setSelected(myShortcutLabel, isSelected);
        myShortcutLabel.setForeground(isSelected ? UIManager.getColor("MenuItem.acceleratorSelectionForeground") : UIManager.getColor("MenuItem.acceleratorForeground"));
    }
}
Also used : ShortcutProvider(com.intellij.openapi.actionSystem.ShortcutProvider) BaseListPopupStep(com.intellij.openapi.ui.popup.util.BaseListPopupStep) Shortcut(com.intellij.openapi.actionSystem.Shortcut) ShortcutSet(com.intellij.openapi.actionSystem.ShortcutSet)

Aggregations

ShortcutSet (com.intellij.openapi.actionSystem.ShortcutSet)4 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 Shortcut (com.intellij.openapi.actionSystem.Shortcut)1 ShortcutProvider (com.intellij.openapi.actionSystem.ShortcutProvider)1 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)1 BaseListPopupStep (com.intellij.openapi.ui.popup.util.BaseListPopupStep)1 FindAction (com.intellij.ui.SearchTextField.FindAction)1