use of org.eclipse.ecf.discovery.ui.model.IItemStatusLineProvider in project ecf by eclipse.
the class AdapterFactoryStatuslineProvider method selectionChanged.
/*
* (non-Javadoc)
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
*/
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
EObject object = (EObject) ss.getFirstElement();
if (object != null) {
// do we really have a selection?
IItemStatusLineProvider itemStatusLineProvider = (IItemStatusLineProvider) adapterFactory.adapt(object, IItemStatusLineProvider.class);
if (itemStatusLineProvider != null) {
statusline.setMessage(itemStatusLineProvider.getStatusLineText(object));
} else {
// fallback to IItemLabelProvider.getText(..)
IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory.adapt(object, IItemLabelProvider.class);
if (itemLabelProvider != null) {
statusline.setMessage(itemLabelProvider.getText(object));
}
}
}
} else {
// $NON-NLS-1$
statusline.setMessage("");
}
}
Aggregations