Search in sources :

Example 16 with IContainerEvent

use of org.eclipse.ecf.core.events.IContainerEvent in project ecf by eclipse.

the class XMPPConnectWizard method performFinish.

public boolean performFinish() {
    final String connectID = page.getConnectID();
    final String password = page.getPassword();
    // Save combo text even if we don't successfully login
    page.saveComboText();
    connectContext = createConnectContext();
    try {
        targetID = IDFactory.getDefault().createID(container.getConnectNamespace(), connectID);
    } catch (final IDCreateException e) {
        new IDCreateErrorDialog(null, connectID, e).open();
        return false;
    }
    // Save combo items if targetID created successfully
    page.saveComboItems();
    final IPresenceContainerAdapter adapter = (IPresenceContainerAdapter) container.getAdapter(IPresenceContainerAdapter.class);
    container.addListener(new IContainerListener() {

        public void handleEvent(IContainerEvent event) {
            if (event instanceof IContainerConnectedEvent) {
                Display.getDefault().asyncExec(new Runnable() {

                    public void run() {
                        openView();
                    }
                });
            }
        }
    });
    final IChatManager icm = adapter.getChatManager();
    icms = icm.getChatMessageSender();
    itms = icm.getTypingMessageSender();
    icm.addMessageListener(new IIMMessageListener() {

        public void handleMessageEvent(IIMMessageEvent e) {
            if (e instanceof IChatMessageEvent) {
                displayMessage((IChatMessageEvent) e);
            } else if (e instanceof ITypingMessageEvent) {
                displayTypingNotification((ITypingMessageEvent) e);
            }
        }
    });
    final ISendFileTransferContainerAdapter ioftca = (ISendFileTransferContainerAdapter) container.getAdapter(ISendFileTransferContainerAdapter.class);
    ioftca.addListener(requestListener);
    // Connect
    new AsynchContainerConnectAction(container, targetID, connectContext, null, new Runnable() {

        public void run() {
            cachePassword(connectID, password);
        }
    }).run();
    return true;
}
Also used : IContainerEvent(org.eclipse.ecf.core.events.IContainerEvent) IContainerConnectedEvent(org.eclipse.ecf.core.events.IContainerConnectedEvent) IDCreateErrorDialog(org.eclipse.ecf.ui.dialogs.IDCreateErrorDialog) AsynchContainerConnectAction(org.eclipse.ecf.ui.actions.AsynchContainerConnectAction)

Aggregations

IContainerEvent (org.eclipse.ecf.core.events.IContainerEvent)16 IServiceInfo (org.eclipse.ecf.discovery.IServiceInfo)8 IServiceEvent (org.eclipse.ecf.discovery.IServiceEvent)6 Properties (java.util.Properties)5 IContainerListener (org.eclipse.ecf.core.IContainerListener)5 BundleContext (org.osgi.framework.BundleContext)5 ServiceRegistration (org.osgi.framework.ServiceRegistration)5 IContainerConnectedEvent (org.eclipse.ecf.core.events.IContainerConnectedEvent)4 IServiceListener (org.eclipse.ecf.discovery.IServiceListener)4 TestServiceListener (org.eclipse.ecf.tests.discovery.listener.TestServiceListener)4 ThreadTestServiceListener (org.eclipse.ecf.tests.discovery.listener.ThreadTestServiceListener)4 IContainerDisconnectedEvent (org.eclipse.ecf.core.events.IContainerDisconnectedEvent)3 TestServiceTypeListener (org.eclipse.ecf.tests.discovery.listener.TestServiceTypeListener)3 HashSet (java.util.HashSet)2 AsynchContainerConnectAction (org.eclipse.ecf.ui.actions.AsynchContainerConnectAction)2 IDCreateErrorDialog (org.eclipse.ecf.ui.dialogs.IDCreateErrorDialog)2 Collection (java.util.Collection)1 Set (java.util.Set)1 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)1 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)1