Exemplo n.º 1
0
 @Nullable
 public static MavenProject findContainingProject(@NotNull PsiElement element) {
   VirtualFile file = getVirtualFile(element);
   if (file == null) return null;
   MavenProjectsManager manager = MavenProjectsManager.getInstance(element.getProject());
   return manager.findContainingProject(file);
 }
Exemplo n.º 2
0
  public static boolean isFilteredResourceFile(PsiElement element) {
    PsiFile psiFile = element.getContainingFile();
    VirtualFile file = getVirtualFile(psiFile);
    if (file == null) return false;

    MavenProjectsManager manager = MavenProjectsManager.getInstance(psiFile.getProject());
    MavenProject mavenProject = manager.findContainingProject(file);
    if (mavenProject == null) return false;

    Set<VirtualFile> filteredRoots = getFilteredResourcesRoots(mavenProject);

    if (!filteredRoots.isEmpty()) {
      for (VirtualFile f = file.getParent(); f != null; f = f.getParent()) {
        if (filteredRoots.contains(f)) {
          return true;
        }
      }
    }

    return false;
  }