コード例 #1
0
 @NotNull
 private static String toVfString(@NotNull Collection<VirtualFile> list) {
   List<VirtualFile> sub = new ArrayList<VirtualFile>(list).subList(0, Math.min(list.size(), 100));
   return list.size()
       + " files: "
       + StringUtil.join(sub, file -> file.getName(), ", ")
       + (list.size() == sub.size() ? "" : "...");
 }
コード例 #2
0
 public static boolean areTooManyDocumentsInTheQueue(Collection<Document> documents) {
   if (documents.size() > 100) return true;
   int totalSize = 0;
   for (Document document : documents) {
     totalSize += document.getTextLength();
     if (totalSize > 10 * FileUtilRt.MEGABYTE) return true;
   }
   return false;
 }
コード例 #3
0
 @Override
 public boolean queue(@NotNull Collection<VirtualFile> files, @NotNull Object reason) {
   if (files.isEmpty()) {
     return false;
   }
   boolean queued = false;
   List<VirtualFile> added = new ArrayList<VirtualFile>(files.size());
   for (VirtualFile file : files) {
     boolean wasAdded = queueIfNeeded(file, myProject);
     if (wasAdded) {
       added.add(file);
     }
     queued |= wasAdded;
   }
   if (queued) {
     log("Queued to resolve (from " + reason + "): " + toVfString(added));
     flushLog();
   }
   return queued;
 }