mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Search Everywhere: start searching symbols and files in global scope if nothing's found
This commit is contained in:
@@ -1518,7 +1518,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
}
|
||||
|
||||
private synchronized void buildFiles(final String pattern) {
|
||||
final SearchResult files = getFiles(pattern, MAX_FILES, myFileChooseByName);
|
||||
final SearchResult files = getFiles(pattern, showAll.get(), MAX_FILES, myFileChooseByName);
|
||||
|
||||
check();
|
||||
|
||||
@@ -1704,6 +1704,11 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
return !symbols.needMore;
|
||||
}
|
||||
});
|
||||
|
||||
if (!includeLibs && symbols.isEmpty()) {
|
||||
return getSymbols(pattern, max, true, chooseByNamePopup);
|
||||
}
|
||||
|
||||
return symbols;
|
||||
}
|
||||
|
||||
@@ -1752,7 +1757,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
return classes;
|
||||
}
|
||||
|
||||
private SearchResult getFiles(final String pattern, final int max, ChooseByNamePopup chooseByNamePopup) {
|
||||
private SearchResult getFiles(final String pattern, final boolean includeLibs, final int max, ChooseByNamePopup chooseByNamePopup) {
|
||||
final SearchResult files = new SearchResult();
|
||||
if (chooseByNamePopup == null || !Registry.is("search.everywhere.files")) {
|
||||
return files;
|
||||
@@ -1772,7 +1777,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
}
|
||||
if (file != null
|
||||
&& !(pattern.indexOf(' ') != -1 && file.getName().indexOf(' ') == -1)
|
||||
&& (showAll.get() || scope.accept(file)
|
||||
&& (includeLibs || scope.accept(file)
|
||||
&& !myListModel.contains(file)
|
||||
&& !myAlreadyAddedFiles.contains(file))
|
||||
&& !files.contains(file)) {
|
||||
@@ -1785,6 +1790,10 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (!includeLibs && files.isEmpty()) {
|
||||
return getFiles(pattern, true, max, chooseByNamePopup);
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
@@ -2145,7 +2154,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
try {
|
||||
final SearchResult result
|
||||
= id == WidgetID.CLASSES ? getClasses(pattern, showAll.get(), DEFAULT_MORE_STEP_COUNT, myClassChooseByName)
|
||||
: id == WidgetID.FILES ? getFiles(pattern, DEFAULT_MORE_STEP_COUNT, myFileChooseByName)
|
||||
: id == WidgetID.FILES ? getFiles(pattern, showAll.get(), DEFAULT_MORE_STEP_COUNT, myFileChooseByName)
|
||||
: id == WidgetID.RUN_CONFIGURATIONS ? getConfigurations(pattern, DEFAULT_MORE_STEP_COUNT)
|
||||
: id == WidgetID.SYMBOLS ? getSymbols(pattern, DEFAULT_MORE_STEP_COUNT, showAll.get(), mySymbolsChooseByName)
|
||||
: id == WidgetID.ACTIONS ? getActionsOrSettings(pattern, DEFAULT_MORE_STEP_COUNT, true)
|
||||
|
||||
Reference in New Issue
Block a user