Beispiel #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;
 }
Beispiel #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();
  }