@Override
        public int compare(final Usage o1, final Usage o2) {
          if (o1 == NULL_NODE || o2 == NULL_NODE) return -1;
          if (o1 instanceof Comparable && o2 instanceof Comparable) {
            final int selfcompared = ((Comparable<Usage>) o1).compareTo(o2);
            if (selfcompared != 0) return selfcompared;

            if (o1 instanceof UsageInFile && o2 instanceof UsageInFile) {
              UsageInFile u1 = (UsageInFile) o1;
              UsageInFile u2 = (UsageInFile) o2;

              VirtualFile f1 = u1.getFile();
              VirtualFile f2 = u2.getFile();

              if (f1 != null && f1.isValid() && f2 != null && f2.isValid()) {
                return f1.getPresentableUrl().compareTo(f2.getPresentableUrl());
              }
            }

            return 0;
          }
          return -1;
        }
  @NotNull
  private Set<VirtualFile> getReadOnlyUsagesFiles() {
    Set<Usage> usages = getReadOnlyUsages();
    Set<VirtualFile> result = new THashSet<VirtualFile>();
    for (Usage usage : usages) {
      if (usage instanceof UsageInFile) {
        UsageInFile usageInFile = (UsageInFile) usage;
        VirtualFile file = usageInFile.getFile();
        if (file != null) result.add(file);
      }

      if (usage instanceof UsageInFiles) {
        UsageInFiles usageInFiles = (UsageInFiles) usage;
        ContainerUtil.addAll(result, usageInFiles.getFiles());
      }
    }
    for (UsageTarget target : myTargets) {
      VirtualFile[] files = target.getFiles();
      if (files == null) continue;
      ContainerUtil.addAll(result, files);
    }
    return result;
  }