예제 #1
0
 /** Returns a list of all names of source files in the tree. */
 private ListBuffer<String> addAllChildren(IResource root) {
   ListBuffer<String> result = new ListBuffer<String>();
   for (IJavaElement element : JavaElementUtils.listJavaElements(root)) {
     result.append(element.getLocation());
   }
   return result;
 }
예제 #2
0
  /** Determines the encoding to use. Throws an exception if it can not be determined. */
  private String determineEncoding(IResource rootNode) throws ConQATException {
    Set<Charset> encodings = new HashSet<Charset>();
    for (IJavaElement element : JavaElementUtils.listJavaElements(rootNode)) {
      encodings.add(element.getEncoding());
    }
    if (encodings.size() != 1) {
      throw new ConQATException("Inconsistent encodings!");
    }

    return CollectionUtils.getAny(encodings).name();
  }
예제 #3
0
  /**
   * Get JavaDoc documentation for a class. If the documentation ist not cached this starts java doc
   * processing for the whole class and package tree this class belongs to and caches all
   * documentation nodes.
   *
   * @return the JavaDoc documentation or <code>null</code> if documentation couldn't be derived.
   * @throws ConQATException
   */
  public ClassDoc getDoc(IJavaElement element) throws ConQATException {

    ClassDoc classDoc = cache.get(element.getUniformPath());

    // already cached
    if (classDoc != null) {
      return classDoc;
    }

    // this tree hasn't been cached before, so process and cache it
    cache(element);

    // if it's not in cache now it couldn't be processed
    classDoc = cache.get(element.getUniformPath());
    if (classDoc == null) {
      throw new ConQATException("Couldn't find JavaDoc for element: " + element.getId());
    }

    return classDoc;
  }