Search in sources :

Example 6 with IContainerDisconnectedEvent

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

the class ClientContainerConnectTest 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 7 with IContainerDisconnectedEvent

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

the class ClientContainerConnectTest method testListenerDisconnected.

public void testListenerDisconnected() throws Exception {
    final IContainer client = getClients()[0];
    client.addListener(createListener());
    client.connect(createServerID(), null);
    client.disconnect();
    final Object o = clientDisconnectedEvents.get(0);
    assertTrue(o instanceof IContainerDisconnectedEvent);
    final IContainerDisconnectedEvent cco = (IContainerDisconnectedEvent) o;
    assertTrue(cco.getLocalContainerID().equals(client.getID()));
    assertTrue(cco.getTargetID().equals(createServerID()));
}
Also used : IContainerDisconnectedEvent(org.eclipse.ecf.core.events.IContainerDisconnectedEvent) IContainer(org.eclipse.ecf.core.IContainer)

Example 8 with IContainerDisconnectedEvent

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

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

the class UserSearchView method addMultiRosterAccount.

/**
 * Add the MultiRosterAccount for add user contact
 * @param multiRosterAccount
 * @return boolean
 */
public boolean addMultiRosterAccount(MultiRosterAccount multiRosterAccount) {
    Assert.isNotNull(multiRosterAccount);
    this.account = multiRosterAccount;
    listener = new IContainerListener() {

        public void handleEvent(IContainerEvent event) {
            if (event instanceof IContainerDisconnectedEvent) {
                users.clear();
                showMessage(Messages.MultiRosterView_HELP_MESSAGE);
            }
        }
    };
    account.container.addListener(listener);
    return true;
}
Also used : IContainerEvent(org.eclipse.ecf.core.events.IContainerEvent) IContainerDisconnectedEvent(org.eclipse.ecf.core.events.IContainerDisconnectedEvent) IContainerListener(org.eclipse.ecf.core.IContainerListener)

Aggregations

IContainerDisconnectedEvent (org.eclipse.ecf.core.events.IContainerDisconnectedEvent)9 IContainerConnectedEvent (org.eclipse.ecf.core.events.IContainerConnectedEvent)6 ISharedObjectActivatedEvent (org.eclipse.ecf.core.sharedobject.events.ISharedObjectActivatedEvent)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 IContainerEvent (org.eclipse.ecf.core.events.IContainerEvent)3 IContainer (org.eclipse.ecf.core.IContainer)2 ID (org.eclipse.ecf.core.identity.ID)1