use of org.eclipse.ui.model.IWorkbenchAdapter in project jbosstools-hibernate by jbosstools.
the class AnyAdaptableLabelProvider method getText.
/* (non-Javadoc)
* Method declared on ILabelProvider
*/
public final String getText(Object element) {
// query the element for its label
IWorkbenchAdapter adapter = getAdapter(element);
if (element instanceof String) {
return (String) element;
}
if (adapter == null) {
String out = NLS.bind(HibernateConsoleMessages.AnyAdaptableLabelProvider_unknown, element.getClass().getName(), element);
return out;
}
String label = adapter.getLabel(element);
// return the decorated label
return decorateText(label, element);
}
use of org.eclipse.ui.model.IWorkbenchAdapter in project jbosstools-hibernate by jbosstools.
the class AnyAdaptableLabelProvider method getImage.
/* (non-Javadoc)
* Method declared on ILabelProvider
*/
public final Image getImage(Object element) {
// obtain the base image by querying the element
IWorkbenchAdapter adapter = getAdapter(element);
ImageDescriptor descriptor = null;
if (adapter == null) {
descriptor = EclipseImages.getImageDescriptor(ImageConstants.ERROR);
} else {
descriptor = adapter.getImageDescriptor(element);
}
if (descriptor == null) {
return null;
}
// add any annotations to the image descriptor
descriptor = decorateImage(descriptor, element);
return resourceManager.createImage(descriptor);
}
use of org.eclipse.ui.model.IWorkbenchAdapter in project core by jcryptool.
the class FileExplorerLabelProvider method getText.
/*
* (non-Javadoc) Method declared on ILabelProvider
*/
public final String getText(Object element) {
// query the element for its label
IWorkbenchAdapter adapter = getAdapter(element);
if (adapter == null) {
// $NON-NLS-1$
return "";
}
String label = adapter.getLabel(element);
// $NON-NLS-1$
return decorateText(label.equals("") ? ((IFileStore) element).toString() : label, element);
// changed to display drive labels - end
}
use of org.eclipse.ui.model.IWorkbenchAdapter in project core by jcryptool.
the class FileExplorerLabelProvider method getImage.
/*
* (non-Javadoc) Method declared on ILabelProvider
*/
public final Image getImage(Object element) {
// obtain the base image by querying the element
IWorkbenchAdapter adapter = getAdapter(element);
if (adapter == null) {
return null;
}
ImageDescriptor descriptor = adapter.getImageDescriptor(element);
if (descriptor == null) {
return null;
}
// add any annotations to the image descriptor
descriptor = decorateImage(descriptor, element);
return (Image) resourceManager.get(descriptor);
}
use of org.eclipse.ui.model.IWorkbenchAdapter in project ecf by eclipse.
the class MultiRosterLabelProvider method getImage.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
*/
public Image getImage(Object element) {
IWorkbenchAdapter adapter = getAdapter(element);
if (adapter == null)
return null;
ImageDescriptor descriptor = adapter.getImageDescriptor(element);
if (descriptor == null)
return null;
Image image = (Image) imageTable.get(descriptor);
if (image == null) {
image = descriptor.createImage();
imageTable.put(descriptor, image);
}
return image;
}
Aggregations