com.intellij.featureStatistics.FeatureUsageTracker Java Examples
The following examples show how to use
com.intellij.featureStatistics.FeatureUsageTracker.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PsiElementRenameHandler.java From consulo with Apache License 2.0 | 6 votes |
public static void invoke(PsiElement element, Project project, PsiElement nameSuggestionContext, @Nullable Editor editor) { if (element != null && !canRename(project, editor, element)) { return; } VirtualFile contextFile = PsiUtilCore.getVirtualFile(nameSuggestionContext); if (nameSuggestionContext != null && nameSuggestionContext.isPhysical() && (contextFile == null || !ScratchUtil.isScratch(contextFile) && !PsiManager.getInstance(project).isInProject(nameSuggestionContext))) { final String message = "Selected element is used from non-project files. These usages won't be renamed. Proceed anyway?"; if (ApplicationManager.getApplication().isUnitTestMode()) throw new CommonRefactoringUtil.RefactoringErrorHintException(message); if (Messages.showYesNoDialog(project, message, RefactoringBundle.getCannotRefactorMessage(null), Messages.getWarningIcon()) != Messages.YES) { return; } } FeatureUsageTracker.getInstance().triggerFeatureUsed("refactoring.rename"); rename(element, project, nameSuggestionContext, editor); }
Example #2
Source File: ScratchFileActions.java From consulo with Apache License 2.0 | 6 votes |
static PsiFile doCreateNewScratch(@Nonnull Project project, @Nonnull ScratchFileCreationHelper.Context context) { FeatureUsageTracker.getInstance().triggerFeatureUsed("scratch"); Language language = Objects.requireNonNull(context.language); if (context.fileExtension == null) { LanguageFileType fileType = language.getAssociatedFileType(); context.fileExtension = fileType == null ? "" : fileType.getDefaultExtension(); } ScratchFileCreationHelper.EXTENSION.forLanguage(language).beforeCreate(project, context); VirtualFile dir = context.ideView != null ? PsiUtilCore.getVirtualFile(ArrayUtil.getFirstElement(context.ideView.getDirectories())) : null; RootType rootType = dir == null ? null : ScratchFileService.findRootType(dir); String relativePath = rootType != ScratchRootType.getInstance() ? "" : FileUtil.getRelativePath(ScratchFileService.getInstance().getRootPath(rootType), dir.getPath(), '/'); String fileName = (StringUtil.isEmpty(relativePath) ? "" : relativePath + "/") + PathUtil.makeFileName(ObjectUtils.notNull(context.filePrefix, "scratch") + (context.fileCounter != null ? context.fileCounter.create() : ""), context.fileExtension); VirtualFile file = ScratchRootType.getInstance().createScratchFile(project, fileName, language, context.text, context.createOption); if (file == null) return null; PsiNavigationSupport.getInstance().createNavigatable(project, file, context.caretOffset).navigate(true); PsiFile psiFile = PsiManager.getInstance(project).findFile(file); if (context.ideView != null && psiFile != null) { context.ideView.selectElement(psiFile); } return psiFile; }
Example #3
Source File: ActionMenuItem.java From consulo with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(final ActionEvent e) { final IdeFocusManager fm = IdeFocusManager.findInstanceByContext(myContext); final ActionCallback typeAhead = new ActionCallback(); final String id = ActionManager.getInstance().getId(myAction.getAction()); if (id != null) { FeatureUsageTracker.getInstance().triggerFeatureUsed("context.menu.click.stats." + id.replace(' ', '.')); } fm.typeAheadUntil(typeAhead, getText()); fm.runOnOwnContext(myContext, () -> { final AnActionEvent event = new AnActionEvent(new MouseEvent(ActionMenuItem.this, MouseEvent.MOUSE_PRESSED, 0, e.getModifiers(), getWidth() / 2, getHeight() / 2, 1, false), myContext, myPlace, myPresentation, ActionManager.getInstance(), e.getModifiers(), true, false); final AnAction menuItemAction = myAction.getAction(); if (ActionUtil.lastUpdateAndCheckDumb(menuItemAction, event, false)) { ActionManagerEx actionManager = ActionManagerEx.getInstanceEx(); actionManager.fireBeforeActionPerformed(menuItemAction, myContext, event); fm.doWhenFocusSettlesDown(typeAhead::setDone); ActionUtil.performActionDumbAware(menuItemAction, event); actionManager.queueActionPerformedEvent(menuItemAction, myContext, event); } else { typeAhead.setDone(); } }); }
Example #4
Source File: ViewStructureAction.java From consulo with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(@Nonnull AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) return; FileEditor fileEditor = e.getData(PlatformDataKeys.FILE_EDITOR); if (fileEditor == null) return; VirtualFile virtualFile = fileEditor.getFile(); Editor editor = fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : e.getData(CommonDataKeys.EDITOR); if (editor != null) { PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); } FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.file.structure"); FileStructurePopup popup = createPopup(project, fileEditor); if (popup == null) return; String title = virtualFile == null ? fileEditor.getName() : virtualFile.getName(); popup.setTitle(title); popup.show(); }
Example #5
Source File: CodeCompletionHandlerBase.java From consulo with Apache License 2.0 | 6 votes |
protected void lookupItemSelected(final CompletionProgressIndicator indicator, @Nonnull final LookupElement item, final char completionChar, final List<LookupElement> items) { if (indicator.isAutopopupCompletion()) { FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_BASIC); } WatchingInsertionContext context = null; try { StatisticsUpdate update = StatisticsUpdate.collectStatisticChanges(item); if (item.getUserData(DIRECT_INSERTION) != null) { context = callHandleInsert(indicator, item, completionChar); } else { context = insertItemHonorBlockSelection(indicator, item, completionChar, update); } update.trackStatistics(context); } finally { afterItemInsertion(indicator, context == null ? null : context.getLaterRunnable()); } }
Example #6
Source File: SearchEverywhereAction.java From consulo with Apache License 2.0 | 6 votes |
public void actionPerformed(AnActionEvent e, MouseEvent me) { if (Registry.is("new.search.everywhere") && e.getProject() != null) { FeatureUsageTracker.getInstance().triggerFeatureUsed(IdeActions.ACTION_SEARCH_EVERYWHERE); SearchEverywhereManager seManager = SearchEverywhereManager.getInstance(e.getProject()); String searchProviderID = SearchEverywhereManagerImpl.ALL_CONTRIBUTORS_GROUP_ID; if (seManager.isShown()) { if (searchProviderID.equals(seManager.getSelectedContributorID())) { seManager.toggleEverywhereFilter(); } else { seManager.setSelectedContributor(searchProviderID); //FeatureUsageData data = SearchEverywhereUsageTriggerCollector.createData(searchProviderID).addInputEvent(e); //SearchEverywhereUsageTriggerCollector.trigger(e.getProject(), SearchEverywhereUsageTriggerCollector.TAB_SWITCHED, data); } return; } //FeatureUsageData data = SearchEverywhereUsageTriggerCollector.createData(searchProviderID); //SearchEverywhereUsageTriggerCollector.trigger(e.getProject(), SearchEverywhereUsageTriggerCollector.DIALOG_OPEN, data); IdeEventQueue.getInstance().getPopupManager().closeAllPopups(false); String text = GotoActionBase.getInitialTextForNavigation(e); seManager.show(searchProviderID, text, e); return; } }
Example #7
Source File: RunAnythingAction.java From consulo with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(@Nonnull AnActionEvent e) { if (Registry.is("ide.suppress.double.click.handler") && e.getInputEvent() instanceof KeyEvent) { if (((KeyEvent)e.getInputEvent()).getKeyCode() == KeyEvent.VK_CONTROL) { return; } } if (e.getProject() != null) { FeatureUsageTracker.getInstance().triggerFeatureUsed(IdeActions.ACTION_RUN_ANYTHING); RunAnythingManager runAnythingManager = RunAnythingManager.getInstance(e.getProject()); String text = GotoActionBase.getInitialTextForNavigation(e); runAnythingManager.show(text, e); } }
Example #8
Source File: GotoActionAction.java From consulo with Apache License 2.0 | 6 votes |
@Override public void gotoActionPerformed(@Nonnull AnActionEvent e) { Project project = e.getProject(); Component component = e.getData(PlatformDataKeys.CONTEXT_COMPONENT); Editor editor = e.getData(CommonDataKeys.EDITOR); FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.action"); GotoActionModel model = new GotoActionModel(project, component, editor); GotoActionCallback<Object> callback = new GotoActionCallback<Object>() { @Override public void elementChosen(@Nonnull ChooseByNamePopup popup, @Nonnull Object element) { if (project != null) { // if the chosen action displays another popup, don't populate it automatically with the text from this popup project.putUserData(ChooseByNamePopup.CHOOSE_BY_NAME_POPUP_IN_PROJECT_KEY, null); } String enteredText = popup.getTrimmedText(); int modifiers = popup.isClosedByShiftEnter() ? InputEvent.SHIFT_MASK : 0; openOptionOrPerformAction(((GotoActionModel.MatchedValue)element).value, enteredText, project, component, modifiers); } }; Pair<String, Integer> start = getInitialText(false, e); showNavigationPopup(callback, null, createPopup(project, model, start.first, start.second, component, e), false); }
Example #9
Source File: ShowQuickDocInfoAction.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess @Override public void actionPerformed(@Nonnull AnActionEvent e) { final Project project = e.getData(CommonDataKeys.PROJECT); final Editor editor = e.getData(CommonDataKeys.EDITOR); final PsiElement element = e.getData(CommonDataKeys.PSI_ELEMENT); if (project != null && editor != null) { FeatureUsageTracker.getInstance().triggerFeatureUsed(CODEASSISTS_QUICKJAVADOC_FEATURE); final LookupImpl lookup = (LookupImpl)LookupManager.getInstance(project).getActiveLookup(); if (lookup != null) { //dumpLookupElementWeights(lookup); FeatureUsageTracker.getInstance().triggerFeatureUsed(CODEASSISTS_QUICKJAVADOC_LOOKUP_FEATURE); } actionPerformedImpl(project, editor); } else if (project != null && element != null) { FeatureUsageTracker.getInstance().triggerFeatureUsed(CODEASSISTS_QUICKJAVADOC_CTRLN_FEATURE); CommandProcessor.getInstance().executeCommand(project, new Runnable() { @Override public void run() { DocumentationManager.getInstance(project).showJavaDocInfo(element, null); } }, getCommandName(), null); } }
Example #10
Source File: GotoActionBase.java From consulo with Apache License 2.0 | 5 votes |
protected void showInSearchEverywherePopup(@Nonnull String searchProviderID, @Nonnull AnActionEvent event, boolean useEditorSelection, boolean sendStatistics) { Project project = event.getProject(); if (project == null) return; SearchEverywhereManager seManager = SearchEverywhereManager.getInstance(project); FeatureUsageTracker.getInstance().triggerFeatureUsed(IdeActions.ACTION_SEARCH_EVERYWHERE); if (seManager.isShown()) { if (searchProviderID.equals(seManager.getSelectedContributorID())) { seManager.toggleEverywhereFilter(); } else { seManager.setSelectedContributor(searchProviderID); //if (sendStatistics) { // FeatureUsageData data = SearchEverywhereUsageTriggerCollector.createData(searchProviderID).addInputEvent(event); // SearchEverywhereUsageTriggerCollector.trigger(project, SearchEverywhereUsageTriggerCollector.TAB_SWITCHED, data); //} } return; } //if (sendStatistics) { // FeatureUsageData data = SearchEverywhereUsageTriggerCollector.createData(searchProviderID); // SearchEverywhereUsageTriggerCollector.trigger(project, SearchEverywhereUsageTriggerCollector.DIALOG_OPEN, data); //} IdeEventQueue.getInstance().getPopupManager().closeAllPopups(false); String searchText = StringUtil.nullize(getInitialText(useEditorSelection, event).first); seManager.show(searchProviderID, searchText, event); }
Example #11
Source File: HighlightUsagesHandler.java From consulo with Apache License 2.0 | 5 votes |
public static void invoke(@Nonnull final Project project, @Nonnull final Editor editor, final PsiFile file) { PsiDocumentManager.getInstance(project).commitAllDocuments(); final SelectionModel selectionModel = editor.getSelectionModel(); if (file == null && !selectionModel.hasSelection()) { selectionModel.selectWordAtCaret(false); } if (file == null || selectionModel.hasSelection()) { doRangeHighlighting(editor, project); return; } final HighlightUsagesHandlerBase handler = createCustomHandler(editor, file); if (handler != null) { final String featureId = handler.getFeatureId(); if (featureId != null) { FeatureUsageTracker.getInstance().triggerFeatureUsed(featureId); } handler.highlightUsages(); return; } DumbService.getInstance(project).withAlternativeResolveEnabled(() -> { UsageTarget[] usageTargets = getUsageTargets(editor, file); if (usageTargets == null) { handleNoUsageTargets(file, editor, selectionModel, project); return; } boolean clearHighlights = isClearHighlights(editor); for (UsageTarget target : usageTargets) { target.highlightUsages(file, editor, clearHighlights); } }); }
Example #12
Source File: GotoTargetHandler.java From consulo with Apache License 2.0 | 5 votes |
@Override public void invoke(@Nonnull Project project, @Nonnull Editor editor, @Nonnull PsiFile file) { FeatureUsageTracker.getInstance().triggerFeatureUsed(getFeatureUsedKey()); try { GotoData gotoData = getSourceAndTargetElements(editor, file); if (gotoData != null) { show(project, editor, file, gotoData); } } catch (IndexNotReadyException e) { DumbService.getInstance(project).showDumbModeNotification("Navigation is not available here during index update"); } }
Example #13
Source File: PostfixLiveTemplate.java From consulo with Apache License 2.0 | 5 votes |
@Override public void expand(@Nonnull final String key, @Nonnull final CustomTemplateCallback callback) { ApplicationManager.getApplication().assertIsDispatchThread(); FeatureUsageTracker.getInstance().triggerFeatureUsed("editing.completion.postfix"); Editor editor = callback.getEditor(); for (PostfixTemplateProvider provider : LanguagePostfixTemplate.LANG_EP.allForLanguage(getLanguage(callback))) { PostfixTemplate postfixTemplate = getTemplate(provider, key); if (postfixTemplate != null) { final PsiFile file = callback.getContext().getContainingFile(); if (isApplicableTemplate(provider, key, file, editor)) { int offset = deleteTemplateKey(file, editor, key); try { provider.preExpand(file, editor); PsiElement context = CustomTemplateCallback.getContext(file, positiveOffset(offset)); expandTemplate(postfixTemplate, editor, context); } finally { provider.afterExpand(file, editor); } } // don't care about errors in multiCaret mode else if (editor.getCaretModel().getAllCarets().size() == 1) { LOG.error("Template not found by key: " + key); } return; } } // don't care about errors in multiCaret mode if (editor.getCaretModel().getAllCarets().size() == 1) { LOG.error("Template not found by key: " + key); } }
Example #14
Source File: LookupUi.java From consulo with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(@Nonnull AnActionEvent e) { if (e.getPlace() == ActionPlaces.EDITOR_POPUP) { sortByName = !sortByName; FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_CHANGE_SORTING); UISettings.getInstance().setSortLookupElementsLexicographically(sortByName); myLookup.resort(false); } }
Example #15
Source File: ChooseItemAction.java From consulo with Apache License 2.0 | 5 votes |
@Override public void execute(@Nonnull final Editor editor, final DataContext dataContext) { final LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor); if (lookup == null) { throw new AssertionError("The last lookup disposed at: " + LookupImpl.getLastLookupDisposeTrace() + "\n-----------------------\n"); } if ((finishingChar == Lookup.NORMAL_SELECT_CHAR || finishingChar == Lookup.REPLACE_SELECT_CHAR) && hasTemplatePrefix(lookup, finishingChar)) { lookup.hideLookup(true); ExpandLiveTemplateCustomAction.createExpandTemplateHandler(finishingChar).execute(editor, null, dataContext); return; } if (finishingChar == Lookup.NORMAL_SELECT_CHAR) { if (!lookup.isFocused()) { FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_CONTROL_ENTER); } } else if (finishingChar == Lookup.COMPLETE_STATEMENT_SELECT_CHAR) { FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_SMART_ENTER); } else if (finishingChar == Lookup.REPLACE_SELECT_CHAR) { FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_REPLACE); } else if (finishingChar == '.') { FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_CONTROL_DOT); } lookup.finishLookup(finishingChar); }
Example #16
Source File: VariantsCompletionAction.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess @Override public void actionPerformed(@Nonnull final AnActionEvent e) { final Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE); if (editor == null) return; final String prefix = myTextField.getText().substring(0, myTextField.getCaretPosition()); if (StringUtil.isEmpty(prefix)) return; final String[] array = calcWords(prefix, editor); if (array.length == 0) { return; } FeatureUsageTracker.getInstance().triggerFeatureUsed("find.completion"); final JList list = new JBList(array) { @Override protected void paintComponent(final Graphics g) { GraphicsUtil.setupAntialiasing(g); super.paintComponent(g); } }; list.setBackground(new JBColor(new Color(235, 244, 254), new Color(0x4C4F51))); list.setFont(editor.getColorsScheme().getFont(EditorFontType.PLAIN)); Utils.showCompletionPopup( e.getInputEvent() instanceof MouseEvent ? myTextField: null, list, null, myTextField, null); }
Example #17
Source File: SearchTextArea.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess @Override public void actionPerformed(@Nonnull AnActionEvent e) { FeatureUsageTracker.getInstance().triggerFeatureUsed("find.recent.search"); FindInProjectSettings findInProjectSettings = FindInProjectSettings.getInstance(e.getProject()); String[] recent = mySearchMode ? findInProjectSettings.getRecentFindStrings() : findInProjectSettings.getRecentReplaceStrings(); JBList<String> historyList = new JBList<>(ArrayUtil.reverseArray(recent)); Utils.showCompletionPopup(SearchTextArea.this, historyList, null, myTextArea, null); }
Example #18
Source File: FlowRenameHandler.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
private void invoke(@Nullable final Editor editor, @NotNull final PsiElement element, @Nullable final DataContext context) { if (!isRenaming(context)) { return; } FeatureUsageTracker.getInstance().triggerFeatureUsed("refactoring.rename"); // if (isInplaceRenameAvailable(editor)) { // FlowInPlaceRenamer.rename(editor, (XmlTag)element); // } // else { FlowRenameDialog.renameFlowTag(editor, element, (XmlTag)element); // } }
Example #19
Source File: SelectInAction.java From consulo with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(AnActionEvent e) { FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.select.in"); SelectInContext context = SelectInContextImpl.createContext(e); if (context == null) return; invoke(e.getDataContext(), context); }
Example #20
Source File: DesktopStripeButton.java From consulo with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(final ActionEvent e) { if (myPressedWhenSelected) { myDecorator.fireHidden(); } else { myDecorator.fireActivated(); } myPressedWhenSelected = false; FeatureUsageTracker.getInstance().triggerFeatureUsed("toolwindow.clickstat." + myDecorator.getToolWindow().getId()); }
Example #21
Source File: CompletionUtil.java From consulo with Apache License 2.0 | 5 votes |
public static boolean shouldShowFeature(Project project, @NonNls String id) { if (FeatureUsageTracker.getInstance().isToBeAdvertisedInLookup(id, project)) { FeatureUsageTracker.getInstance().triggerFeatureShown(id); return true; } return false; }
Example #22
Source File: CsvHighlightUsagesHandlerTest.java From intellij-csv-validator with Apache License 2.0 | 5 votes |
private RangeHighlighter[] testHighlightUsages(String... fileNames) { myFixture.configureByFiles(fileNames); HighlightUsagesHandlerBase handler = HighlightUsagesHandler.createCustomHandler(myFixture.getEditor(), myFixture.getFile()); String featureId = handler.getFeatureId(); if (featureId != null) { FeatureUsageTracker.getInstance().triggerFeatureUsed(featureId); } handler.highlightUsages(); Editor editor = myFixture.getEditor(); return editor.getMarkupModel().getAllHighlighters(); }
Example #23
Source File: SymfonySymbolSearchAction.java From idea-php-symfony2-plugin with MIT License | 5 votes |
@Override protected void gotoActionPerformed(AnActionEvent paramAnActionEvent) { FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.file"); Project localProject = paramAnActionEvent.getData(CommonDataKeys.PROJECT); if (localProject != null) { SymfonySymbolSearchModel searchModel = new SymfonySymbolSearchModel(localProject, new ChooseByNameContributor[] { new Symfony2NavigationContributor(localProject) }); showNavigationPopup(paramAnActionEvent, searchModel, new MyGotoCallback(), null, true); } }
Example #24
Source File: IdeMouseEventDispatcher.java From consulo with Apache License 2.0 | 5 votes |
private boolean doHorizontalScrolling(Component c, MouseWheelEvent me) { final JScrollBar scrollBar = findHorizontalScrollBar(c); if (scrollBar != null) { if (scrollBar.hashCode() != myLastHorScrolledComponentHash) { FeatureUsageTracker.getInstance().triggerFeatureUsed("ui.horizontal.scrolling"); myLastHorScrolledComponentHash = scrollBar.hashCode(); } scrollBar.setValue(scrollBar.getValue() + getScrollAmount(c, me, scrollBar)); return true; } return false; }
Example #25
Source File: Switcher.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess @Override public void actionPerformed(@Nonnull AnActionEvent e) { Project project = e.getProject(); if (project == null) return; SwitcherPanel switcher = SWITCHER_KEY.get(project); boolean isNewSwitcher = false; if (switcher != null && switcher.isPinnedMode()) { switcher.cancel(); switcher = null; } if (switcher == null) { isNewSwitcher = true; switcher = createAndShowSwitcher(project, "Switcher", IdeActions.ACTION_SWITCHER, false, false); FeatureUsageTracker.getInstance().triggerFeatureUsed("switcher"); } if (!switcher.isPinnedMode()) { if (e.getInputEvent() != null && e.getInputEvent().isShiftDown()) { switcher.goBack(); } else { if (isNewSwitcher && !FileEditorManagerEx.getInstanceEx(project).hasOpenedFile()) { switcher.files.setSelectedIndex(0); } else { switcher.goForward(); } } } }
Example #26
Source File: RecentLocationsAction.java From consulo with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(@Nonnull AnActionEvent e) { FeatureUsageTracker.getInstance().triggerFeatureUsed(RECENT_LOCATIONS_ACTION_ID); Project project = getEventProject(e); if (project == null) { return; } showPopup(project, false); }
Example #27
Source File: CompletionProgressIndicator.java From consulo with Apache License 2.0 | 5 votes |
private void advertiseCtrlArrows() { if (!myEditor.isOneLineMode() && FeatureUsageTracker.getInstance().isToBeAdvertisedInLookup(CodeCompletionFeatures.EDITING_COMPLETION_CONTROL_ARROWS, getProject())) { String downShortcut = CompletionUtil.getActionShortcut(IdeActions.ACTION_LOOKUP_DOWN); String upShortcut = CompletionUtil.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); } } }
Example #28
Source File: CompletionProgressIndicator.java From consulo with Apache License 2.0 | 5 votes |
private void advertiseCtrlDot() { if (FeatureUsageTracker.getInstance().isToBeAdvertisedInLookup(CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_CONTROL_DOT, getProject())) { String dotShortcut = CompletionUtil.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); } } }
Example #29
Source File: CodeCompletionAction.java From consulo with Apache License 2.0 | 4 votes |
@Override public void actionPerformed(AnActionEvent e) { FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_BASIC); invokeCompletion(e, CompletionType.BASIC, 1); }
Example #30
Source File: SmartEnterProcessorWithFixers.java From consulo with Apache License 2.0 | 4 votes |
protected void process(@Nonnull final Project project, @Nonnull final Editor editor, @Nonnull final PsiFile file, final int attempt) throws TooManyAttemptsException { FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.complete.statement"); if (attempt > MAX_ATTEMPTS) throw new TooManyAttemptsException(); try { commit(editor); if (myFirstErrorOffset != Integer.MAX_VALUE) { editor.getCaretModel().moveToOffset(myFirstErrorOffset); } myFirstErrorOffset = Integer.MAX_VALUE; PsiElement atCaret = getStatementAtCaret(editor, file); if (atCaret == null) { return; } OrderedSet<PsiElement> queue = new OrderedSet<PsiElement>(); collectAllElements(atCaret, queue, true); queue.add(atCaret); for (PsiElement psiElement : queue) { for (Fixer fixer : myFixers) { fixer.apply(editor, this, psiElement); if (LookupManager.getInstance(project).getActiveLookup() != null) { return; } if (isUncommited(project) || !psiElement.isValid()) { moveCaretInsideBracesIfAny(editor, file); process(project, editor, file, attempt + 1); return; } } } doEnter(atCaret, file, editor); } catch (IncorrectOperationException e) { LOG.error(e); } }