1 /*******************************************************************************
\r
2 * Copyright (c) 2012 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.browsing.ui.swt;
\r
14 import java.util.Collections;
\r
15 import java.util.Map;
\r
17 import org.eclipse.jface.resource.ImageDescriptor;
\r
18 import org.simantics.browsing.ui.common.ColumnKeys;
\r
19 import org.simantics.browsing.ui.common.node.ConstantInput;
\r
21 final public class SWTConstantInput extends ConstantInput<ImageDescriptor> {
\r
23 final private static Map<String, ImageDescriptor> NO_IMAGES = Collections.emptyMap();
\r
25 public SWTConstantInput(Map<String, String> labels, Map<String, ImageDescriptor> imageDescriptors, int category) {
\r
26 super(labels, imageDescriptors, category);
\r
29 public static SWTConstantInput create(String label) {
\r
30 return new SWTConstantInput(Collections.singletonMap(ColumnKeys.SINGLE, label), NO_IMAGES, 0);
\r
33 public static SWTConstantInput create(String label, ImageDescriptor descriptor) {
\r
34 return new SWTConstantInput(Collections.singletonMap(ColumnKeys.SINGLE, label), Collections.singletonMap(ColumnKeys.SINGLE, descriptor), 0);
\r
38 public int hashCode() {
\r
39 return labels.hashCode() + 31 * imageDescriptors.hashCode() + 41 * category;
\r
43 public boolean equals(Object object) {
\r
46 else if (object == null)
\r
48 else if (SWTConstantInput.class != object.getClass())
\r
50 SWTConstantInput r = (SWTConstantInput)object;
\r
51 return r.labels.equals(labels) && r.imageDescriptors.equals(imageDescriptors) && r.category == category;
\r