private static List<PsiDirectory> getWritableDirectoryListDefault(final @Nullable PsiPackage context,
                                                                    final GlobalSearchScope scope,
                                                                    final PsiManager psiManager) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Getting writable directory list for package '" + (context == null ? null : context.getQualifiedName()) + "', scope=" + scope);
    }
    final List<PsiDirectory> writableDirectoryList = new ArrayList<>();
    if (context != null) {
      for (PsiDirectory directory : context.getDirectories()) {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Package directory: " + directory);
        }
        VirtualFile virtualFile = directory.getVirtualFile();
        if (directory.isWritable() && scope.contains(virtualFile)
            && !JavaProjectRootsUtil.isInGeneratedCode(virtualFile, psiManager.getProject())) {
          writableDirectoryList.add(directory);
        }
      }
    }
    else {
      for (VirtualFile root : JavaProjectRootsUtil.getSuitableDestinationSourceRoots(psiManager.getProject())) {
        PsiDirectory directory = psiManager.findDirectory(root);
        if (LOG.isDebugEnabled()) {
          LOG.debug("Root: " + root + ", directory: " + directory);
        }
        if (directory != null && directory.isWritable() && scope.contains(directory.getVirtualFile())) {
          writableDirectoryList.add(directory);
        }
      }
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("Result " + writableDirectoryList);
    }
    return writableDirectoryList;
  }
private static List<PsiDirectory> getWritableDirectoryListDefault(final @Nullable PsiPackage context,
                                                                    final GlobalSearchScope scope,
                                                                    final PsiManager psiManager)