use of org.eclipse.emf.edit.provider.IItemLabelProvider 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("");
}
}
use of org.eclipse.emf.edit.provider.IItemLabelProvider in project InformationSystem by ObeoNetwork.
the class UtilServices method getLabel.
public String getLabel(EObject object) {
ComposedAdapterFactory composeable = new ComposedAdapterFactory();
composeable.addAdapterFactory(dbEvolution);
composeable.addAdapterFactory(compare);
composeable.addAdapterFactory(database);
composeable.addAdapterFactory(library);
IItemLabelProvider provider = (IItemLabelProvider) composeable.adapt(object, IItemLabelProvider.class);
if (provider != null) {
return provider.getText(object);
}
return "";
}
use of org.eclipse.emf.edit.provider.IItemLabelProvider in project InformationSystem by ObeoNetwork.
the class TransitionItemProvider method addNodeLabeltoTransitionLabel.
/**
* Add the label for the source or target node of a transition inside this transition's label
* @param node
* @param transitionLabel
*/
private void addNodeLabeltoTransitionLabel(Node node, StringBuilder transitionLabel) {
String nodeLabel = null;
if (node != null) {
IItemLabelProvider sourceLabelProvider = (IItemLabelProvider) getRootAdapterFactory().adapt(node, IItemLabelProvider.class);
nodeLabel = sourceLabelProvider.getText(node);
}
if (nodeLabel != null) {
transitionLabel.append(nodeLabel);
} else {
transitionLabel.append("?");
}
}
Aggregations