mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
show indexed file path when its size is greater than threshold (500K)
(cherry picked from commit 532ae43)
This commit is contained in:
@@ -44,6 +44,8 @@ public class CacheUpdateRunner {
|
||||
private static final Key<Boolean> FAILED_TO_INDEX = Key.create("FAILED_TO_INDEX");
|
||||
private static final int PROC_COUNT = Runtime.getRuntime().availableProcessors();
|
||||
|
||||
private static final int FILE_SIZE_TO_SHOW_THRESHOLD = 500 * 1024;
|
||||
|
||||
public static void processFiles(final ProgressIndicator indicator,
|
||||
boolean processInReadAction,
|
||||
Collection<VirtualFile> files,
|
||||
@@ -57,7 +59,7 @@ public class CacheUpdateRunner {
|
||||
// need set here to handle queue.pushbacks after checkCancelled() in order
|
||||
// not to count the same file several times
|
||||
final Set<VirtualFile> processed = new THashSet<VirtualFile>();
|
||||
private boolean fileNameWasShownAfterRestart;
|
||||
private boolean fileNameWasShown;
|
||||
|
||||
@Override
|
||||
public void consume(VirtualFile virtualFile) {
|
||||
@@ -65,12 +67,12 @@ public class CacheUpdateRunner {
|
||||
synchronized (processed) {
|
||||
boolean added = processed.add(virtualFile);
|
||||
indicator.setFraction(processed.size() / total);
|
||||
if (!added) {
|
||||
if (!added || virtualFile.getLength() > FILE_SIZE_TO_SHOW_THRESHOLD) {
|
||||
indicator.setText2(virtualFile.getPresentableUrl());
|
||||
fileNameWasShownAfterRestart = true;
|
||||
} else if (fileNameWasShownAfterRestart) {
|
||||
fileNameWasShown = true;
|
||||
} else if (fileNameWasShown) {
|
||||
indicator.setText2("");
|
||||
fileNameWasShownAfterRestart = false;
|
||||
fileNameWasShown = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user