+ private boolean doLoadContent(final FileContent content) throws InterruptedException {
+ final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
+ final long contentLength = content.getLength();
+
+ boolean counterUpdated = false;
+ try {
+ if (contentLength < PersistentFS.MAX_INTELLISENSE_FILESIZE) {
+ synchronized (this) {
+ while (myTotalSize > SIZE_THRESHOLD) {
+ if (indicator != null) {
+ indicator.checkCanceled();
+ }
+ wait(300);
+ }
+ myTotalSize += contentLength;
+ counterUpdated = true;
+ }
+
+ content.getBytes(); // Reads the content bytes and caches them.
+ }
+
+ return true;
+ }
+ catch (Throwable e) {
+ if (counterUpdated) {
+ synchronized (this) {
+ myTotalSize -= contentLength; // revert size counter
+ notifyAll();
+ }
+ }
+ if (e instanceof ProcessCanceledException) throw (ProcessCanceledException)e;
+ if (e instanceof InterruptedException) throw (InterruptedException)e;
+
+ if (e instanceof IOException || e instanceof InvalidVirtualFileAccessException) LOG.info(e);
+ else LOG.error(e);
+
+ return false;
+ }
+ }
+