merge-update from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / model / AbstractUtility.java
index ee7db7b294174c67dc825b4fefadfdb93c894121..e335480a8e2e36e7c27b8e75f65ad902ced113ca 100644 (file)
@@ -386,7 +386,7 @@ public abstract class AbstractUtility {
 
                        private String getCauseRecursively(Throwable t) {
                                if(t == null){
-                                       return null;
+                                       return "";
                                }
 
                                if(t.getCause() != null){
@@ -452,7 +452,7 @@ public abstract class AbstractUtility {
         *
         * @param operation
         *            a
-        *            {@link eu.etaxonomy.taxeditor.operation.AbstractPostOperation}
+        *            {@link eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation}
         *            object.
         * @return a {@link org.eclipse.core.runtime.IStatus} object.
         */
@@ -924,24 +924,10 @@ public abstract class AbstractUtility {
 
     /**
      * Orders a Collection of {@link IEnumTerm}s according to the term
-     * hierarchy. The hierarchy will be reduced to two layers: one layer being
-     * the root elements (that have no parents) and the other being their
-     * children and children's children recursively.<br>
-     * The returned map will be be ordered primarily by root elements and
-     * secondarily by the child elements, both ascending alphabetically. <br>
+     * hierarchy. <br>
      * <br>
-     * The reduced hierarchy could look like this:<br>
-     * <ul>
-     * <li>Root1
-     *  <ul>
-     *   <li>child1
-     *   <li>child2
-     *   <li>childOfChild2
-     *  </ul>
-     * <li>root2
-     * <ul><li>child4</ul>
-     * </ul>
-     *
+     * The returned map will be be ordered primarily by root elements,
+     * secondarily by the child elements and their children resp., both ascending alphabetically. <br>
      * @param terms
      *            A {@link Collection} of {@link IEnumTerm}s for which the term
      *            hierarchy should be created
@@ -949,13 +935,6 @@ public abstract class AbstractUtility {
      *         representation via {@link IEnumTerm#getMessage()} as values
      */
     public static <T extends IEnumTerm<T>> LinkedHashMap<T, String> orderTerms(Collection<T> terms) {
-//        Comparator<TermNode<T>> comparator = new Comparator<TermNode<T>>() {
-//            @Override
-//            public int compare(TermNode<T> t1, TermNode<T> t2) {
-//                return t1.getTerm().getMessage().compareTo(t2.getTerm().getMessage());
-//            }
-//        };
-
         TreeSet<TermNode<T>> parentElements = new TreeSet<TermNode<T>>();
         parentElements.addAll(getTermHierarchy(terms));
 
@@ -972,6 +951,9 @@ public abstract class AbstractUtility {
             for(int i=0;i<depth;i++){
                 indentString += "  ";
             }
+            if(depth>0){
+                indentString += "- ";
+            }
             result.put(node.term, indentString + node.term.getMessage());
             parseTermTree(node.children, result, depth);
         }