mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
debugging IDEA-127750 (Sometimes find in path is working after second invocation only)
* Show a separate balloon when the usage search is canceled (instead of '0 usages found') * Add debug logging
This commit is contained in:
@@ -128,6 +128,9 @@ class FindInProjectTask {
|
||||
}
|
||||
});
|
||||
myProgress.setIndeterminate(false);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Searching for " + myFindModel.getStringToFind() + " in " + filesForFastWordSearch.size() + " indexed files");
|
||||
}
|
||||
|
||||
searchInFiles(filesForFastWordSearch, processPresentation, consumer);
|
||||
|
||||
@@ -137,6 +140,10 @@ class FindInProjectTask {
|
||||
final Collection<PsiFile> otherFiles = collectFilesInScope(filesForFastWordSearch, skipIndexed);
|
||||
myProgress.setIndeterminate(false);
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Searching for " + myFindModel.getStringToFind() + " in " + otherFiles.size() + " non-indexed files");
|
||||
}
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
searchInFiles(otherFiles, processPresentation, consumer);
|
||||
if (skipIndexed && otherFiles.size() > 1000) {
|
||||
@@ -144,7 +151,10 @@ class FindInProjectTask {
|
||||
}
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
// fine
|
||||
processPresentation.setCanceled(true);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Usage search canceled", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (!myLargeFiles.isEmpty()) {
|
||||
|
||||
@@ -43,6 +43,7 @@ public class FindUsagesProcessPresentation {
|
||||
private Collection<PsiFile> myLargeFiles;
|
||||
private boolean myShowFindOptionsPrompt = true;
|
||||
private Runnable mySearchWithProjectFiles;
|
||||
private boolean myCanceled;
|
||||
|
||||
public FindUsagesProcessPresentation(@NotNull UsageViewPresentation presentation) {
|
||||
myUsageViewPresentation = presentation;
|
||||
@@ -112,6 +113,15 @@ public class FindUsagesProcessPresentation {
|
||||
public void setShowFindOptionsPrompt(boolean showFindOptionsPrompt) {
|
||||
myShowFindOptionsPrompt = showFindOptionsPrompt;
|
||||
}
|
||||
|
||||
|
||||
public void setCanceled(boolean canceled) {
|
||||
myCanceled = canceled;
|
||||
}
|
||||
|
||||
public boolean isCanceled() {
|
||||
return myCanceled;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ class SearchForUsagesRunnable implements Runnable {
|
||||
return "<a href='" + SEARCH_IN_PROJECT_HREF_TARGET + "'>Search in Project</a>";
|
||||
}
|
||||
|
||||
private static void notifyByFindBalloon(final HyperlinkListener listener,
|
||||
private static void notifyByFindBalloon(@Nullable final HyperlinkListener listener,
|
||||
@NotNull final MessageType info,
|
||||
@NotNull FindUsagesProcessPresentation processPresentation,
|
||||
@NotNull final Project project,
|
||||
@@ -400,6 +400,12 @@ class SearchForUsagesRunnable implements Runnable {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myProcessPresentation.isCanceled()) {
|
||||
notifyByFindBalloon(null, MessageType.WARNING, myProcessPresentation, myProject, Arrays.asList("Usage search was canceled"));
|
||||
findStartedBalloonShown.set(false);
|
||||
return;
|
||||
}
|
||||
|
||||
final List<Action> notFoundActions = myProcessPresentation.getNotFoundActions();
|
||||
final String message = UsageViewBundle.message("dialog.no.usages.found.in",
|
||||
StringUtil.decapitalize(myPresentation.getUsagesString()),
|
||||
|
||||
Reference in New Issue
Block a user