Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/discovery/ui/handlers/AbstractRemoteServiceAccessHandler.java34
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/internal/discovery/ui/Messages.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/internal/discovery/ui/messages.properties1
3 files changed, 37 insertions, 0 deletions
diff --git a/framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/discovery/ui/handlers/AbstractRemoteServiceAccessHandler.java b/framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/discovery/ui/handlers/AbstractRemoteServiceAccessHandler.java
index 5b23bfe18..29767f548 100644
--- a/framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/discovery/ui/handlers/AbstractRemoteServiceAccessHandler.java
+++ b/framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/discovery/ui/handlers/AbstractRemoteServiceAccessHandler.java
@@ -104,6 +104,10 @@ public abstract class AbstractRemoteServiceAccessHandler implements IServiceAcce
}
protected IContributionItem[] getContributionsForMatchingService() {
+ return getPrimaryContributionsForMatchingService();
+ }
+
+ private IContributionItem[] getPrimaryContributionsForMatchingService() {
// First get container manager...if we don't have one, then we're outta here
final List remoteServicesContainerAdapters = getRemoteServiceContainerAdapters();
// If we've got none, then we return
@@ -122,6 +126,9 @@ public abstract class AbstractRemoteServiceAccessHandler implements IServiceAcce
return (IContributionItem[]) contributions.toArray(new IContributionItem[] {});
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.discovery.ui.views.IServiceAccessHandler#getContributionsForService(org.eclipse.ecf.discovery.IServiceInfo)
+ */
public IContributionItem[] getContributionsForService(IServiceInfo svcInfo) {
if (svcInfo == null)
return EMPTY_CONTRIBUTION;
@@ -158,4 +165,31 @@ public abstract class AbstractRemoteServiceAccessHandler implements IServiceAcce
*/
protected abstract IContributionItem[] getContributionItemsForService(final IRemoteServiceContainerAdapter adapter);
+ /**
+ * Create a remote call instance.
+ *
+ * @return IRemoteCall instance. <code>null</code> if no call available.
+ */
+ protected abstract IRemoteCall createRemoteCall();
+
+ protected IContributionItem[] getConnectedContributions(final IContainer container) {
+ // Add disconnect and separator
+ final List results = new ArrayList();
+ final IContributionItem[] serviceItem = getPrimaryContributionsForMatchingService();
+ if (serviceItem != null) {
+ for (int i = 0; i < serviceItem.length; i++)
+ results.add(serviceItem[i]);
+ } else
+ return EMPTY_CONTRIBUTION;
+ results.add(new Separator());
+ final IAction disconnectAction = new Action() {
+ public void run() {
+ container.disconnect();
+ }
+ };
+ disconnectAction.setText(Messages.AbstractRemoteServiceAccessHandler_DISCONNECT_MENU_TEXT);
+ results.add(new ActionContributionItem(disconnectAction));
+ return (IContributionItem[]) results.toArray(new IContributionItem[] {});
+ }
+
}
diff --git a/framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/internal/discovery/ui/Messages.java b/framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/internal/discovery/ui/Messages.java
index e79145ffa..2fe51dd80 100644
--- a/framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/internal/discovery/ui/Messages.java
+++ b/framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/internal/discovery/ui/Messages.java
@@ -16,6 +16,8 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.ecf.internal.discovery.ui.messages"; //$NON-NLS-1$
+ public static String AbstractRemoteServiceAccessHandler_DISCONNECT_MENU_TEXT;
+
public static String AbstractRemoteServiceAccessHandler_NOT_AVAILABLE_MENU_TEXT;
public static String DiscoveryView_Services;
diff --git a/framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/internal/discovery/ui/messages.properties b/framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/internal/discovery/ui/messages.properties
index 1ba1b59b5..9086b62f2 100644
--- a/framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/internal/discovery/ui/messages.properties
+++ b/framework/bundles/org.eclipse.ecf.discovery.ui/src/org/eclipse/ecf/internal/discovery/ui/messages.properties
@@ -9,6 +9,7 @@
# IBM Corporation - initial API and implementation
################################################################################
+AbstractRemoteServiceAccessHandler_DISCONNECT_MENU_TEXT=Disconnect
AbstractRemoteServiceAccessHandler_NOT_AVAILABLE_MENU_TEXT=No connected container of correct type
DiscoveryView_Services = Services
DiscoveryView_AddressLabel = Location: {0}

Back to the top