use of org.eclipse.ecf.provider.xmpp.XMPPContainer in project ecf by eclipse.
the class XMPPHyperlink method getContainers.
protected IContainer[] getContainers() {
final IContainerManager manager = Activator.getDefault().getContainerManager();
if (manager == null)
return EMPTY;
final List results = new ArrayList();
final IContainer[] containers = manager.getAllContainers();
for (int i = 0; i < containers.length; i++) {
final ID connectedID = containers[i].getConnectedID();
// Must be connected and ID of correct type
if (connectedID != null && ((isXMPPS && containers[i] instanceof XMPPSContainer) || (!isXMPPS && containers[i] instanceof XMPPContainer)))
results.add(containers[i]);
}
return (IContainer[]) results.toArray(EMPTY);
}
use of org.eclipse.ecf.provider.xmpp.XMPPContainer in project ecf by eclipse.
the class XMPPContainerInstantiator method createInstance.
/*
* (non-Javadoc)
*
* @seeorg.eclipse.ecf.core.provider.IContainerInstantiator#createInstance(
* ContainerDescription, java.lang.Object[])
*/
public IContainer createInstance(ContainerTypeDescription description, Object[] args) throws ContainerCreateException {
try {
Integer ka = new Integer(XMPPContainer.DEFAULT_KEEPALIVE);
String name = null;
if (args != null) {
if (args.length > 0) {
name = (String) args[0];
if (args.length > 1) {
ka = getIntegerFromArg(args[1]);
}
}
}
if (name == null) {
if (ka == null) {
return new XMPPContainer();
} else {
return new XMPPContainer(ka.intValue());
}
} else {
if (ka == null) {
ka = new Integer(XMPPContainer.DEFAULT_KEEPALIVE);
}
return new XMPPContainer(name, ka.intValue());
}
} catch (Exception e) {
throw new ContainerCreateException("Exception creating generic container", e);
}
}
use of org.eclipse.ecf.provider.xmpp.XMPPContainer in project ecf by eclipse.
the class XMPPCompoundContributionItem method getContributionItems.
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);
return contributions;
} else {
return EMPTY_ARRAY;
}
}
Aggregations