Example usage for com.intellij.openapi.actionSystem IdeActions ACTION_SHOW_INTENTION_ACTIONS

List of usage examples for com.intellij.openapi.actionSystem IdeActions ACTION_SHOW_INTENTION_ACTIONS

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem IdeActions ACTION_SHOW_INTENTION_ACTIONS.

Prototype

String ACTION_SHOW_INTENTION_ACTIONS

To view the source code for com.intellij.openapi.actionSystem IdeActions ACTION_SHOW_INTENTION_ACTIONS.

Click Source Link

Usage

From source file:com.intellij.codeInsight.completion.StaticMemberProcessor.java

License:Apache License

private void showHint(boolean shouldImport) {
    if (!myHintShown && !shouldImport) {
        final String shortcut = CompletionContributor
                .getActionShortcut(IdeActions.ACTION_SHOW_INTENTION_ACTIONS);
        if (shortcut != null) {
            CompletionService.getCompletionService()
                    .setAdvertisementText("To import a method statically, press " + shortcut);
        }//from  w w  w. j a v  a  2  s.  c  om
        myHintShown = true;
    }
}

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

License:Apache License

public static String getMessage(final boolean multiple, final String name) {
    final String messageKey = multiple ? "import.popup.multiple" : "import.popup.text";
    String hintText = DaemonBundle.message(messageKey, name);
    hintText += " " + KeymapUtil.getFirstKeyboardShortcutText(
            ActionManager.getInstance().getAction(IdeActions.ACTION_SHOW_INTENTION_ACTIONS));
    return hintText;
}

From source file:com.intellij.codeInsight.intention.impl.IntentionHintComponent.java

License:Apache License

private void onMouseEnter(final boolean small) {
    myIconLabel.setIcon(myHighlightedIcon);
    setBorder(small ? ACTIVE_BORDER_SMALL : ACTIVE_BORDER);

    String acceleratorsText = KeymapUtil.getFirstKeyboardShortcutText(
            ActionManager.getInstance().getAction(IdeActions.ACTION_SHOW_INTENTION_ACTIONS));
    if (!acceleratorsText.isEmpty()) {
        myIconLabel.setToolTipText(CodeInsightBundle.message("lightbulb.tooltip", acceleratorsText));
    }// w ww  .jav a2  s. c  o  m
}

From source file:com.intellij.codeInspection.ui.actions.InvokeQuickFixAction.java

License:Apache License

public InvokeQuickFixAction(final InspectionResultsView view) {
    super(InspectionsBundle.message("inspection.action.apply.quickfix"),
            InspectionsBundle.message("inspection.action.apply.quickfix.description"),
            AllIcons.Actions.CreateFromUsage);
    myView = view;/*from  ww  w. java 2s .  co m*/
    registerCustomShortcutSet(
            ActionManager.getInstance().getAction(IdeActions.ACTION_SHOW_INTENTION_ACTIONS).getShortcutSet(),
            myView.getTree());
}

From source file:com.intellij.uiDesigner.quickFixes.LightBulbComponentImpl.java

License:Apache License

public LightBulbComponentImpl(@NotNull final QuickFixManager manager, @NotNull final Icon icon) {
    myManager = manager;/*  www.j  a v a  2 s .c  om*/
    myIcon = icon;

    setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
    final String acceleratorsText = KeymapUtil.getFirstKeyboardShortcutText(
            ActionManager.getInstance().getAction(IdeActions.ACTION_SHOW_INTENTION_ACTIONS));
    if (acceleratorsText.length() > 0) {
        setToolTipText(UIDesignerBundle.message("tooltip.press.accelerator", acceleratorsText));
    }

    new ClickListener() {
        @Override
        public boolean onClick(MouseEvent e, int clickCount) {
            myManager.showIntentionPopup();
            return true;
        }
    }.installOn(this);
}

From source file:com.intellij.uiDesigner.quickFixes.ShowHintAction.java

License:Apache License

public ShowHintAction(@NotNull final QuickFixManager manager, @NotNull final JComponent component) {
    myManager = manager;/*  www .j av a2  s .co  m*/
    registerCustomShortcutSet(
            ActionManager.getInstance().getAction(IdeActions.ACTION_SHOW_INTENTION_ACTIONS).getShortcutSet(),
            component);
}

From source file:org.cordovastudio.editors.designer.inspection.AbstractQuickFixManager.java

License:Apache License

public AbstractQuickFixManager(@Nullable CordovaDesignerEditorPanel designer, JComponent component,
        JViewport viewPort) {//from  w  ww.  j ava 2  s. co m
    myDesigner = designer;
    myComponent = component;
    myViewPort = viewPort;

    myShowHintRequest = new Runnable() {
        @Override
        public void run() {
            showHint();
        }
    };

    new VisibilityWatcher() {
        @Override
        public void visibilityChanged() {
            if (myComponent.isShowing()) {
                updateHintVisibility();
            } else {
                hideHint();
            }
        }
    }.install(component);

    component.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(FocusEvent e) {
            if (!e.isTemporary()) {
                updateHintVisibility();
            }
        }

        @Override
        public void focusLost(FocusEvent e) {
            if (!(e.isTemporary())) {
                hideHint();
            }
        }
    });

    AnAction showHintAction = new AnAction() {
        @Override
        public void actionPerformed(AnActionEvent e) {
            if (myDesigner != null) {
                showHint();
                showPopup();
            }
        }

        @Override
        public void update(AnActionEvent e) {
            e.getPresentation().setEnabled(e.getData(CommonDataKeys.EDITOR) == null);
        }
    };
    showHintAction.registerCustomShortcutSet(
            ActionManager.getInstance().getAction(IdeActions.ACTION_SHOW_INTENTION_ACTIONS).getShortcutSet(),
            component);

    viewPort.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            updateHintPosition();
        }
    });
}

From source file:org.intellij.plugins.intelliLang.inject.InjectLanguageAction.java

License:Apache License

public static void invokeImpl(Project project, Editor editor, final PsiFile file, Injectable injectable) {
    final PsiLanguageInjectionHost host = findInjectionHost(editor, file);
    if (host == null)
        return;/*ww  w.ja v  a 2 s .  co  m*/
    if (defaultFunctionalityWorked(host, injectable.getId()))
        return;

    try {
        host.putUserData(FIX_KEY, null);
        Language language = injectable.toLanguage();
        for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) {
            if (support.isApplicableTo(host) && support.addInjectionInPlace(language, host)) {
                return;
            }
        }
        if (TemporaryPlacesRegistry.getInstance(project).getLanguageInjectionSupport()
                .addInjectionInPlace(language, host)) {
            final Processor<PsiLanguageInjectionHost> data = host.getUserData(FIX_KEY);
            String text = StringUtil.escapeXml(language.getDisplayName()) + " was temporarily injected.";
            if (data != null) {
                if (!ApplicationManager.getApplication().isUnitTestMode()) {
                    final SmartPsiElementPointer<PsiLanguageInjectionHost> pointer = SmartPointerManager
                            .getInstance(project).createSmartPsiElementPointer(host);
                    final TextRange range = host.getTextRange();
                    HintManager.getInstance().showQuestionHint(editor,
                            text + "<br>Do you want to insert annotation? "
                                    + KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance()
                                            .getAction(IdeActions.ACTION_SHOW_INTENTION_ACTIONS)),
                            range.getStartOffset(), range.getEndOffset(), new QuestionAction() {
                                @Override
                                public boolean execute() {
                                    return data.process(pointer.getElement());
                                }
                            });
                }
            } else {
                HintManager.getInstance().showInformationHint(editor, text);
            }
        }
    } finally {
        if (injectable.getLanguage() != null) { // no need for reference injection
            FileContentUtil.reparseFiles(project, Collections.<VirtualFile>emptyList(), true);
        } else {
            ((PsiModificationTrackerImpl) PsiManager.getInstance(project).getModificationTracker())
                    .incCounter();
            DaemonCodeAnalyzer.getInstance(project).restart();
        }
    }
}