Search in sources :

Example 6 with IContainerListener

use of org.eclipse.ecf.core.IContainerListener in project ecf by eclipse.

the class ClientContainerConnectTest method testRemoveListener.

public void testRemoveListener() throws Exception {
    final IContainer client = getClients()[0];
    final IContainerListener l = createListener();
    client.addListener(l);
    client.removeListener(l);
    client.connect(createServerID(), null);
    assertTrue(clientConnectingEvents.size() == 0);
}
Also used : IContainerListener(org.eclipse.ecf.core.IContainerListener) IContainer(org.eclipse.ecf.core.IContainer)

Example 7 with IContainerListener

use of org.eclipse.ecf.core.IContainerListener 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 8 with IContainerListener

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

use of org.eclipse.ecf.core.IContainerListener in project ecf by eclipse.

the class SharedObjectContainerUI method setup.

public void setup(final ISharedObjectContainer soContainer, final ClientEntry newClientEntry, final IResource resource, String username) throws Exception {
    addObjectToClient(soContainer, newClientEntry, username, resource);
    soc.addListener(new IContainerListener() {

        public void handleEvent(IContainerEvent evt) {
            if (evt instanceof IContainerDisconnectedEvent || evt instanceof IContainerEjectedEvent) {
                final ID departedContainerID = ((evt instanceof IContainerDisconnectedEvent) ? ((IContainerDisconnectedEvent) evt).getTargetID() : ((IContainerEjectedEvent) evt).getTargetID());
                final ID connectedID = newClientEntry.getContainer().getConnectedID();
                if (connectedID == null || connectedID.equals(departedContainerID)) {
                    if (!newClientEntry.isDisposed()) {
                        collabclient.disposeClient(resource, newClientEntry);
                    }
                }
            }
        }
    });
}
Also used : IContainerListener(org.eclipse.ecf.core.IContainerListener) ID(org.eclipse.ecf.core.identity.ID)

Example 10 with IContainerListener

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

IContainerListener (org.eclipse.ecf.core.IContainerListener)11 IContainerEvent (org.eclipse.ecf.core.events.IContainerEvent)5 IContainerConnectedEvent (org.eclipse.ecf.core.events.IContainerConnectedEvent)3 IContainerDisconnectedEvent (org.eclipse.ecf.core.events.IContainerDisconnectedEvent)3 IContainer (org.eclipse.ecf.core.IContainer)2 ID (org.eclipse.ecf.core.identity.ID)2 IIMMessageEvent (org.eclipse.ecf.presence.IIMMessageEvent)2 IIMMessageListener (org.eclipse.ecf.presence.IIMMessageListener)2 IChatMessageEvent (org.eclipse.ecf.presence.im.IChatMessageEvent)2 URISyntaxException (java.net.URISyntaxException)1 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)1 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)1 SharedObjectCreateException (org.eclipse.ecf.core.sharedobject.SharedObjectCreateException)1 ISharedObjectActivatedEvent (org.eclipse.ecf.core.sharedobject.events.ISharedObjectActivatedEvent)1 IUser (org.eclipse.ecf.core.user.IUser)1 ECFException (org.eclipse.ecf.core.util.ECFException)1 IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)1 IChatID (org.eclipse.ecf.presence.im.IChatID)1 IChatManager (org.eclipse.ecf.presence.im.IChatManager)1 IChatMessage (org.eclipse.ecf.presence.im.IChatMessage)1