public static <T extends PsiElement> Map<T, FileStatus> getElementsChanged(PsiElement file,
                                                                             PsiElement oldFile,
                                                                             final PsiFilter<T> filter) {
    final HashMap<T, FileStatus> result = new HashMap<>();
    final List<T> oldElements = new ArrayList<>();
    final List<T> elements = new ArrayList<>();

    if (file == null) {
      oldFile.accept(filter.createVisitor(oldElements));
      calculateStatuses(elements, oldElements, result, filter);
      return result;
    }

    final Project project = file.getProject();

    file.accept(filter.createVisitor(elements));
    final VirtualFile vf = file.getContainingFile().getVirtualFile();
    FileStatus status = vf == null ? null : FileStatusManager.getInstance(project).getStatus(vf);
    if (status == null && oldFile == null) {
      status = FileStatus.ADDED;
    }
    if (status == FileStatus.ADDED ||
        status == FileStatus.DELETED ||
        status == FileStatus.DELETED_FROM_FS ||
        status == FileStatus.UNKNOWN) {
      for (T element : elements) {
        result.put(element, status);
      }
      return result;
    }

    if (oldFile == null) return result;
    oldFile.accept(filter.createVisitor(oldElements));
    calculateStatuses(elements, oldElements, result, filter);

    return result;
  }
public static <T extends PsiElement> Map<T, FileStatus> getElementsChanged(PsiElement file,
                                                                             PsiElement oldFile,
                                                                             final PsiFilter<T> filter)