1 11 package org.eclipse.debug.internal.ui.views.breakpoints; 12 13 import org.eclipse.core.runtime.PlatformObject; 14 import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages; 15 import org.eclipse.jface.resource.ImageDescriptor; 16 import org.eclipse.jface.resource.JFaceResources; 17 import org.eclipse.swt.SWT; 18 import org.eclipse.swt.graphics.FontData; 19 import org.eclipse.swt.graphics.RGB; 20 import org.eclipse.ui.IWorkingSet; 21 import org.eclipse.ui.model.IWorkbenchAdapter; 22 import org.eclipse.ui.model.IWorkbenchAdapter2; 23 24 27 public class WorkingSetCategory extends PlatformObject implements IWorkbenchAdapter, IWorkbenchAdapter2 { 28 29 private IWorkingSet fWorkingSet; 30 31 36 public WorkingSetCategory(IWorkingSet workingSet) { 37 fWorkingSet = workingSet; 38 } 39 40 43 public Object [] getChildren(Object o) { 44 return null; 45 } 46 47 50 public ImageDescriptor getImageDescriptor(Object object) { 51 return fWorkingSet.getImageDescriptor(); 52 } 53 54 57 public String getLabel(Object o) { 58 StringBuffer name = new StringBuffer (fWorkingSet.getName()); 59 if (isDefault()) { 60 name.append(DebugUIViewsMessages.WorkingSetCategory_0); 61 } 62 return name.toString(); 63 } 64 65 68 public Object getParent(Object o) { 69 return null; 70 } 71 72 77 public IWorkingSet getWorkingSet() { 78 return fWorkingSet; 79 } 80 81 84 public boolean equals(Object obj) { 85 if (obj instanceof WorkingSetCategory) { 86 WorkingSetCategory category = (WorkingSetCategory) obj; 87 return category.getWorkingSet().equals(fWorkingSet); 88 } 89 return false; 90 } 91 92 95 public int hashCode() { 96 return fWorkingSet.hashCode(); 97 } 98 99 102 public RGB getForeground(Object element) { 103 return null; 104 } 105 106 109 public RGB getBackground(Object element) { 110 return null; 111 } 112 113 116 public FontData getFont(Object element) { 117 if (isDefault()) { 118 FontData[] fontData = JFaceResources.getDefaultFont().getFontData(); 119 if (fontData != null && fontData.length > 0) { 120 FontData data = fontData[0]; 121 data.setStyle(SWT.BOLD); 122 return data; 123 } 124 } 125 return null; 126 } 127 128 133 private boolean isDefault() { 134 return fWorkingSet.equals(BreakpointSetOrganizer.getDefaultWorkingSet()); 135 } 136 } 137 138 | Popular Tags |