Search in sources :

Example 11 with IContainerConnectedEvent

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

the class SSLClientContainerConnectTest method createServerAndClients.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ecf.tests.connect.ContainerConnectTestCase#createServerAndClients()
	 */
protected void createServerAndClients() throws Exception {
    clientCount = 5;
    super.createServerAndClients();
    getServer().addListener(new IContainerListener() {

        public void handleEvent(IContainerEvent event) {
            if (event instanceof IContainerConnectedEvent)
                serverConnectEvents.add(event);
            if (event instanceof IContainerDisconnectedEvent)
                serverDisconnectEvents.add(event);
        }
    });
}
Also used : IContainerEvent(org.eclipse.ecf.core.events.IContainerEvent) IContainerDisconnectedEvent(org.eclipse.ecf.core.events.IContainerDisconnectedEvent) IContainerListener(org.eclipse.ecf.core.IContainerListener) IContainerConnectedEvent(org.eclipse.ecf.core.events.IContainerConnectedEvent)

Example 12 with IContainerConnectedEvent

use of org.eclipse.ecf.core.events.IContainerConnectedEvent 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

IContainerConnectedEvent (org.eclipse.ecf.core.events.IContainerConnectedEvent)12 IContainerDisconnectedEvent (org.eclipse.ecf.core.events.IContainerDisconnectedEvent)6 ISharedObjectActivatedEvent (org.eclipse.ecf.core.sharedobject.events.ISharedObjectActivatedEvent)5 IContainerEvent (org.eclipse.ecf.core.events.IContainerEvent)4 ISharedObjectDeactivatedEvent (org.eclipse.ecf.core.sharedobject.events.ISharedObjectDeactivatedEvent)4 ISharedObjectMessageEvent (org.eclipse.ecf.core.sharedobject.events.ISharedObjectMessageEvent)4 IContainerListener (org.eclipse.ecf.core.IContainerListener)3 IContainer (org.eclipse.ecf.core.IContainer)2 ID (org.eclipse.ecf.core.identity.ID)2 Event (org.eclipse.ecf.core.util.Event)2 IEventProcessor (org.eclipse.ecf.core.util.IEventProcessor)2 AsynchContainerConnectAction (org.eclipse.ecf.ui.actions.AsynchContainerConnectAction)2 IDCreateErrorDialog (org.eclipse.ecf.ui.dialogs.IDCreateErrorDialog)2 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)1 IIMMessageEvent (org.eclipse.ecf.presence.IIMMessageEvent)1 IIMMessageListener (org.eclipse.ecf.presence.IIMMessageListener)1 IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)1 IChatManager (org.eclipse.ecf.presence.im.IChatManager)1 IChatMessageEvent (org.eclipse.ecf.presence.im.IChatMessageEvent)1 ITypingMessageEvent (org.eclipse.ecf.presence.im.ITypingMessageEvent)1