KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > ui > launchConfigurations > TargetTableLabelProvider


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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 package org.eclipse.ant.internal.ui.launchConfigurations;
12
13 import org.eclipse.ant.internal.ui.model.AntModelLabelProvider;
14 import org.eclipse.ant.internal.ui.model.AntTargetNode;
15 import org.eclipse.jface.viewers.ITableLabelProvider;
16 import org.eclipse.swt.graphics.Image;
17
18 /**
19  * Ant target label provider for a table
20  */

21 public class TargetTableLabelProvider extends AntModelLabelProvider implements ITableLabelProvider {
22     
23     /* (non-Javadoc)
24      * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
25      */

26     public Image getColumnImage(Object JavaDoc element, int columnIndex) {
27         if (columnIndex == 0) {
28             return getImage(element);
29         }
30         return null;
31     }
32
33     /* (non-Javadoc)
34      * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
35      */

36     public String JavaDoc getColumnText(Object JavaDoc element, int columnIndex) {
37         if (columnIndex == 0){
38             return getText(element);
39         }
40         String JavaDoc desc= ((AntTargetNode)element).getTarget().getDescription();
41         if (desc == null) {
42             return ""; //$NON-NLS-1$
43
}
44         return desc;
45     }
46 }
47
Popular Tags