Bug 270684 - [patch] [plug-in registry] add support for OSGi Remote
Services/Remote Service Admin 

Signed-off-by:  Scott Lewis  <slewis@composent.com >
diff --git a/ui/org.eclipse.pde.runtime/icons/obj16/rsvcproxy_obj.gif b/ui/org.eclipse.pde.runtime/icons/obj16/rsvcproxy_obj.gif
new file mode 100644
index 0000000..ef2c5fd
--- /dev/null
+++ b/ui/org.eclipse.pde.runtime/icons/obj16/rsvcproxy_obj.gif
Binary files differ
diff --git a/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/PDERuntimePluginImages.java b/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/PDERuntimePluginImages.java
index 62812c3..1b83d09 100644
--- a/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/PDERuntimePluginImages.java
+++ b/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/PDERuntimePluginImages.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -79,6 +79,7 @@
 	public static final ImageDescriptor DESC_PLUGINS_OBJ = create(PATH_OBJ, "plugins_obj.gif"); //$NON-NLS-1$
 	public static final ImageDescriptor DESC_FRAGMENT_OBJ = create(PATH_OBJ, "frgmt_obj.gif"); //$NON-NLS-1$
 	public static final ImageDescriptor DESC_PACKAGE_OBJ = create(PATH_OBJ, "package_obj.gif"); //$NON-NLS-1$
+	public static final ImageDescriptor DESC_REMOTE_SERVICE_PROXY_OBJ = create(PATH_OBJ, "rsvcproxy_obj.gif"); //$NON-NLS-1$
 
 	/*
 	 * Overlays
diff --git a/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserLabelProvider.java b/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserLabelProvider.java
index 5516caf..e2a7210 100644
--- a/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserLabelProvider.java
+++ b/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserLabelProvider.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -10,8 +10,6 @@
  *******************************************************************************/
 package org.eclipse.pde.internal.runtime.registry;
 
-import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
-
 import java.util.Arrays;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.*;
@@ -20,6 +18,7 @@
 import org.eclipse.pde.internal.runtime.registry.model.*;
 import org.eclipse.swt.graphics.Image;
 import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
 
 public class RegistryBrowserLabelProvider extends StyledCellLabelProvider implements ILabelProvider {
 
@@ -47,6 +46,7 @@
 	private Image fServicePropertyImage;
 	private Image fFragmentImage;
 	private Image fPackageImage;
+	private Image fRemoteServiceProxyImage;
 	private RegistryBrowser fRegistryBrowser;
 
 	public RegistryBrowserLabelProvider(RegistryBrowser browser) {
@@ -70,6 +70,7 @@
 		fPluginsImage = PDERuntimePluginImages.DESC_PLUGINS_OBJ.createImage();
 		fFragmentImage = PDERuntimePluginImages.DESC_FRAGMENT_OBJ.createImage();
 		fPackageImage = PDERuntimePluginImages.DESC_PACKAGE_OBJ.createImage();
+		fRemoteServiceProxyImage = PDERuntimePluginImages.DESC_REMOTE_SERVICE_PROXY_OBJ.createImage();
 
 		ImageDescriptor activePluginDesc = new OverlayIcon(PDERuntimePluginImages.DESC_PLUGIN_OBJ, new ImageDescriptor[][] {{PDERuntimePluginImages.DESC_RUN_CO}});
 		fActivePluginImage = activePluginDesc.createImage();
@@ -115,6 +116,20 @@
 		fPackageImage.dispose();
 	}
 
+	private boolean isProxyService(ServiceReference ref) {
+		if (ref == null)
+			return false;
+		Object o = ref.getProperty(Constants.SERVICE_IMPORTED);
+		return (o != null);
+	}
+
+	private boolean isProxyService(ServiceRegistration reg) {
+		if (reg == null)
+			return false;
+		Object o = reg.getProperty(Constants.SERVICE_IMPORTED);
+		return (o != null);
+	}
+
 	public Image getImage(Object element) {
 		if (element instanceof Bundle) {
 			Bundle bundle = (Bundle) element;
@@ -139,10 +154,16 @@
 		}
 
 		if (element instanceof ServiceName) {
+			ServiceName serviceName = (ServiceName) element;
+			if (isProxyService(serviceName.getServiceReference()))
+				return fRemoteServiceProxyImage;
 			return fServiceImage;
 		}
 
 		if (element instanceof ServiceRegistration) {
+			ServiceRegistration reg = (ServiceRegistration) element;
+			if (isProxyService(reg))
+				return fRemoteServiceProxyImage;
 			return fPluginImage;
 		}
 
diff --git a/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/LocalRegistryBackend.java b/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/LocalRegistryBackend.java
index e6e7337..3135c23 100644
--- a/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/LocalRegistryBackend.java
+++ b/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/LocalRegistryBackend.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -289,7 +289,7 @@
 
 		if (classes != null) {
 			Arrays.sort(classes);
-			service.setName(new ServiceName(classes));
+			service.setName(new ServiceName(classes, ref));
 			service.setProperties(properties);
 		}
 		return service;
diff --git a/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ServiceName.java b/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ServiceName.java
index 8f7fc44..ec8bbf1 100644
--- a/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ServiceName.java
+++ b/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ServiceName.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -12,13 +12,20 @@
 package org.eclipse.pde.internal.runtime.registry.model;
 
 import java.util.Arrays;
+import org.osgi.framework.ServiceReference;
 
 public class ServiceName extends ModelObject implements Comparable {
 
 	private String[] classes;
+	private ServiceReference reference;
 
-	public ServiceName(String[] classes) {
+	public ServiceName(String[] classes, ServiceReference ref) {
 		this.classes = classes;
+		this.reference = ref;
+	}
+
+	public ServiceReference getServiceReference() {
+		return this.reference;
 	}
 
 	public String[] getClasses() {