1 11 12 package org.eclipse.ui.views.markers.internal; 13 14 import org.eclipse.jface.resource.JFaceResources; 15 import org.eclipse.jface.viewers.IFontProvider; 16 import org.eclipse.jface.viewers.ITableLabelProvider; 17 import org.eclipse.jface.viewers.LabelProvider; 18 import org.eclipse.swt.graphics.Font; 19 import org.eclipse.swt.graphics.Image; 20 21 25 public class TableViewLabelProvider extends LabelProvider implements 26 ITableLabelProvider, IFontProvider { 27 28 IField[] fields; 29 30 35 public TableViewLabelProvider(IField[] fields) { 36 this.fields = fields; 37 } 38 39 45 public Image getColumnImage(Object element, int columnIndex) { 46 if (fields == null || columnIndex < 0 || columnIndex >= fields.length) { 47 return null; 48 } 49 return fields[columnIndex].getImage(element); 50 } 51 52 58 public String getColumnText(Object element, int columnIndex) { 59 if (fields == null || columnIndex < 0 || columnIndex >= fields.length) { 60 return null; 61 } 62 return fields[columnIndex].getValue(element); 63 } 64 65 public Font getFont(Object element) { 66 MarkerNode node = (MarkerNode) element; 67 if (node.isConcrete()) { 68 return null; 69 } 70 return JFaceResources.getFontRegistry().getBold( 71 JFaceResources.DEFAULT_FONT); 72 } 73 74 } 75 | Popular Tags |