X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FViewerCellReference.java;h=80f41fbd7bff0d93811bc8bf2db68b930702c736;hp=39e318e32bd0a58db96601ce9308ad074db22232;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/ViewerCellReference.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/ViewerCellReference.java index 39e318e32..80f41fbd7 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/ViewerCellReference.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/ViewerCellReference.java @@ -1,66 +1,66 @@ -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 - * - */ -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); - } -} +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 + * + */ +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); + } +}