/******************************************************************************* | |
* Copyright (c) 2000, 2010 IBM Corporation, See4sys and others. | |
* 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: | |
* IBM Corporation - initial API and implementation | |
* See4sys - added support for problem markers on model objects (rather than | |
* only on workspace resources). Unfortunately, there was no other | |
* choice than copying the whole code from | |
* org.eclipse.ui.views.markers.internal for that purpose because | |
* many of the relevant classes, methods, and fields are private or | |
* package private. | |
*******************************************************************************/ | |
package org.eclipse.sphinx.emf.validation.ui.views; | |
import org.eclipse.jface.viewers.ColumnLabelProvider; | |
import org.eclipse.swt.graphics.Image; | |
/** | |
* The MarkerViewLabelProvider is a label provider for an individual field. | |
* | |
* @since 0.7.0 | |
*/ | |
public class MarkerViewLabelProvider extends ColumnLabelProvider { | |
IField field; | |
/** | |
* Create a MarkerViewLabelProvider on a field | |
* | |
* @param field | |
*/ | |
MarkerViewLabelProvider(IField field) { | |
this.field = field; | |
} | |
/* | |
* (non-Javadoc) | |
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object) | |
*/ | |
@Override | |
public String getText(Object element) { | |
return field.getValue(element); | |
} | |
/* | |
* (non-Javadoc) | |
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object) | |
*/ | |
@Override | |
public Image getImage(Object element) { | |
return field.getImage(element); | |
} | |
} |