1 11 package org.eclipse.debug.internal.ui.model.elements; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; 15 import org.eclipse.debug.internal.ui.views.DebugModelPresentationContext; 16 import org.eclipse.debug.internal.ui.views.launch.DebugElementHelper; 17 import org.eclipse.jface.resource.ImageDescriptor; 18 import org.eclipse.jface.viewers.TreePath; 19 import org.eclipse.swt.graphics.FontData; 20 import org.eclipse.swt.graphics.RGB; 21 22 25 public class DebugElementLabelProvider extends ElementLabelProvider { 26 27 protected String getLabel(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException { 28 Object element = elementPath.getLastSegment(); 29 if (presentationContext instanceof DebugModelPresentationContext) { 30 DebugModelPresentationContext debugContext = (DebugModelPresentationContext) presentationContext; 31 return debugContext.getModelPresentation().getText(element); 32 } 33 return DebugElementHelper.getLabel(element); 34 } 35 36 protected RGB getBackground(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException { 37 Object element = elementPath.getLastSegment(); 38 if (presentationContext instanceof DebugModelPresentationContext) { 39 DebugModelPresentationContext debugContext = (DebugModelPresentationContext) presentationContext; 40 return DebugElementHelper.getBackground(element, debugContext.getModelPresentation()); 41 } 42 return DebugElementHelper.getBackground(element); 43 } 44 45 protected FontData getFontData(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException { 46 Object element = elementPath.getLastSegment(); 47 if (presentationContext instanceof DebugModelPresentationContext) { 48 DebugModelPresentationContext debugContext = (DebugModelPresentationContext) presentationContext; 49 return DebugElementHelper.getFont(element, debugContext.getModelPresentation()); 50 51 } 52 return DebugElementHelper.getFont(element); 53 } 54 55 protected RGB getForeground(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException { 56 Object element = elementPath.getLastSegment(); 57 if (presentationContext instanceof DebugModelPresentationContext) { 58 DebugModelPresentationContext debugContext = (DebugModelPresentationContext) presentationContext; 59 return DebugElementHelper.getForeground(element, debugContext.getModelPresentation()); 60 } 61 return DebugElementHelper.getForeground(element); 62 } 63 64 protected ImageDescriptor getImageDescriptor(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException { 65 Object element = elementPath.getLastSegment(); 66 if (presentationContext instanceof DebugModelPresentationContext) { 67 DebugModelPresentationContext debugContext = (DebugModelPresentationContext) presentationContext; 68 return DebugElementHelper.getImageDescriptor(element, debugContext.getModelPresentation()); 69 } 70 return DebugElementHelper.getImageDescriptor(element); 71 } 72 73 74 75 } 76 | Popular Tags |