public void dispose() {
}
});
workingsetComboViewer.setLabelProvider(new LabelProvider() {
private ResourceManager images = new LocalResourceManager(JFaceResources.getResources());
@SuppressWarnings("deprecation")
public Image getImage(Object element) {
if(element instanceof IWorkingSet) {
ImageDescriptor imageDescriptor = ((IWorkingSet) element).getImage();
if(imageDescriptor != null) {
try {
return (Image) images.create(imageDescriptor);
} catch(DeviceResourceException ex) {
return null;
}
}
}
return super.getImage(element);
}
public String getText(Object element) {
if(element instanceof IWorkingSet) {
return ((IWorkingSet) element).getLabel();
} else if(element instanceof List<?>) {
StringBuffer sb = new StringBuffer();
for(Object o : (List<?>) element) {
if(o instanceof IWorkingSet) {
if(sb.length() > 0) {
sb.append(", "); //$NON-NLS-1$
}
sb.append(((IWorkingSet) o).getLabel());
}
}
return sb.toString();
}
return super.getText(element);
}
public void dispose() {
images.dispose();
super.dispose();
}
});
workingsetComboViewer.setComparator(new ViewerComparator());