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);
}
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()));
}
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;
}
};
}
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;
}
};
}
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;
}
Aggregations