X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2Fcontentassist%2FNamedObject.java;h=b6a05a49e2ddf816a965b6aadbe8aa12001cbac4;hb=HEAD;hp=8e122b7b8687a5ef8bfe268ad43b98b5c52aa3be;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/contentassist/NamedObject.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/contentassist/NamedObject.java index 8e122b7b8..b6a05a49e 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/contentassist/NamedObject.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/contentassist/NamedObject.java @@ -1,86 +1,86 @@ -/******************************************************************************* - * 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 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 + "]"; - } - -} +/******************************************************************************* + * 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 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 + "]"; + } + +}