use of org.eclipse.ui.navigator.ICommonLabelProvider in project polymap4-core by Polymap4.
the class NavigatorContentServiceDescriptionProvider method getDescription.
public String getDescription(Object anElement) {
Object target;
if (anElement instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) anElement;
if (structuredSelection.size() > 1) {
return getDefaultStatusBarMessage(structuredSelection.size());
}
target = structuredSelection.getFirstElement();
} else {
target = anElement;
}
String message = null;
ILabelProvider[] providers = contentService.findRelevantLabelProviders(target);
if (providers.length == 0) {
return getDefaultStatusBarMessage(0);
}
for (int i = 0; i < providers.length && (message == null || message.length() == 0); i++) {
if (providers[i] instanceof ICommonLabelProvider) {
message = ((ICommonLabelProvider) providers[i]).getDescription(target);
}
}
message = (message != null) ? message : getDefaultStatusBarMessage(1);
return message;
}
use of org.eclipse.ui.navigator.ICommonLabelProvider in project tmdm-studio-se by Talend.
the class MDMNavigatorDecoratingLabelProvider method getToolTipText.
@Override
public String getToolTipText(Object element) {
if (getViewer() instanceof CommonViewer) {
CommonViewer viewer = (CommonViewer) getViewer();
INavigatorContentService contentService = viewer.getNavigatorContentService();
if (contentService != null && contentService instanceof NavigatorContentService) {
Collection<?> contentExtensions = ((NavigatorContentService) contentService).findPossibleLabelExtensions(element);
for (Iterator<?> itr = contentExtensions.iterator(); itr.hasNext(); ) {
Object extension = itr.next();
if (extension instanceof NavigatorContentExtension) {
ICommonLabelProvider provider = ((NavigatorContentExtension) extension).getLabelProvider();
if (provider instanceof CellLabelProvider) {
String toolTipText = ((CellLabelProvider) provider).getToolTipText(element);
if (toolTipText != null) {
return toolTipText;
}
}
}
}
}
}
return super.getToolTipText(element);
}
use of org.eclipse.ui.navigator.ICommonLabelProvider in project polymap4-core by Polymap4.
the class NavigatorContentServiceLabelProvider method findImage.
/**
* Search for image and take overrides into account.
* Uses only simple ITreeContentProvider.getParent() style semantics.
*/
private Image findImage(NavigatorContentExtension foundExtension, Object anElement, int aColumn) {
Image image = null;
ICommonLabelProvider provider = foundExtension.getLabelProvider();
if (provider instanceof ITableLabelProvider && aColumn >= 0)
image = ((ITableLabelProvider) provider).getColumnImage(anElement, aColumn);
else
image = provider.getImage(anElement);
return image;
}
Aggregations