private boolean cleanupChildrenRecursively(
      @NotNull final Object fromElement,
      final @Nullable CompileScope scope,
      @NotNull UUID currentSessionId) {
    final ErrorViewStructure structure = myPanel.getErrorViewStructure();
    ErrorTreeElement[] elements = structure.getChildElements(fromElement);
    if (elements.length == 0) return true;

    boolean result = false;
    for (ErrorTreeElement element : elements) {
      if (element instanceof GroupingElement) {
        if (scope != null) {
          final VirtualFile file = ((GroupingElement) element).getFile();
          if (file != null && !scope.belongs(file.getUrl())) {
            continue;
          }
        }
        if (!currentSessionId.equals(element.getData())) {
          structure.removeElement(element);
          result = true;
        } else {
          result |= cleanupChildrenRecursively(element, scope, currentSessionId);
        }
      } else {
        if (!currentSessionId.equals(element.getData())) {
          structure.removeElement(element);
          result = true;
        }
      }
    }
    return result;
  }
Exemplo n.º 2
0
 private boolean needTransformCopying(CompileScope compileScope) {
   final CompilerConfiguration configuration = CompilerConfiguration.getInstance(myProject);
   final ProjectFileIndex index = ProjectRootManager.getInstance(myProject).getFileIndex();
   for (VirtualFile file :
       FilenameIndex.getVirtualFilesByName(
           myProject, AST_TRANSFORM_FILE_NAME, GlobalSearchScope.projectScope(myProject))) {
     if (compileScope.belongs(file.getUrl())
         && index.isInSource(file)
         && !configuration.isResourceFile(file)) {
       return true;
     }
   }
   return false;
 }