-package org.simantics.browsing.ui.swt;\r
-\r
-import org.eclipse.jface.viewers.ViewerCell;\r
-import org.simantics.browsing.ui.common.internal.UIElementReference;\r
-\r
-/**\r
- * "Reference" to a viewer cell.\r
- * \r
- * ViewerCell is an object, which is not immutable, and has a very short lifespan. Hence we store its element and columnIndex.\r
- * \r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public class ViewerCellReference implements UIElementReference{\r
- \r
- private final Object element;\r
- private final int column;\r
- \r
- public static ViewerCellReference create(ViewerCell cell) {\r
- return new ViewerCellReference(cell);\r
- }\r
- \r
- private ViewerCellReference(ViewerCell cell) {\r
- this.element = cell.getElement();\r
- this.column = cell.getColumnIndex();\r
- }\r
- \r
- @Override\r
- public boolean hasReference() {\r
- return element != null;\r
- }\r
- \r
- @Override\r
- public boolean isDisposed() {\r
- if (element == null)\r
- return true;\r
- return false;\r
- }\r
- \r
- public Object getElement() {\r
- return element;\r
- }\r
- \r
- public int getColumn() {\r
- return column;\r
- }\r
- \r
- @Override\r
- public int hashCode() {\r
- return element.hashCode() + column;\r
- \r
- }\r
- \r
- @Override\r
- public boolean equals(Object obj) {\r
- if (obj == null)\r
- return false;\r
- if (obj.getClass() != getClass())\r
- return false;\r
- ViewerCellReference other = (ViewerCellReference)obj;\r
- if (column != other.column)\r
- return false;\r
- return element.equals(other.element);\r
- }\r
-}\r
+package org.simantics.browsing.ui.swt;
+
+import org.eclipse.jface.viewers.ViewerCell;
+import org.simantics.browsing.ui.common.internal.UIElementReference;
+
+/**
+ * "Reference" to a viewer cell.
+ *
+ * ViewerCell is an object, which is not immutable, and has a very short lifespan. Hence we store its element and columnIndex.
+ *
+ *
+ * @author Marko Luukkainen <marko.luukkainen@vtt.fi>
+ *
+ */
+public class ViewerCellReference implements UIElementReference{
+
+ private final Object element;
+ private final int column;
+
+ public static ViewerCellReference create(ViewerCell cell) {
+ return new ViewerCellReference(cell);
+ }
+
+ private ViewerCellReference(ViewerCell cell) {
+ this.element = cell.getElement();
+ this.column = cell.getColumnIndex();
+ }
+
+ @Override
+ public boolean hasReference() {
+ return element != null;
+ }
+
+ @Override
+ public boolean isDisposed() {
+ if (element == null)
+ return true;
+ return false;
+ }
+
+ public Object getElement() {
+ return element;
+ }
+
+ public int getColumn() {
+ return column;
+ }
+
+ @Override
+ public int hashCode() {
+ return element.hashCode() + column;
+
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null)
+ return false;
+ if (obj.getClass() != getClass())
+ return false;
+ ViewerCellReference other = (ViewerCellReference)obj;
+ if (column != other.column)
+ return false;
+ return element.equals(other.element);
+ }
+}