1 11 package org.eclipse.debug.internal.ui.views.breakpoints; 12 13 import org.eclipse.core.runtime.IAdaptable; 14 import org.eclipse.jface.resource.ImageDescriptor; 15 import org.eclipse.swt.graphics.FontData; 16 import org.eclipse.swt.graphics.RGB; 17 import org.eclipse.ui.model.IWorkbenchAdapter; 18 import org.eclipse.ui.model.IWorkbenchAdapter2; 19 20 23 public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, IWorkbenchAdapter2{ 24 25 28 public Object [] getChildren(Object o) { 29 return null; 31 } 32 33 36 public ImageDescriptor getImageDescriptor(Object object) { 37 if (object instanceof BreakpointContainer) { 38 BreakpointContainer container = (BreakpointContainer) object; 39 IAdaptable category = container.getCategory(); 40 IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class); 41 if (adapter != null) { 42 return adapter.getImageDescriptor(category); 43 } 44 return container.getOrganizer().getImageDescriptor(); 45 } 46 return null; 47 } 48 49 52 public String getLabel(Object object) { 53 if (object instanceof BreakpointContainer) { 54 BreakpointContainer container = (BreakpointContainer) object; 55 IAdaptable category = container.getCategory(); 56 IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class); 57 if (adapter != null) { 58 return adapter.getLabel(category); 59 } 60 return container.getOrganizer().getLabel(); 61 } 62 return ""; } 64 65 68 public Object getParent(Object o) { 69 return null; 70 } 71 72 75 public RGB getForeground(Object object) { 76 if (object instanceof BreakpointContainer) { 77 BreakpointContainer container = (BreakpointContainer) object; 78 IAdaptable category = container.getCategory(); 79 IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class); 80 if (adapter != null) { 81 return adapter.getForeground(category); 82 } 83 } 84 return null; 85 } 86 87 90 public RGB getBackground(Object object) { 91 if (object instanceof BreakpointContainer) { 92 BreakpointContainer container = (BreakpointContainer) object; 93 IAdaptable category = container.getCategory(); 94 IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class); 95 if (adapter != null) { 96 return adapter.getBackground(category); 97 } 98 } 99 return null; 100 } 101 102 105 public FontData getFont(Object object) { 106 if (object instanceof BreakpointContainer) { 107 BreakpointContainer container = (BreakpointContainer) object; 108 IAdaptable category = container.getCategory(); 109 IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class); 110 if (adapter != null) { 111 return adapter.getFont(category); 112 } 113 } 114 return null; 115 } 116 117 } 118 | Popular Tags |