1 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 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 getColumnText(Object element, int columnIndex) { 37 if (element == null || !(element instanceof IMarker) 38 || properties == null || columnIndex >= properties.length) { 39 return ""; } 41 42 return properties[columnIndex].getValue(element); 43 } 44 } 45 | Popular Tags |