-/*******************************************************************************\r
- * Copyright (c) 2010, 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.contentassist;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class NamedObject<T> implements INamedObject {\r
-\r
- private final T object;\r
- private final String name;\r
- private final String label;\r
- private final String description;\r
-\r
- public NamedObject(T object, String name) {\r
- this(object, name, name);\r
- }\r
-\r
- public NamedObject(T object, String name, String label) {\r
- this(object, name, label, null);\r
- }\r
-\r
- public NamedObject(T object, String name, String label, String description) {\r
- this.object = object;\r
- this.name = name;\r
- this.label = label;\r
- this.description = description;\r
- }\r
-\r
- @Override\r
- public String getName() {\r
- return name;\r
- }\r
-\r
- public String getLabel() {\r
- return label;\r
- }\r
-\r
- public String getDescription() {\r
- return description;\r
- }\r
-\r
- public T getObject() {\r
- return object;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = 1;\r
- result = prime * result + ((object == null) ? 0 : object.hashCode());\r
- return result;\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
- NamedObject<?> other = (NamedObject<?>) obj;\r
- if (object == null) {\r
- if (other.object != null)\r
- return false;\r
- } else if (!object.equals(other.object))\r
- return false;\r
- return true;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return getClass().getSimpleName() + "[name=" + name + "]";\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2010, 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.contentassist;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class NamedObject<T> implements INamedObject {
+
+ private final T object;
+ private final String name;
+ private final String label;
+ private final String description;
+
+ public NamedObject(T object, String name) {
+ this(object, name, name);
+ }
+
+ public NamedObject(T object, String name, String label) {
+ this(object, name, label, null);
+ }
+
+ public NamedObject(T object, String name, String label, String description) {
+ this.object = object;
+ this.name = name;
+ this.label = label;
+ this.description = description;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public T getObject() {
+ return object;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((object == null) ? 0 : object.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ NamedObject<?> other = (NamedObject<?>) obj;
+ if (object == null) {
+ if (other.object != null)
+ return false;
+ } else if (!object.equals(other.object))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[name=" + name + "]";
+ }
+
+}