View | Details | Raw Unified | Return to bug 217738 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserLabelProvider.java (-1 / +32 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 12-17 Link Here
12
12
13
import java.io.IOException;
13
import java.io.IOException;
14
import java.net.URL;
14
import java.net.URL;
15
import java.util.Arrays;
15
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.*;
16
import org.eclipse.jface.resource.ImageDescriptor;
17
import org.eclipse.jface.resource.ImageDescriptor;
17
import org.eclipse.jface.viewers.LabelProvider;
18
import org.eclipse.jface.viewers.LabelProvider;
Lines 21-26 Link Here
21
import org.eclipse.pde.internal.runtime.*;
22
import org.eclipse.pde.internal.runtime.*;
22
import org.eclipse.swt.graphics.Image;
23
import org.eclipse.swt.graphics.Image;
23
import org.osgi.framework.Bundle;
24
import org.osgi.framework.Bundle;
25
import org.osgi.framework.ServiceReference;
24
26
25
public class RegistryBrowserLabelProvider extends LabelProvider {
27
public class RegistryBrowserLabelProvider extends LabelProvider {
26
28
Lines 40-45 Link Here
40
	private Image fReqPluginImage;
42
	private Image fReqPluginImage;
41
	private Image fLocationImage;
43
	private Image fLocationImage;
42
	private Image fDisabledImage;
44
	private Image fDisabledImage;
45
	private Image fExporterImage;
46
	private Image fImporterImage;
47
	private Image fServiceImage;
43
	private TreeViewer fViewer;
48
	private TreeViewer fViewer;
44
49
45
	public RegistryBrowserLabelProvider(TreeViewer viewer) {
50
	public RegistryBrowserLabelProvider(TreeViewer viewer) {
Lines 56-61 Link Here
56
		fGenericAttrImage = PDERuntimePluginImages.DESC_ATTR_XML_OBJ.createImage();
61
		fGenericAttrImage = PDERuntimePluginImages.DESC_ATTR_XML_OBJ.createImage();
57
		fRuntimeImage = PDERuntimePluginImages.DESC_RUNTIME_OBJ.createImage();
62
		fRuntimeImage = PDERuntimePluginImages.DESC_RUNTIME_OBJ.createImage();
58
		fLocationImage = PDERuntimePluginImages.DESC_LOCATION.createImage();
63
		fLocationImage = PDERuntimePluginImages.DESC_LOCATION.createImage();
64
		fExporterImage = PDERuntimePluginImages.DESC_EXP_OBJ.createImage();
65
		fImporterImage = PDERuntimePluginImages.DESC_IMP_OBJ.createImage();
66
		fServiceImage = PDERuntimePluginImages.DESC_SERVICE_OBJ.createImage();
59
67
60
		ImageDescriptor activePluginDesc = new OverlayIcon(PDERuntimePluginImages.DESC_PLUGIN_OBJ, new ImageDescriptor[][] {{PDERuntimePluginImages.DESC_RUN_CO}});
68
		ImageDescriptor activePluginDesc = new OverlayIcon(PDERuntimePluginImages.DESC_PLUGIN_OBJ, new ImageDescriptor[][] {{PDERuntimePluginImages.DESC_RUN_CO}});
61
		fActivePluginImage = activePluginDesc.createImage();
69
		fActivePluginImage = activePluginDesc.createImage();
Lines 88-93 Link Here
88
		fRuntimeImage.dispose();
96
		fRuntimeImage.dispose();
89
		fLocationImage.dispose();
97
		fLocationImage.dispose();
90
		fDisabledImage.dispose();
98
		fDisabledImage.dispose();
99
		fImporterImage.dispose();
100
		fExporterImage.dispose();
101
		fServiceImage.dispose();
91
	}
102
	}
92
103
93
	public Image getImage(Object element) {
104
	public Image getImage(Object element) {
Lines 117-122 Link Here
117
					return fPluginImage;
128
					return fPluginImage;
118
			}
129
			}
119
		}
130
		}
131
132
		if (element instanceof ServiceReference) {
133
			return fServiceImage;
134
		}
135
120
		if (element instanceof IBundleFolder) {
136
		if (element instanceof IBundleFolder) {
121
			int id = ((IBundleFolder) element).getFolderId();
137
			int id = ((IBundleFolder) element).getFolderId();
122
			switch (id) {
138
			switch (id) {
Lines 130-135 Link Here
130
					return fRuntimeImage;
146
					return fRuntimeImage;
131
				case IBundleFolder.F_LOCATION :
147
				case IBundleFolder.F_LOCATION :
132
					return fLocationImage;
148
					return fLocationImage;
149
				case IBundleFolder.F_REGISTERED_SERVICES :
150
					return fExporterImage;
151
				case IBundleFolder.F_SERVICES_IN_USE :
152
					return fImporterImage;
133
			}
153
			}
134
			return null;
154
			return null;
135
		}
155
		}
Lines 164-169 Link Here
164
				return id;
184
				return id;
165
			return id + " (" + version + ")"; //$NON-NLS-1$ //$NON-NLS-2$
185
			return id + " (" + version + ")"; //$NON-NLS-1$ //$NON-NLS-2$
166
		}
186
		}
187
		if (element instanceof ServiceReference) {
188
			ServiceReference ref = (ServiceReference) element;
189
			String[] classes = (String[]) ref.getProperty(org.osgi.framework.Constants.OBJECTCLASS);
190
			Long id = (Long) ref.getProperty(org.osgi.framework.Constants.SERVICE_ID);
191
			String identifier = " (id=" + id.toString() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
192
			return Arrays.asList(classes).toString().concat(identifier);
193
		}
167
		if (element instanceof IBundleFolder) {
194
		if (element instanceof IBundleFolder) {
168
			switch (((IBundleFolder) element).getFolderId()) {
195
			switch (((IBundleFolder) element).getFolderId()) {
169
				case IBundleFolder.F_IMPORTS :
196
				case IBundleFolder.F_IMPORTS :
Lines 174-179 Link Here
174
					return PDERuntimeMessages.RegistryView_folders_extensionPoints;
201
					return PDERuntimeMessages.RegistryView_folders_extensionPoints;
175
				case IBundleFolder.F_EXTENSIONS :
202
				case IBundleFolder.F_EXTENSIONS :
176
					return PDERuntimeMessages.RegistryView_folders_extensions;
203
					return PDERuntimeMessages.RegistryView_folders_extensions;
204
				case IBundleFolder.F_REGISTERED_SERVICES :
205
					return PDERuntimeMessages.RegistryBrowserLabelProvider_registeredServices;
206
				case IBundleFolder.F_SERVICES_IN_USE :
207
					return PDERuntimeMessages.RegistryBrowserLabelProvider_usedServices;
177
				case IBundleFolder.F_LOCATION :
208
				case IBundleFolder.F_LOCATION :
178
					Bundle bundle = ((IBundleFolder) element).getBundle();
209
					Bundle bundle = ((IBundleFolder) element).getBundle();
179
					URL bundleEntry = bundle.getEntry("/"); //$NON-NLS-1$
210
					URL bundleEntry = bundle.getEntry("/"); //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/runtime/registry/IBundleFolder.java (+4 lines)
Lines 19-27 Link Here
19
	public static final int F_EXTENSION_POINTS = 2;
19
	public static final int F_EXTENSION_POINTS = 2;
20
	public static final int F_IMPORTS = 3;
20
	public static final int F_IMPORTS = 3;
21
	public static final int F_LIBRARIES = 4;
21
	public static final int F_LIBRARIES = 4;
22
	public static final int F_REGISTERED_SERVICES = 5;
23
	public static final int F_SERVICES_IN_USE = 6;
22
24
23
	public Object[] getChildren();
25
	public Object[] getChildren();
24
26
27
	public void refresh();
28
25
	int getFolderId();
29
	int getFolderId();
26
30
27
	public Bundle getBundle();
31
	public Bundle getBundle();
(-)src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java (-1 / +3 lines)
Lines 157-162 Link Here
157
		if (fListener != null) {
157
		if (fListener != null) {
158
			Platform.getExtensionRegistry().removeRegistryChangeListener(fListener);
158
			Platform.getExtensionRegistry().removeRegistryChangeListener(fListener);
159
			PDERuntimePlugin.getDefault().getBundleContext().removeBundleListener(fListener);
159
			PDERuntimePlugin.getDefault().getBundleContext().removeBundleListener(fListener);
160
			PDERuntimePlugin.getDefault().getBundleContext().removeServiceListener(fListener);
160
		}
161
		}
161
		super.dispose();
162
		super.dispose();
162
	}
163
	}
Lines 174-179 Link Here
174
175
175
		PDERuntimePlugin.getDefault().getBundleContext().addBundleListener(fListener);
176
		PDERuntimePlugin.getDefault().getBundleContext().addBundleListener(fListener);
176
		Platform.getExtensionRegistry().addRegistryChangeListener(fListener);
177
		Platform.getExtensionRegistry().addRegistryChangeListener(fListener);
178
		PDERuntimePlugin.getDefault().getBundleContext().addServiceListener(fListener);
177
	}
179
	}
178
180
179
	private void createTreeViewer(Composite parent) {
181
	private void createTreeViewer(Composite parent) {
Lines 236-242 Link Here
236
		ArrayList list = new ArrayList();
238
		ArrayList list = new ArrayList();
237
		for (int i = 0; i < bundles.length; i++)
239
		for (int i = 0; i < bundles.length; i++)
238
			if (bundles[i].getHeaders().get(Constants.FRAGMENT_HOST) == null)
240
			if (bundles[i].getHeaders().get(Constants.FRAGMENT_HOST) == null)
239
				list.add(new PluginObjectAdapter(bundles[i]));
241
				list.add(new PluginAdapter(bundles[i]));
240
		return (PluginObjectAdapter[]) list.toArray(new PluginObjectAdapter[list.size()]);
242
		return (PluginObjectAdapter[]) list.toArray(new PluginObjectAdapter[list.size()]);
241
	}
243
	}
242
244
(-)src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserContentProvider.java (-30 / +62 lines)
Lines 10-25 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.runtime.registry;
11
package org.eclipse.pde.internal.runtime.registry;
12
12
13
import java.util.ArrayList;
13
import java.util.*;
14
import java.util.Hashtable;
15
import org.eclipse.core.runtime.*;
14
import org.eclipse.core.runtime.*;
16
import org.eclipse.jface.viewers.ITreeContentProvider;
15
import org.eclipse.jface.viewers.ITreeContentProvider;
17
import org.eclipse.jface.viewers.Viewer;
16
import org.eclipse.jface.viewers.Viewer;
18
import org.eclipse.osgi.util.ManifestElement;
17
import org.eclipse.osgi.util.ManifestElement;
18
import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
19
import org.osgi.framework.*;
19
import org.osgi.framework.*;
20
20
21
public class RegistryBrowserContentProvider implements ITreeContentProvider {
21
public class RegistryBrowserContentProvider implements ITreeContentProvider {
22
	private Hashtable fPluginMap = new Hashtable();
23
	private Hashtable fExtensionPointMap = new Hashtable();
22
	private Hashtable fExtensionPointMap = new Hashtable();
24
	public boolean isInExtensionSet;
23
	public boolean isInExtensionSet;
25
24
Lines 44-49 Link Here
44
			return children;
43
			return children;
45
		}
44
		}
46
45
46
		/**
47
		 * Resets folder's previously cached knowledge about it's children. 
48
		 */
49
		public void refresh() {
50
			children = null;
51
		}
52
47
		public int getFolderId() {
53
		public int getFolderId() {
48
			return id;
54
			return id;
49
		}
55
		}
Lines 92-97 Link Here
92
		}
98
		}
93
	}
99
	}
94
100
101
	/**
102
	 * Creates contents adapter for given folder id.
103
	 * @param object Folder contents to be wrapped in adapter
104
	 * @param id Type of folder
105
	 * @return Adapter 
106
	 */
95
	static protected PluginObjectAdapter createAdapter(Object object, int id) {
107
	static protected PluginObjectAdapter createAdapter(Object object, int id) {
96
		if (id == IBundleFolder.F_EXTENSIONS)
108
		if (id == IBundleFolder.F_EXTENSIONS)
97
			return new ExtensionAdapter(object);
109
			return new ExtensionAdapter(object);
Lines 100-115 Link Here
100
		return new PluginObjectAdapter(object);
112
		return new PluginObjectAdapter(object);
101
	}
113
	}
102
114
103
	protected Object[] createPluginFolders(Bundle bundle) {
104
		Object[] array = new Object[5];
105
		array[0] = new BundleFolder(bundle, IBundleFolder.F_LOCATION);
106
		array[1] = new BundleFolder(bundle, IBundleFolder.F_IMPORTS);
107
		array[2] = new BundleFolder(bundle, IBundleFolder.F_LIBRARIES);
108
		array[3] = new BundleFolder(bundle, IBundleFolder.F_EXTENSION_POINTS);
109
		array[4] = new BundleFolder(bundle, IBundleFolder.F_EXTENSIONS);
110
		return array;
111
	}
112
113
	public void dispose() { // nothing to dispose
115
	public void dispose() { // nothing to dispose
114
	}
116
	}
115
117
Lines 131-157 Link Here
131
		if (element instanceof ConfigurationElementAdapter)
133
		if (element instanceof ConfigurationElementAdapter)
132
			return ((ConfigurationElementAdapter) element).getChildren();
134
			return ((ConfigurationElementAdapter) element).getChildren();
133
135
134
		if (element instanceof PluginObjectAdapter)
136
		if (element instanceof PluginAdapter) {
135
			element = ((PluginObjectAdapter) element).getObject();
137
			PluginAdapter bundle = (PluginAdapter) element;
136
138
137
		if (element instanceof Bundle) {
139
			Object[] folders = bundle.getChildren();
138
			Bundle bundle = (Bundle) element;
139
			String bundleID = new Long(bundle.getBundleId()).toString();
140
			Object[] folders = (Object[]) fPluginMap.get(bundleID);
141
			if (folders == null) {
142
				folders = createPluginFolders(bundle);
143
144
				ArrayList folderList = new ArrayList();
145
				for (int i = 0; i < folders.length; i++) {
146
					if (folders[i] != null && ((IBundleFolder) folders[i]).getChildren() != null || ((IBundleFolder) folders[i]).getFolderId() == IBundleFolder.F_LOCATION)
147
						folderList.add(folders[i]);
148
				}
149
				folders = folderList.toArray(new Object[folderList.size()]);
150
140
151
				fPluginMap.put(bundleID, folders);
141
			// filter out empty folders
142
			ArrayList folderList = new ArrayList();
143
			for (int i = 0; i < folders.length; i++) {
144
				if (folders[i] != null && ((IBundleFolder) folders[i]).getChildren() != null || ((IBundleFolder) folders[i]).getFolderId() == IBundleFolder.F_LOCATION)
145
					folderList.add(folders[i]);
152
			}
146
			}
147
			folders = folderList.toArray(new Object[folderList.size()]);
148
153
			return folders;
149
			return folders;
154
		}
150
		}
151
152
		if (element instanceof PluginObjectAdapter)
153
			element = ((PluginObjectAdapter) element).getObject();
154
155
		if (element instanceof IBundleFolder) {
155
		if (element instanceof IBundleFolder) {
156
			IBundleFolder folder = (IBundleFolder) element;
156
			IBundleFolder folder = (IBundleFolder) element;
157
			isInExtensionSet = folder.getFolderId() == IBundleFolder.F_EXTENSIONS;
157
			isInExtensionSet = folder.getFolderId() == IBundleFolder.F_EXTENSIONS;
Lines 185-191 Link Here
185
		return null;
185
		return null;
186
	}
186
	}
187
187
188
	static Object[] getFolderChildren(Bundle bundle, int id) {
188
	protected static Object[] getFolderChildren(Bundle bundle, int id) {
189
		Object[] array = null;
189
		Object[] array = null;
190
		String bundleId = bundle.getSymbolicName();
190
		String bundleId = bundle.getSymbolicName();
191
		switch (id) {
191
		switch (id) {
Lines 201-206 Link Here
201
			case IBundleFolder.F_LIBRARIES :
201
			case IBundleFolder.F_LIBRARIES :
202
				array = getManifestHeaderArray(bundle, Constants.BUNDLE_CLASSPATH);
202
				array = getManifestHeaderArray(bundle, Constants.BUNDLE_CLASSPATH);
203
				break;
203
				break;
204
			case IBundleFolder.F_REGISTERED_SERVICES :
205
				return getServices(bundle, IBundleFolder.F_REGISTERED_SERVICES);
206
			case IBundleFolder.F_SERVICES_IN_USE :
207
				return getServices(bundle, IBundleFolder.F_SERVICES_IN_USE);
204
		}
208
		}
205
		Object[] result = null;
209
		Object[] result = null;
206
		if (array != null && array.length > 0) {
210
		if (array != null && array.length > 0) {
Lines 212-217 Link Here
212
		return result;
216
		return result;
213
	}
217
	}
214
218
219
	protected static Object[] getServices(Bundle bundle, int type) {
220
		Set result = new HashSet();
221
222
		try {
223
			ServiceReference[] references = PDERuntimePlugin.getDefault().getBundleContext().getAllServiceReferences(null, null);
224
225
			for (int i = 0; i < references.length; i++) {
226
				ServiceReference ref = references[i];
227
228
				if ((type == IBundleFolder.F_REGISTERED_SERVICES) && (bundle.equals(ref.getBundle()))) {
229
					result.add(new ServiceReferenceAdapter(ref));
230
				}
231
232
				Bundle[] usingBundles = ref.getUsingBundles();
233
				if ((type == IBundleFolder.F_SERVICES_IN_USE) && (usingBundles != null && Arrays.asList(usingBundles).contains(bundle))) {
234
					result.add(new ServiceReferenceAdapter(ref));
235
				}
236
			}
237
238
		} catch (InvalidSyntaxException e) { // nothing
239
		}
240
241
		if (result.size() == 0)
242
			return null;
243
244
		return result.toArray(new ServiceReferenceAdapter[result.size()]);
245
	}
246
215
	public Object getParent(Object element) {
247
	public Object getParent(Object element) {
216
		return null;
248
		return null;
217
	}
249
	}
(-)src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserListener.java (-2 / +37 lines)
Lines 11-21 Link Here
11
package org.eclipse.pde.internal.runtime.registry;
11
package org.eclipse.pde.internal.runtime.registry;
12
12
13
import org.eclipse.core.runtime.*;
13
import org.eclipse.core.runtime.*;
14
import org.eclipse.pde.internal.runtime.registry.RegistryBrowserContentProvider.BundleFolder;
14
import org.eclipse.swt.widgets.Tree;
15
import org.eclipse.swt.widgets.Tree;
15
import org.eclipse.swt.widgets.TreeItem;
16
import org.eclipse.swt.widgets.TreeItem;
16
import org.osgi.framework.*;
17
import org.osgi.framework.*;
17
18
18
public class RegistryBrowserListener implements IRegistryChangeListener, BundleListener {
19
public class RegistryBrowserListener implements IRegistryChangeListener, BundleListener, ServiceListener {
19
20
20
	protected RegistryBrowser fBrowser;
21
	protected RegistryBrowser fBrowser;
21
	protected boolean fExtOnly;
22
	protected boolean fExtOnly;
Lines 263-269 Link Here
263
		switch (changeType) {
264
		switch (changeType) {
264
			case BundleEvent.INSTALLED :
265
			case BundleEvent.INSTALLED :
265
				if (data == null)
266
				if (data == null)
266
					fBrowser.add(new PluginObjectAdapter(bundle));
267
					fBrowser.add(new PluginAdapter(bundle));
267
				break;
268
				break;
268
			case BundleEvent.UNINSTALLED :
269
			case BundleEvent.UNINSTALLED :
269
				if (data != null)
270
				if (data != null)
Lines 327-330 Link Here
327
				break;
328
				break;
328
		}
329
		}
329
	}
330
	}
331
332
	public void serviceChanged(ServiceEvent event) {
333
		ServiceReference ref = event.getServiceReference();
334
335
		switch (event.getType()) {
336
			case ServiceEvent.REGISTERED :
337
			case ServiceEvent.UNREGISTERING :
338
				Bundle bundle = ref.getBundle();
339
				TreeItem bundleItem = findBundleItem(bundle.getSymbolicName());
340
				PluginAdapter bundleAdapter = ((PluginAdapter) bundleItem.getData());
341
				Object[] folders = bundleAdapter.getChildren();
342
343
				for (int j = 0; j < folders.length; j++) {
344
					if (folders[j] instanceof IBundleFolder) {
345
						IBundleFolder folder = (IBundleFolder) folders[j];
346
347
						if (folder.getFolderId() == IBundleFolder.F_REGISTERED_SERVICES) {
348
							if ((event.getType() == ServiceEvent.REGISTERED) || (event.getType() == ServiceEvent.UNREGISTERING)) {
349
								((BundleFolder) folder).refresh(); // refresh model
350
								fBrowser.refresh(folder); // refresh view
351
352
								// refresh whole bundle in case there were folders added - they might have not existed if bundle had no service before
353
								fBrowser.refresh(bundleAdapter);
354
							}
355
						}
356
					}
357
				}
358
359
				break;
360
			case ServiceEvent.MODIFIED :
361
				break;
362
		}
363
364
	}
330
}
365
}
(-)src/org/eclipse/pde/internal/runtime/PDERuntimePluginImages.java (-2 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-17 Link Here
11
package org.eclipse.pde.internal.runtime;
11
package org.eclipse.pde.internal.runtime;
12
12
13
import java.net.URL;
13
import java.net.URL;
14
15
import org.eclipse.core.runtime.FileLocator;
14
import org.eclipse.core.runtime.FileLocator;
16
import org.eclipse.core.runtime.Path;
15
import org.eclipse.core.runtime.Path;
17
import org.eclipse.jface.resource.ImageDescriptor;
16
import org.eclipse.jface.resource.ImageDescriptor;
Lines 73-78 Link Here
73
	public static final ImageDescriptor DESC_RUNTIME_OBJ = create(PATH_OBJ, "runtime_obj.gif"); //$NON-NLS-1$
72
	public static final ImageDescriptor DESC_RUNTIME_OBJ = create(PATH_OBJ, "runtime_obj.gif"); //$NON-NLS-1$
74
	public static final ImageDescriptor DESC_WARNING_ST_OBJ = create(PATH_OBJ, "warning_st_obj.gif"); //$NON-NLS-1$
73
	public static final ImageDescriptor DESC_WARNING_ST_OBJ = create(PATH_OBJ, "warning_st_obj.gif"); //$NON-NLS-1$
75
	public static final ImageDescriptor DESC_LOCATION = create(PATH_OBJ, "location_obj.gif"); //$NON-NLS-1$
74
	public static final ImageDescriptor DESC_LOCATION = create(PATH_OBJ, "location_obj.gif"); //$NON-NLS-1$
75
	public static final ImageDescriptor DESC_IMP_OBJ = create(PATH_OBJ, "bundle-importer.gif"); //$NON-NLS-1$
76
	public static final ImageDescriptor DESC_EXP_OBJ = create(PATH_OBJ, "bundle-exporter.gif"); //$NON-NLS-1$
77
	public static final ImageDescriptor DESC_SERVICE_OBJ = create(PATH_OBJ, "service.gif"); //$NON-NLS-1$
76
78
77
	/*
79
	/*
78
	 * Overlays
80
	 * Overlays
(-)src/org/eclipse/pde/internal/runtime/PDERuntimeMessages.java (-1 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 71-76 Link Here
71
	public static String RegistryBrowser_showExtOnlyLabel;
71
	public static String RegistryBrowser_showExtOnlyLabel;
72
	public static String RegistryBrowser_plugins;
72
	public static String RegistryBrowser_plugins;
73
	public static String RegistryBrowserLabelProvider_contributedBy;
73
	public static String RegistryBrowserLabelProvider_contributedBy;
74
	public static String RegistryBrowserLabelProvider_usedServices;
75
	public static String RegistryBrowserLabelProvider_registeredServices;
74
76
75
	static {
77
	static {
76
		// load message values from bundle file
78
		// load message values from bundle file
(-)src/org/eclipse/pde/internal/runtime/pderuntimeresources.properties (-1 / +3 lines)
Lines 1-5 Link Here
1
###############################################################################
1
###############################################################################
2
# Copyright (c) 2000, 2007 IBM Corporation and others.
2
# Copyright (c) 2000, 2008 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
5
# which accompanies this distribution, and is available at
Lines 28-33 Link Here
28
RegistryBrowser_plugins=plug-ins
28
RegistryBrowser_plugins=plug-ins
29
RegistryBrowserLabelProvider_contributedBy=contributed by: {0}
29
RegistryBrowserLabelProvider_contributedBy=contributed by: {0}
30
RegistryBrowserLabelProvider_nameIdBind={0} [{1}]
30
RegistryBrowserLabelProvider_nameIdBind={0} [{1}]
31
RegistryBrowserLabelProvider_usedServices=Used Services
32
RegistryBrowserLabelProvider_registeredServices=Registered Services
31
RegistryView_titleSummary = Filter matched {0} of {1} {2}.
33
RegistryView_titleSummary = Filter matched {0} of {1} {2}.
32
RegistryView_startAction_label = Start
34
RegistryView_startAction_label = Start
33
RegistryView_stopAction_label = Stop
35
RegistryView_stopAction_label = Stop
(-)src/org/eclipse/pde/internal/runtime/registry/ServiceReferenceAdapter.java (+35 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.runtime.registry;
12
13
import org.osgi.framework.ServiceReference;
14
15
public class ServiceReferenceAdapter extends ParentAdapter {
16
17
	public ServiceReferenceAdapter(ServiceReference object) {
18
		super(object);
19
	}
20
21
	protected Object[] createChildren() {
22
		// TODO pluggable support for different services
23
		return null;
24
	}
25
26
	public boolean equals(Object obj) {
27
		// imitate ServiceReference behavior, that multiple ServiceReference instances are equal
28
		return (obj instanceof ServiceReferenceAdapter) ? getObject().equals(((ServiceReferenceAdapter) obj).getObject()) : false;
29
	}
30
31
	public int hashCode() {
32
		// imitate ServiceReference behavior, that multiple ServiceReference instances return the same hashCode
33
		return getObject().hashCode();
34
	}
35
}
(-)src/org/eclipse/pde/internal/runtime/registry/PluginAdapter.java (+29 lines)
Added Link Here
1
package org.eclipse.pde.internal.runtime.registry;
2
3
import org.eclipse.pde.internal.runtime.registry.RegistryBrowserContentProvider.BundleFolder;
4
import org.osgi.framework.Bundle;
5
6
/**
7
 * Adapter for bundle objects.
8
 *
9
 */
10
public class PluginAdapter extends ParentAdapter {
11
12
	public PluginAdapter(Bundle object) {
13
		super(object);
14
	}
15
16
	protected Object[] createChildren() {
17
		Bundle bundle = (Bundle) getObject();
18
19
		Object[] array = new Object[7];
20
		array[0] = new BundleFolder(bundle, IBundleFolder.F_LOCATION);
21
		array[1] = new BundleFolder(bundle, IBundleFolder.F_IMPORTS);
22
		array[2] = new BundleFolder(bundle, IBundleFolder.F_LIBRARIES);
23
		array[3] = new BundleFolder(bundle, IBundleFolder.F_EXTENSION_POINTS);
24
		array[4] = new BundleFolder(bundle, IBundleFolder.F_EXTENSIONS);
25
		array[5] = new BundleFolder(bundle, IBundleFolder.F_REGISTERED_SERVICES);
26
		array[6] = new BundleFolder(bundle, IBundleFolder.F_SERVICES_IN_USE);
27
		return array;
28
	}
29
}

Return to bug 217738