protected IContributionItem[] getContributionItems() {
final Object selection = getSelection();
if (!(selection instanceof IRosterEntry)) {
return EMPTY_ARRAY;
}
final IRosterEntry entry = (IRosterEntry) selection;
final IContainer container = getContainerForRosterEntry(entry);
if (container instanceof XMPPContainer) {
final IContributionItem[] contributions = new IContributionItem[1];
final ISendFileTransferContainerAdapter ioftca = (ISendFileTransferContainerAdapter) container.getAdapter(ISendFileTransferContainerAdapter.class);
if (!(ioftca != null && isAvailable(entry)))
return EMPTY_ARRAY;
final IAction fileSendAction = new Action() {
public void run() {
sendFileToTarget(ioftca, entry.getUser().getID());
}
};
fileSendAction.setText(Messages.XMPPCompoundContributionItem_SEND_FILE);
fileSendAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FILE));
contributions[0] = new ActionContributionItem(fileSendAction);