Search in sources :

Example 1 with ChooseByNameFilter

use of com.intellij.ide.util.gotoByName.ChooseByNameFilter in project intellij-community by JetBrains.

the class RunInspectionAction method gotoActionPerformed.

@Override
protected void gotoActionPerformed(final AnActionEvent e) {
    final Project project = e.getData(CommonDataKeys.PROJECT);
    if (project == null)
        return;
    PsiDocumentManager.getInstance(project).commitAllDocuments();
    final PsiElement psiElement = CommonDataKeys.PSI_ELEMENT.getData(e.getDataContext());
    final PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
    final VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
    FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.goto.inspection");
    final GotoInspectionModel model = new GotoInspectionModel(project);
    showNavigationPopup(e, model, new GotoActionCallback<Object>() {

        @Override
        protected ChooseByNameFilter<Object> createFilter(@NotNull ChooseByNamePopup popup) {
            popup.setSearchInAnyPlace(true);
            return super.createFilter(popup);
        }

        @Override
        public void elementChosen(ChooseByNamePopup popup, final Object element) {
            ApplicationManager.getApplication().invokeLater(() -> runInspection(project, ((InspectionToolWrapper) element).getShortName(), virtualFile, psiElement, psiFile));
        }
    }, false);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) ChooseByNamePopup(com.intellij.ide.util.gotoByName.ChooseByNamePopup) ChooseByNameFilter(com.intellij.ide.util.gotoByName.ChooseByNameFilter)

Aggregations

ChooseByNameFilter (com.intellij.ide.util.gotoByName.ChooseByNameFilter)1 ChooseByNamePopup (com.intellij.ide.util.gotoByName.ChooseByNamePopup)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1