1 11 package org.eclipse.debug.internal.ui.viewers; 12 13 import org.eclipse.debug.internal.ui.viewers.provisional.ILabelRequestMonitor; 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.swt.widgets.Widget; 18 19 29 class LabelRequestMonitor extends AsynchronousRequestMonitor implements ILabelRequestMonitor { 30 31 34 private String [] fLabels; 35 36 39 private ImageDescriptor[] fImageDescriptors; 40 41 44 private FontData[] fFontDatas; 45 46 49 private RGB[] fForegrounds; 50 private RGB[] fBackgrounds; 51 52 59 public LabelRequestMonitor(ModelNode node, AsynchronousModel model) { 60 super(node, model); 61 } 62 63 68 protected void performUpdate() { 69 AsynchronousViewer viewer = getModel().getViewer(); 70 Widget widget = viewer.findItem(getNode()); 71 if (widget != null && !widget.isDisposed()) { 72 viewer.setLabels(widget, fLabels, fImageDescriptors); 73 viewer.setColors(widget, fForegrounds, fBackgrounds); 74 viewer.setFonts(widget, fFontDatas); 75 } 76 } 77 78 83 protected boolean contains(AsynchronousRequestMonitor update) { 84 return update instanceof LabelRequestMonitor && update.getNode() == getNode(); 85 } 86 87 92 public void setLabels(String [] text) { 93 fLabels = text; 94 } 95 96 101 public void setFontDatas(FontData[] fontData) { 102 fFontDatas = fontData; 103 } 104 105 110 public void setImageDescriptors(ImageDescriptor[] image) { 111 fImageDescriptors = image; 112 } 113 114 119 public void setForegrounds(RGB[] foreground) { 120 fForegrounds = foreground; 121 } 122 123 128 public void setBackgrounds(RGB[] background) { 129 fBackgrounds = background; 130 } 131 132 protected RGB[] getBackgrounds() { 133 return fBackgrounds; 134 } 135 136 protected RGB[] getForegrounds() { 137 return fForegrounds; 138 } 139 140 protected FontData[] getFontDatas() { 141 return fFontDatas; 142 } 143 144 protected String [] getLabels() { 145 return fLabels; 146 } 147 148 protected ImageDescriptor[] getImageDescriptors() { 149 return fImageDescriptors; 150 } 151 152 } 153 | Popular Tags |