]>
git.argeo.org Git - gpl/argeo-slc.git/blob - plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/model/ResultItemsComparer.java
1 package org
.argeo
.slc
.client
.ui
.model
;
3 import javax
.jcr
.RepositoryException
;
5 import org
.argeo
.slc
.SlcException
;
6 import org
.eclipse
.jface
.viewers
.IElementComparer
;
9 * Override default behaviour to insure that 2 distincts results that have the
10 * same name will be correctly and distincly returned by corresponding
11 * TreeViewer.getSelection() method.
14 public class ResultItemsComparer
implements IElementComparer
{
15 // private final static Log log =
16 // LogFactory.getLog(ResultItemsComparer.class);
18 public boolean equals(Object a
, Object b
) {
20 return a
== null ?
true : false;
22 if (a
.hashCode() != b
.hashCode() || !a
.getClass().equals(b
.getClass()))
24 else if (a
instanceof SingleResultNode
) {
26 String ida
= ((SingleResultNode
) a
).getNode().getIdentifier();
28 String idb
= ((SingleResultNode
) b
).getNode().getIdentifier();
35 } catch (RepositoryException e
) {
36 throw new SlcException("Cannot compare single reult nodes", e
);
42 public int hashCode(Object element
) {
43 return element
.hashCode();