@NotNull
  private PsiDirectory getPackageRoot() {
    final PsiDirectoryFactory manager = PsiDirectoryFactory.getInstance(myProject);
    PsiDirectory directory = myDirectory;
    PsiDirectory parent = directory.getParent();

    while (parent != null && manager.isPackage(parent)) {
      directory = parent;
      parent = parent.getParent();
    }

    return directory;
  }
@NotNull
  private PsiDirectory getPackageRoot()