1 11 package org.eclipse.debug.internal.ui.sourcelookup; 12 13 import org.eclipse.core.resources.IResource; 14 import org.eclipse.jface.viewers.ILabelProvider; 15 import org.eclipse.jface.viewers.LabelProvider; 16 import org.eclipse.swt.graphics.Image; 17 import org.eclipse.ui.model.WorkbenchLabelProvider; 18 19 24 public class SourceElementLabelProvider extends LabelProvider { 25 26 private ILabelProvider fLabelProvider = null; 27 28 29 30 private ILabelProvider getWorkbenchLabelProvider() { 31 if (fLabelProvider == null) { 32 fLabelProvider = new WorkbenchLabelProvider(); 33 } 34 return fLabelProvider; 35 } 36 37 40 public void dispose() { 41 super.dispose(); 42 if (fLabelProvider != null) { 43 fLabelProvider.dispose(); 44 } 45 } 46 49 public Image getImage(Object element) { 50 return getWorkbenchLabelProvider().getImage(element); 51 } 52 55 public String getText(Object element) { 56 if (element instanceof IResource) { 57 return SourceElementWorkbenchAdapter.getQualifiedName(((IResource)element).getFullPath()); 58 } 59 return getWorkbenchLabelProvider().getText(element); 60 } 61 } 62 | Popular Tags |