X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.eclipse.ui%2Fsrc%2Forg%2Fargeo%2Feclipse%2Fui%2Fjcr%2Flists%2FNodeViewerComparator.java;h=341b3abee17a284d57ca81f6c21d1d22cc986c5f;hb=a1e5c8447beec2b896b0a03e38a4c17608a4b85d;hp=11f12e6f55e3e035480259882d3b301528eba258;hpb=e61dd9dda88354091625cca85aa7c96d196688b3;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/jcr/lists/NodeViewerComparator.java b/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/jcr/lists/NodeViewerComparator.java index 11f12e6f5..341b3abee 100644 --- a/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/jcr/lists/NodeViewerComparator.java +++ b/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/jcr/lists/NodeViewerComparator.java @@ -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: * // 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); */ 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 +}