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

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

Introduction

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

Prototype

String ACTION_CHOOSE_LOOKUP_ITEM_DOT

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

Click Source Link

Usage

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

License:Apache License

void duringCompletion(CompletionInitializationContext initContext) {
    if (isAutopopupCompletion()) {
        if (shouldPreselectFirstSuggestion(myParameters)) {
            if (!CodeInsightSettings.getInstance().SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS) {
                myLookup.setFocusDegree(LookupImpl.FocusDegree.SEMI_FOCUSED);
                if (FeatureUsageTracker.getInstance().isToBeAdvertisedInLookup(
                        CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_CONTROL_DOT, getProject())) {
                    String dotShortcut = CompletionContributor
                            .getActionShortcut(IdeActions.ACTION_CHOOSE_LOOKUP_ITEM_DOT);
                    if (StringUtil.isNotEmpty(dotShortcut)) {
                        addAdvertisement("Press " + dotShortcut
                                + " to choose the selected (or first) suggestion and insert a dot afterwards",
                                null);//from  www  . j av  a 2 s . c  o  m
                    }
                }
            } else {
                myLookup.setFocusDegree(LookupImpl.FocusDegree.FOCUSED);
            }
        }
        if (!myEditor.isOneLineMode() && FeatureUsageTracker.getInstance().isToBeAdvertisedInLookup(
                CodeCompletionFeatures.EDITING_COMPLETION_CONTROL_ARROWS, getProject())) {
            String downShortcut = CompletionContributor.getActionShortcut(IdeActions.ACTION_LOOKUP_DOWN);
            String upShortcut = CompletionContributor.getActionShortcut(IdeActions.ACTION_LOOKUP_UP);
            if (StringUtil.isNotEmpty(downShortcut) && StringUtil.isNotEmpty(upShortcut)) {
                addAdvertisement(
                        downShortcut + " and " + upShortcut + " will move caret down and up in the editor",
                        null);
            }
        }
    } else if (DumbService.isDumb(getProject())) {
        addAdvertisement("The results might be incomplete while indexing is in progress",
                MessageType.WARNING.getPopupBackground());
    }

    ProgressManager.checkCanceled();

    if (!initContext.getOffsetMap().wasModified(CompletionInitializationContext.IDENTIFIER_END_OFFSET)) {
        try {
            final int selectionEndOffset = initContext.getSelectionEndOffset();
            final PsiReference reference = TargetElementUtil.findReference(myEditor, selectionEndOffset);
            if (reference != null) {
                initContext.setReplacementOffset(findReplacementOffset(selectionEndOffset, reference));
            }
        } catch (IndexNotReadyException ignored) {
        }
    }

    for (CompletionContributor contributor : CompletionContributor
            .forLanguage(initContext.getPositionLanguage())) {
        ProgressManager.checkCanceled();
        if (DumbService.getInstance(initContext.getProject()).isDumb()
                && !DumbService.isDumbAware(contributor)) {
            continue;
        }

        contributor.duringCompletion(initContext);
    }
}