1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
13 * Created on 15.12.2005
16 package org.simantics.utils.ui.jface;
20 import org.eclipse.jface.viewers.ILabelProvider;
21 import org.eclipse.jface.viewers.ILabelProviderListener;
22 import org.eclipse.jface.viewers.ITableLabelProvider;
23 import org.eclipse.swt.graphics.Image;
28 * Label provider for Map<String, String>
31 public class StringPairLabelProvider implements ITableLabelProvider, ILabelProvider {
33 private final Map<String, String> data;
35 public StringPairLabelProvider(Map<String, String> data) {
39 public Image getColumnImage(Object element, int columnIndex) {
43 public String getColumnText(Object element, int columnIndex) {
44 if (columnIndex==0) return element.toString();
45 return data.get(element.toString());
48 public void addListener(ILabelProviderListener listener) {
51 public void dispose() {
54 public boolean isLabelProperty(Object element, String property) {
58 public void removeListener(ILabelProviderListener listener) {
61 public Image getImage(Object element) {
65 public String getText(Object element) {
66 return element.toString();