]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/jcr/lists/NodeViewerComparator.java
Prepare JCR decoupling.
[lgpl/argeo-commons.git] / org.argeo.eclipse.ui / src / org / argeo / eclipse / ui / jcr / lists / NodeViewerComparator.java
index 11f12e6f55e3e035480259882d3b301528eba258..341b3abee17a284d57ca81f6c21d1d22cc986c5f 100644 (file)
@@ -9,7 +9,7 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Value;
 import javax.jcr.ValueFormatException;
 
-import org.argeo.ArgeoException;
+import org.argeo.eclipse.ui.EclipseUiException;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerComparator;
 
@@ -20,12 +20,13 @@ import org.eclipse.jface.viewers.ViewerComparator;
  * Note that the following snippet must be added before setting the comparator
  * to the corresponding control: <code>
  * // IMPORTANT: initialize comparator before setting it
- * ColumnDefinition firstCol = colDefs.get(0);
+ * JcrColumnDefinition firstCol = colDefs.get(0);
  * comparator.setColumn(firstCol.getPropertyType(),
  * firstCol.getPropertyName());
  * viewer.setComparator(comparator); </code>
  */
 public class NodeViewerComparator extends ViewerComparator {
+       private static final long serialVersionUID = -7782916140737279027L;
 
        protected String propertyName;
 
@@ -50,7 +51,6 @@ public class NodeViewerComparator extends ViewerComparator {
                long lc = 0;
 
                try {
-
                        Node n1 = (Node) e1;
                        Node n2 = (Node) e2;
 
@@ -89,10 +89,8 @@ public class NodeViewerComparator extends ViewerComparator {
                                        ;
                                lc = c1.getTimeInMillis() - c2.getTimeInMillis();
                                if (lc < Integer.MIN_VALUE)
-                                       // rc = Integer.MIN_VALUE;
                                        rc = -1;
                                else if (lc > Integer.MAX_VALUE)
-                                       // rc = Integer.MAX_VALUE;
                                        rc = 1;
                                else
                                        rc = (int) lc;
@@ -100,7 +98,7 @@ public class NodeViewerComparator extends ViewerComparator {
                        case PropertyType.LONG:
                                long l1;
                                long l2;
-                               // FIXME sometimes an empty string is set instead of a long
+                               // TODO Sometimes an empty string is set instead of a long
                                try {
                                        l1 = v1.getLong();
                                } catch (ValueFormatException ve) {
@@ -131,7 +129,7 @@ public class NodeViewerComparator extends ViewerComparator {
                                rc = d1.compareTo(d2);
                                break;
                        default:
-                               throw new ArgeoException(
+                               throw new EclipseUiException(
                                                "Unimplemented comparaison for PropertyType "
                                                                + propertyType);
                        }
@@ -141,7 +139,7 @@ public class NodeViewerComparator extends ViewerComparator {
                        }
 
                } catch (RepositoryException re) {
-                       throw new ArgeoException("Unexpected error "
+                       throw new EclipseUiException("Unexpected error "
                                        + "while comparing nodes", re);
                }
                return rc;
@@ -189,4 +187,4 @@ public class NodeViewerComparator extends ViewerComparator {
        protected void setDirection(int direction) {
                this.direction = direction;
        }
-}
\ No newline at end of file
+}