Search in sources :

Example 16 with IContainer

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

the class SSLClientContainerConnectTest 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 17 with IContainer

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

the class SSLClientContainerConnectTest method testListenerConnected.

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

Example 18 with IContainer

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

the class ConnectRemoteServicehandler method getJob.

protected Job getJob(final ExecutionEvent event) throws ExecutionException {
    final ID createConnectId = RemoteServiceHandlerUtil.getActiveConnectIDChecked(event);
    final IContainer container = RemoteServiceHandlerUtil.getActiveIRemoteServiceContainerChecked(event);
    // decouple the long running connect call from the ui thread
    return new // $NON-NLS-1$
    Job(// $NON-NLS-1$
    NLS.bind("Connecting {0}", createConnectId.getName())) {

        protected IStatus run(IProgressMonitor monitor) {
            try {
                if (container != null)
                    container.connect(createConnectId, null);
            } catch (ContainerConnectException e) {
                showException(e);
                return Status.CANCEL_STATUS;
            }
            return Status.OK_STATUS;
        }
    };
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ContainerConnectException(org.eclipse.ecf.core.ContainerConnectException) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer) Job(org.eclipse.core.runtime.jobs.Job)

Example 19 with IContainer

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

the class DisonnectRemoteServicehandler method getJob.

/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.ecf.internal.remoteservices.ui.handlers.ConnectionHandler
	 * #getJob()
	 */
protected Job getJob(final ExecutionEvent event) throws ExecutionException {
    final ID createConnectId = RemoteServiceHandlerUtil.getActiveConnectIDChecked(event);
    final IContainer container = RemoteServiceHandlerUtil.getActiveIRemoteServiceContainerChecked(event);
    // decouple the long running connect call from the ui thread
    return new // $NON-NLS-1$
    Job(// $NON-NLS-1$
    NLS.bind("Connecting {0}", createConnectId.getName())) {

        protected IStatus run(IProgressMonitor monitor) {
            if (container == null)
                return Status.OK_STATUS;
            container.disconnect();
            return Status.OK_STATUS;
        }
    };
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer) Job(org.eclipse.core.runtime.jobs.Job)

Example 20 with IContainer

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

the class ConnectedTester method getContainerByConnectID.

/**
 * @param connectID
 *            The conected ID for which an IContainer is to be returned
 * @return a IContainer instance of null
 */
// TODO push this functionality down into the ContainerManager
private IContainer getContainerByConnectID(ID connectID) {
    final IContainerManager containerManager = Activator.getDefault().getContainerManager();
    final IContainer[] containers = containerManager.getAllContainers();
    if (containers == null) {
        return null;
    }
    for (int i = 0; i < containers.length; i++) {
        ID connectedId = containers[i].getConnectedID();
        if (connectedId != null && connectedId.equals(connectID)) {
            return containers[i];
        }
    }
    return null;
}
Also used : IContainerManager(org.eclipse.ecf.core.IContainerManager) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer)

Aggregations

IContainer (org.eclipse.ecf.core.IContainer)121 ID (org.eclipse.ecf.core.identity.ID)29 ContainerTypeDescription (org.eclipse.ecf.core.ContainerTypeDescription)20 IRosterEntry (org.eclipse.ecf.presence.roster.IRosterEntry)9 IRoster (org.eclipse.ecf.presence.roster.IRoster)8 IChannelContainerAdapter (org.eclipse.ecf.datashare.IChannelContainerAdapter)7 IRemoteServiceContainer (org.eclipse.ecf.remoteservice.IRemoteServiceContainer)7 IRemoteServiceContainerAdapter (org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter)7 ISharedObjectContainer (org.eclipse.ecf.core.sharedobject.ISharedObjectContainer)5 IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)5 RemoteServiceContainer (org.eclipse.ecf.remoteservice.RemoteServiceContainer)5 Action (org.eclipse.jface.action.Action)5 IAction (org.eclipse.jface.action.IAction)5 URL (java.net.URL)4 Job (org.eclipse.core.runtime.jobs.Job)4 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)4 IContainerManager (org.eclipse.ecf.core.IContainerManager)4 ISharedObject (org.eclipse.ecf.core.sharedobject.ISharedObject)4 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)4 RestClientContainer (org.eclipse.ecf.remoteservice.rest.client.RestClientContainer)4