-/*******************************************************************************\r
- * Copyright (c) 2007, 2012 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.browsing.ui.swt.inputs;\r
-\r
-import org.eclipse.core.runtime.IAdaptable;\r
-\r
-/**\r
- * An equals-comparable and adaptable container for a single datum. The datum\r
- * may be <code>null</code>. Adaptability is provided through {@link IAdaptable}\r
- * .\r
- * \r
- * @author Tuukka Lehtonen\r
- * \r
- * @param <T> the type of the datum\r
- */\r
-public class Datum<T> implements IAdaptable {\r
-\r
- protected final T datum;\r
-\r
- public Datum(T datum) {\r
- this.datum = datum;\r
- }\r
-\r
- public T getDatum() {\r
- return datum;\r
- }\r
-\r
- @SuppressWarnings({ "unchecked", "rawtypes" })\r
- @Override\r
- public Object getAdapter(Class adapter) {\r
- if (datum != null) {\r
- if (adapter.isAssignableFrom(datum.getClass()))\r
- return datum;\r
- if (datum instanceof IAdaptable)\r
- return ((IAdaptable) datum).getAdapter(adapter);\r
- }\r
- return null;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- return datum != null ? datum.hashCode() : 0;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj)\r
- return true;\r
- if (obj == null)\r
- return false;\r
- if (getClass() != obj.getClass())\r
- return false;\r
- Datum<?> other = (Datum<?>) obj;\r
- if (datum == null)\r
- return datum == other.datum;\r
- return datum.equals(other.datum);\r
- }\r
-\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.browsing.ui.swt.inputs;
+
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * An equals-comparable and adaptable container for a single datum. The datum
+ * may be <code>null</code>. Adaptability is provided through {@link IAdaptable}
+ * .
+ *
+ * @author Tuukka Lehtonen
+ *
+ * @param <T> the type of the datum
+ */
+public class Datum<T> implements IAdaptable {
+
+ protected final T datum;
+
+ public Datum(T datum) {
+ this.datum = datum;
+ }
+
+ public T getDatum() {
+ return datum;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (datum != null) {
+ if (adapter.isAssignableFrom(datum.getClass()))
+ return datum;
+ if (datum instanceof IAdaptable)
+ return ((IAdaptable) datum).getAdapter(adapter);
+ }
+ return null;
+ }
+
+ @Override
+ public int hashCode() {
+ return datum != null ? datum.hashCode() : 0;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Datum<?> other = (Datum<?>) obj;
+ if (datum == null)
+ return datum == other.datum;
+ return datum.equals(other.datum);
+ }
+