コード例 #1
0
  private static void logStats(Collection<PsiFile> otherFiles, long start) {
    long time = System.currentTimeMillis() - start;

    final Multiset<String> stats = HashMultiset.create();
    for (PsiFile file : otherFiles) {
      stats.add(
          StringUtil.notNullize(file.getViewProvider().getVirtualFile().getExtension())
              .toLowerCase());
    }

    List<String> extensions = ContainerUtil.newArrayList(stats.elementSet());
    Collections.sort(
        extensions,
        new Comparator<String>() {
          @Override
          public int compare(String o1, String o2) {
            return stats.count(o2) - stats.count(o1);
          }
        });

    String message =
        "Search in "
            + otherFiles.size()
            + " files with unknown types took "
            + time
            + "ms.\n"
            + "Mapping their extensions to an existing file type (e.g. Plain Text) might speed up the search.\n"
            + "Most frequent non-indexed file extensions: ";
    for (int i = 0; i < Math.min(10, extensions.size()); i++) {
      String extension = extensions.get(i);
      message += extension + "(" + stats.count(extension) + ") ";
    }
    LOG.info(message);
  }
コード例 #2
0
 @Override
 public Dimension getMinimumSize() {
   if (isMinimumSizeSet()) {
     return super.getMinimumSize();
   }
   Dimension minimumSize = super.getMinimumSize();
   return new Dimension(Math.min(200, minimumSize.width), minimumSize.height);
 }
コード例 #3
0
 @Override
 public Dimension getPreferredSize() {
   if (isPreferredSizeSet()) {
     return super.getPreferredSize();
   }
   Dimension preferredSize = super.getPreferredSize();
   return new Dimension(Math.min(400, preferredSize.width), preferredSize.height);
 }