01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.views.markers.internal;
11:
12: import org.eclipse.core.resources.IMarker;
13: import org.eclipse.jface.viewers.ITableLabelProvider;
14: import org.eclipse.jface.viewers.LabelProvider;
15: import org.eclipse.swt.graphics.Image;
16:
17: class MarkerLabelProvider extends LabelProvider implements
18: ITableLabelProvider {
19:
20: IField[] properties;
21:
22: public MarkerLabelProvider(IField[] properties) {
23: this .properties = properties;
24: }
25:
26: public Image getColumnImage(Object element, int columnIndex) {
27: if (element == null || !(element instanceof IMarker)
28: || properties == null
29: || columnIndex >= properties.length) {
30: return null;
31: }
32:
33: return properties[columnIndex].getImage(element);
34: }
35:
36: public String getColumnText(Object element, int columnIndex) {
37: if (element == null || !(element instanceof IMarker)
38: || properties == null
39: || columnIndex >= properties.length) {
40: return ""; //$NON-NLS-1$
41: }
42:
43: return properties[columnIndex].getValue(element);
44: }
45: }
|