1 package org.simantics.browsing.ui.swt;
3 import org.eclipse.jface.viewers.ViewerCell;
4 import org.eclipse.jface.viewers.ViewerRow;
5 import org.simantics.browsing.ui.common.internal.UIElementReference;
7 public class ViewerRowReference implements UIElementReference{
9 private final Object element;
11 public static ViewerRowReference create(ViewerCell cell) {
12 return new ViewerRowReference(cell.getViewerRow());
15 public static ViewerRowReference create(ViewerRow row) {
16 return new ViewerRowReference(row);
19 public static ViewerRowReference create(Object element) {
20 return new ViewerRowReference(element);
23 private ViewerRowReference(ViewerRow row) {
24 this.element = row.getElement();
27 private ViewerRowReference(Object element) {
28 this.element = element;
32 public boolean hasReference() {
33 return element != null;
37 public boolean isDisposed() {
43 public Object getElement() {
48 public int hashCode() {
50 return element.hashCode();
55 public boolean equals(Object obj) {
58 if (obj.getClass() != getClass())
62 ViewerRowReference other = (ViewerRowReference)obj;
63 return element.equals(other.element);