private boolean isPackageUnderDirectory(@NotNull PackageElement element, @NotNull VirtualFile file) {
    PsiPackage parent = getParentPackage();
    for (PsiPackage p = element.getPackage(); p != null && !p.equals(parent); p = p.getParentPackage()) {
      for (PsiDirectory directory : p.getDirectories()) {
        if (directory.getVirtualFile().equals(file)) return true;
      }
    }
    return false;
  }
private boolean isPackageUnderDirectory(@NotNull PackageElement element, @NotNull VirtualFile file)