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));