Index: src/org/eclipse/pde/internal/runtime/registry/model/ServiceRegistration.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ServiceRegistration.java,v retrieving revision 1.1 diff -u -r1.1 ServiceRegistration.java --- src/org/eclipse/pde/internal/runtime/registry/model/ServiceRegistration.java 20 Oct 2008 22:10:45 -0000 1.1 +++ src/org/eclipse/pde/internal/runtime/registry/model/ServiceRegistration.java 19 Dec 2008 10:06:05 -0000 @@ -10,19 +10,24 @@ *******************************************************************************/ package org.eclipse.pde.internal.runtime.registry.model; +import java.util.Collections; +import java.util.Map; + public class ServiceRegistration extends ModelObject { private Long id; private String bundle; private Long[] usingBundles; private String[] classes; + private Map properties; - public ServiceRegistration(RegistryModel model, Long id, String bundle, Long[] usingBundles, String[] classes) { + public ServiceRegistration(RegistryModel model, Long id, String bundle, Long[] usingBundles, String[] classes, Map properties) { super(model); this.id = id; this.bundle = bundle; this.usingBundles = usingBundles; this.classes = classes; + this.properties = Collections.unmodifiableMap(properties); } public Long getId() { @@ -41,6 +46,10 @@ return usingBundles; } + public Map getProperties() { + return properties; + } + public boolean equals(Object obj) { return (obj instanceof ServiceRegistration) && (id.equals(((ServiceRegistration) obj).id)); } Index: src/org/eclipse/pde/internal/runtime/registry/model/LocalRegistryBackend.java =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/LocalRegistryBackend.java,v retrieving revision 1.2 diff -u -r1.2 LocalRegistryBackend.java --- src/org/eclipse/pde/internal/runtime/registry/model/LocalRegistryBackend.java 23 Oct 2008 18:41:07 -0000 1.2 +++ src/org/eclipse/pde/internal/runtime/registry/model/LocalRegistryBackend.java 19 Dec 2008 10:06:05 -0000 @@ -207,7 +207,16 @@ } } String[] classes = (String[]) ref.getProperty(org.osgi.framework.Constants.OBJECTCLASS); - return new ServiceRegistration(model, id, bundle, usingBundlesIds, classes); + Map properties = new HashMap(); + String[] propertyKeys = ref.getPropertyKeys(); + if (propertyKeys != null) { + for (int p = 0; p < propertyKeys.length; p++) { + String key = propertyKeys[p]; + Object value = ref.getProperty(key); + properties.put(key, value); + } + } + return new ServiceRegistration(model, id, bundle, usingBundlesIds, classes, properties); } private static boolean getIsEnabled(org.osgi.framework.Bundle bundle) { Index: plugin.xml =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.runtime/plugin.xml,v retrieving revision 1.49 diff -u -r1.49 plugin.xml --- plugin.xml 13 Nov 2008 14:41:21 -0000 1.49 +++ plugin.xml 19 Dec 2008 10:06:05 -0000 @@ -62,5 +62,15 @@ commandId="org.eclipse.pde.runtime.spy.commands.spyCommand"> + + + + + + Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.runtime/META-INF/MANIFEST.MF,v retrieving revision 1.27 diff -u -r1.27 MANIFEST.MF --- META-INF/MANIFEST.MF 20 Oct 2008 22:10:47 -0000 1.27 +++ META-INF/MANIFEST.MF 19 Dec 2008 10:06:05 -0000 @@ -13,7 +13,8 @@ org.eclipse.core.resources;bundle-version="[3.3.0,4.0.0)";resolution:=optional, org.eclipse.jdt.ui;bundle-version="[3.3.0,4.0.0)";resolution:=optional, org.eclipse.pde.ui;bundle-version="[3.3.0,4.0.0)";resolution:=optional, - org.eclipse.help;bundle-version="[3.3.0,4.0.0)";resolution:=optional + org.eclipse.help;bundle-version="[3.3.0,4.0.0)";resolution:=optional, + org.eclipse.ui.views;bundle-version="[3.3.0,4.0.0)";resolution:=optional Eclipse-LazyStart: true Export-Package: org.eclipse.pde.internal.runtime;x-internal:=true, org.eclipse.pde.internal.runtime.registry;x-internal:=true, Index: src/org/eclipse/pde/internal/runtime/registry/ServiceRegistrationAdapterFactory.java =================================================================== RCS file: src/org/eclipse/pde/internal/runtime/registry/ServiceRegistrationAdapterFactory.java diff -N src/org/eclipse/pde/internal/runtime/registry/ServiceRegistrationAdapterFactory.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/pde/internal/runtime/registry/ServiceRegistrationAdapterFactory.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2008 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.pde.internal.runtime.registry; + +import org.eclipse.core.runtime.IAdapterFactory; +import org.eclipse.pde.internal.runtime.registry.model.ServiceRegistration; +import org.eclipse.ui.views.properties.IPropertySource; + +public class ServiceRegistrationAdapterFactory implements IAdapterFactory { + + public Object getAdapter(Object adaptableObject, Class adapterType) { + Object adapter = null; + + if (adaptableObject instanceof ServiceRegistration) { + ServiceRegistration serviceRegistration = (ServiceRegistration) adaptableObject; + if (adapterType == IPropertySource.class) { + adapter = new ServiceRegistrationPropertySource(serviceRegistration); + } + } + + return adapter; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() + */ + public Class[] getAdapterList() { + return new Class[] {IPropertySource.class,}; + } + +} Index: src/org/eclipse/pde/internal/runtime/registry/ServiceRegistrationPropertySource.java =================================================================== RCS file: src/org/eclipse/pde/internal/runtime/registry/ServiceRegistrationPropertySource.java diff -N src/org/eclipse/pde/internal/runtime/registry/ServiceRegistrationPropertySource.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/pde/internal/runtime/registry/ServiceRegistrationPropertySource.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,91 @@ +/******************************************************************************* + * Copyright (c) 2008 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.pde.internal.runtime.registry; + +import java.util.Iterator; +import java.util.Map; +import org.eclipse.pde.internal.runtime.registry.model.ServiceRegistration; +import org.eclipse.ui.views.properties.*; + +public class ServiceRegistrationPropertySource implements IPropertySource { + private final ServiceRegistration serviceRegistration; + + public ServiceRegistrationPropertySource(ServiceRegistration serviceRegistration) { + this.serviceRegistration = serviceRegistration; + } + + public Object getEditableValue() { + return serviceRegistration; + } + + public IPropertyDescriptor[] getPropertyDescriptors() { + Map properties = serviceRegistration.getProperties(); + IPropertyDescriptor[] descriptors = new IPropertyDescriptor[properties.size()]; + Iterator it = properties.keySet().iterator(); + for (int p = 0; it.hasNext(); p++) { + String name = (String) it.next(); + descriptors[p] = new PropertyDescriptor(name, name); + } + return descriptors; + } + + public Object getPropertyValue(Object id) { + return toString(serviceRegistration.getProperties().get(id)); + } + + protected String toString(Object value) { + if (value == null) { + return ""; //$NON-NLS-1$ + } else if (value instanceof CharSequence) { + CharSequence charSequence = (CharSequence) value; + return charSequence.toString(); + } else if (value instanceof Object[]) { + StringBuffer buff = new StringBuffer(); + appendString(buff, value); + + return buff.toString(); + } else { + return value.toString(); + } + } + + protected void appendString(StringBuffer buff, Object value) { + + if (value == null) { + // ignore + } else if (value instanceof Object[]) { + Object[] objects = (Object[]) value; + buff.append("["); //$NON-NLS-1$ + for (int o = 0; o < objects.length; o++) { + Object object = objects[o]; + if (o > 0) + buff.append(", "); //$NON-NLS-1$ + appendString(buff, object); + } + buff.append("]"); //$NON-NLS-1$ + } else { + buff.append(value.toString()); + } + } + + public boolean isPropertySet(Object id) { + return serviceRegistration.getProperties().containsKey(id); + } + + public void resetPropertyValue(Object id) { + // ignore + } + + public void setPropertyValue(Object id, Object value) { + // ignore + } +}