public static IMarker[] getProblemsFor(IResource resource) {
   try {
     if (resource != null && resource.exists()) {
       IMarker[] markers =
           resource.findMarkers(
               IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
       Set markerTypes =
           JavaModelManager.getJavaModelManager().compilationParticipants.managedMarkerTypes();
       if (markerTypes.isEmpty()) return markers;
       ArrayList markerList = new ArrayList(5);
       for (int i = 0, length = markers.length; i < length; i++) {
         markerList.add(markers[i]);
       }
       Iterator iterator = markerTypes.iterator();
       while (iterator.hasNext()) {
         markers = resource.findMarkers((String) iterator.next(), false, IResource.DEPTH_INFINITE);
         for (int i = 0, length = markers.length; i < length; i++) {
           markerList.add(markers[i]);
         }
       }
       IMarker[] result;
       markerList.toArray(result = new IMarker[markerList.size()]);
       return result;
     }
   } catch (CoreException e) {
     // assume there are no problems
   }
   return new IMarker[0];
 }
  public static void removeProblemsFor(IResource resource) {
    try {
      if (resource != null && resource.exists()) {
        resource.deleteMarkers(
            IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);

        // delete managed markers
        Set markerTypes =
            JavaModelManager.getJavaModelManager().compilationParticipants.managedMarkerTypes();
        if (markerTypes.size() == 0) return;
        Iterator iterator = markerTypes.iterator();
        while (iterator.hasNext())
          resource.deleteMarkers((String) iterator.next(), false, IResource.DEPTH_INFINITE);
      }
    } catch (CoreException e) {
      // assume there were no problems
    }
  }
 /*
  * Instruct the build manager that this project is involved in a cycle and
  * needs to propagate structural changes to the other projects in the cycle.
  */
 void mustPropagateStructuralChanges() {
   LinkedHashSet cycleParticipants = new LinkedHashSet(3);
   this.javaProject.updateCycleParticipants(
       new ArrayList(), cycleParticipants, this.workspaceRoot, new HashSet(3), null);
   IPath currentPath = this.javaProject.getPath();
   Iterator i = cycleParticipants.iterator();
   while (i.hasNext()) {
     IPath participantPath = (IPath) i.next();
     if (participantPath != currentPath) {
       IProject project = this.workspaceRoot.getProject(participantPath.segment(0));
       if (hasBeenBuilt(project)) {
         if (DEBUG)
           System.out.println(
               "JavaBuilder: Requesting another build iteration since cycle participant "
                   + project.getName() // $NON-NLS-1$
                   + " has not yet seen some structural changes"); //$NON-NLS-1$
         needRebuild();
         return;
       }
     }
   }
 }
  /**
   * Returns all of the possible subtypes of this type hierarchy. Returns null if they could not be
   * determine.
   */
  private String[] determinePossibleSubTypes(final HashSet localTypes, IProgressMonitor monitor) {

    class PathCollector implements IPathRequestor {
      HashSet paths = new HashSet(10);

      public void acceptPath(String path, boolean containsLocalTypes) {
        this.paths.add(path);
        if (containsLocalTypes) {
          localTypes.add(path);
        }
      }
    }
    PathCollector collector = new PathCollector();

    try {
      if (monitor != null) monitor.beginTask("", MAXTICKS); // $NON-NLS-1$
      searchAllPossibleSubTypes(
          getType(),
          this.scope,
          this.binariesFromIndexMatches,
          collector,
          IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
          monitor);
    } finally {
      if (monitor != null) monitor.done();
    }

    HashSet paths = collector.paths;
    int length = paths.size();
    String[] result = new String[length];
    int count = 0;
    for (Iterator iter = paths.iterator(); iter.hasNext(); ) {
      result[count++] = (String) iter.next();
    }
    return result;
  }