From dbf573963e61de3573d1187f1d5462e011ec7c85 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Fri, 22 May 2015 18:34:55 +0200 Subject: [PATCH] show indexed file path when its size is greater than threshold (500K) (cherry picked from commit 532ae43) --- .../intellij/openapi/project/CacheUpdateRunner.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateRunner.java b/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateRunner.java index c620877fbad8..8c2c2248b10f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateRunner.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateRunner.java @@ -44,6 +44,8 @@ public class CacheUpdateRunner { private static final Key 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 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 processed = new THashSet(); - 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; } } }