show indexed file path when its size is greater than threshold (500K)

(cherry picked from commit 532ae43)
This commit is contained in:
Maxim.Mossienko
2015-05-22 18:58:40 +02:00
parent 5ef298e4ab
commit dbf573963e
@@ -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;
}
}
}