KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > views > markers > internal > MarkerLabelProvider


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.ui.views.markers.internal;
13
14 import org.eclipse.core.resources.IMarker;
15 import org.eclipse.jface.viewers.ITableLabelProvider;
16 import org.eclipse.jface.viewers.LabelProvider;
17 import org.eclipse.swt.graphics.Image;
18
19 class MarkerLabelProvider extends LabelProvider implements ITableLabelProvider {
20
21     IField[] properties;
22
23     public MarkerLabelProvider(IField[] properties) {
24         this.properties = properties;
25     }
26
27     public Image getColumnImage(Object JavaDoc element, int columnIndex) {
28         if (element == null || !(element instanceof IMarker)
29                 || properties == null || columnIndex >= properties.length) {
30             return null;
31         }
32
33         return properties[columnIndex].getImage(element);
34     }
35
36     public String JavaDoc getColumnText(Object JavaDoc element, int columnIndex) {
37         if (element == null || !(element instanceof IMarker)
38                 || properties == null || columnIndex >= properties.length) {
39             return ""; //$NON-NLS-1$
40
}
41
42         return properties[columnIndex].getValue(element);
43     }
44 }
45
Popular Tags