use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class AbstractURLHyperlink method open.
/*
* @see org.eclipse.jdt.internal.ui.javaeditor.IHyperlink#open()
*/
public void open() {
try {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
IContainer container = createContainer();
Assert.isNotNull(container);
IConnectWizard icw = createConnectWizard();
Assert.isNotNull(icw);
icw.init(workbench, container);
WizardDialog dialog = new WizardDialog(window.getShell(), icw);
dialog.open();
} catch (Exception ex) {
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.AbstractURIHyperlink_EXCEPTION_HYPERLINK, ex);
ErrorDialog.openError(null, null, null, status);
Activator.getDefault().getLog().log(status);
}
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class CompositeDiscoveryContainer method dispose.
/* (non-Javadoc)
* @see org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapter#dispose()
*/
public void dispose() {
disconnect();
synchronized (containers) {
for (final Iterator itr = containers.iterator(); itr.hasNext(); ) {
final IContainer container = (IContainer) itr.next();
container.dispose();
}
containers.clear();
}
targetID = null;
super.dispose();
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class CompositeDiscoveryContainer method addContainer.
/**
* @param object
* @return true on success
* @see java.util.List#add(java.lang.Object)
*/
public boolean addContainer(final Object object) {
// connect the new container if necessary and register ourself as listeners
IContainer iContainer = (IContainer) object;
if (iContainer.getConnectedID() == null) {
try {
iContainer.connect(targetID, null);
} catch (ContainerConnectException e) {
// we eat the exception here
// $NON-NLS-1$
Trace.catching(Activator.PLUGIN_ID, METHODS_CATCHING, this.getClass(), "addContainer(Object)", e);
return false;
}
}
final IDiscoveryLocator idca = (IDiscoveryLocator) object;
idca.addServiceListener(ccsl);
idca.addServiceTypeListener(ccstl);
// register previously registered with the new IDS
synchronized (registeredServices) {
final IDiscoveryAdvertiser ida = (IDiscoveryAdvertiser) object;
for (final Iterator itr = registeredServices.iterator(); itr.hasNext(); ) {
final IServiceInfo serviceInfo = (IServiceInfo) itr.next();
try {
ida.registerService(serviceInfo);
} catch (final ECFRuntimeException e) {
// we eat the exception here since the original registerService call is long done
// $NON-NLS-1$
Trace.catching(Activator.PLUGIN_ID, METHODS_CATCHING, this.getClass(), "addContainer(Object)", e);
}
}
}
synchronized (containers) {
Trace.trace(Activator.PLUGIN_ID, METHODS_TRACING, this.getClass(), "addContainer(Object)", // $NON-NLS-1$ //$NON-NLS-2$
"addContainer " + object.toString());
return containers.add(object);
}
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class RestContainerTest method testCreateContainer3.
public void testCreateContainer3() throws Exception {
ContainerTypeDescription description = getContainerFactory().getDescriptionByName(RestConstants.REST_CONTAINER_TYPE);
IContainer container = getContainerFactory().createContainer(description, new Object[] { new URI(RestConstants.TEST_DE_TARGET) });
assertNotNull(container);
assertTrue(container instanceof RestClientContainer);
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class RestContainerTest method testRegisterRestService.
public void testRegisterRestService() throws Exception {
IContainer container = createRestContainer(RestConstants.TEST_DE_TARGET);
Dictionary properties = new Hashtable();
properties.put("user", "null");
IRemoteCallable callable = RestCallableFactory.createCallable("methodName", "resourcePath", null, new HttpGetRequestType());
IRemoteServiceRegistration registration = registerCallable(container, callable, properties);
assertNotNull(registration);
}
Aggregations