diff options
author | slewis | 2008-02-07 06:11:13 +0000 |
---|---|---|
committer | slewis | 2008-02-07 06:11:13 +0000 |
commit | c778b9c952e002f2f72dfc345540fcbbdab5ae29 (patch) | |
tree | a243610d74d3f81f9933c2720c431e668769390b | |
parent | 22ba27126fb9029bdafab625d2627a631ef0b74a (diff) | |
download | org.eclipse.ecf-c778b9c952e002f2f72dfc345540fcbbdab5ae29.tar.gz org.eclipse.ecf-c778b9c952e002f2f72dfc345540fcbbdab5ae29.tar.xz org.eclipse.ecf-c778b9c952e002f2f72dfc345540fcbbdab5ae29.zip |
Removed references to create generic container
2 files changed, 16 insertions, 6 deletions
diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.client/src/org/eclipse/ecf/internal/examples/remoteservices/client/Activator.java b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.client/src/org/eclipse/ecf/internal/examples/remoteservices/client/Activator.java index 70c81f0dc..fd69b5a2d 100644 --- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.client/src/org/eclipse/ecf/internal/examples/remoteservices/client/Activator.java +++ b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.client/src/org/eclipse/ecf/internal/examples/remoteservices/client/Activator.java @@ -1,8 +1,6 @@ package org.eclipse.ecf.internal.examples.remoteservices.client; -import org.eclipse.ecf.core.ContainerFactory; import org.eclipse.ecf.core.IContainer; -import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; @@ -11,8 +9,6 @@ import org.osgi.framework.BundleContext; */ public class Activator extends AbstractUIPlugin { - private static final String ECF_GENERIC_CLIENT = "ecf.generic.client"; - // The plug-in ID public static final String PLUGIN_ID = "org.eclipse.ecf.examples.remoteservices.client"; @@ -34,8 +30,6 @@ public class Activator extends AbstractUIPlugin { public void start(BundleContext context) throws Exception { super.start(context); plugin = this; - serviceHostContainer = ContainerFactory.getDefault().createContainer(ECF_GENERIC_CLIENT); - serviceHostContainer.getAdapter(IRemoteServiceContainerAdapter.class); } /* @@ -55,6 +49,10 @@ public class Activator extends AbstractUIPlugin { return serviceHostContainer; } + public void setContainer(IContainer container) { + this.serviceHostContainer = container; + } + /** * Returns the shared instance * diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.client/src/org/eclipse/ecf/internal/examples/remoteservices/client/RemoteEnvironmentInfoServiceAccessHandler.java b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.client/src/org/eclipse/ecf/internal/examples/remoteservices/client/RemoteEnvironmentInfoServiceAccessHandler.java index e7ec51a3b..494dcef24 100644 --- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.client/src/org/eclipse/ecf/internal/examples/remoteservices/client/RemoteEnvironmentInfoServiceAccessHandler.java +++ b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.client/src/org/eclipse/ecf/internal/examples/remoteservices/client/RemoteEnvironmentInfoServiceAccessHandler.java @@ -4,6 +4,7 @@ import java.io.NotSerializableException; import java.util.Arrays; import org.eclipse.ecf.core.ContainerConnectException; +import org.eclipse.ecf.core.ContainerCreateException; import org.eclipse.ecf.core.IContainer; import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.discovery.ui.handlers.AbstractRemoteServiceAccessHandler; @@ -31,6 +32,17 @@ public class RemoteEnvironmentInfoServiceAccessHandler extends AbstractRemoteSer } protected IContributionItem[] getContributionsForMatchingService() { + if (Activator.getDefault().getContainer() == null) { + try { + final IContainer c = createContainer(); + final IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) c.getAdapter(IRemoteServiceContainerAdapter.class); + if (adapter == null) + return EMPTY_CONTRIBUTION; + Activator.getDefault().setContainer(c); + } catch (final ContainerCreateException e) { + return EMPTY_CONTRIBUTION; + } + } final IContainer container = Activator.getDefault().getContainer(); // not connected already...so setup contribution that allows connect final String ns = getConnectNamespace(); |