Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 243441 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/runtime/registry/ConfigurationAttributeAdapter.java (-23 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 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
public class ConfigurationAttributeAdapter extends ParentAdapter {
14
15
	public ConfigurationAttributeAdapter(Object object) {
16
		super(object);
17
	}
18
19
	protected Object[] createChildren() {
20
		return null;
21
	}
22
23
}
(-)src/org/eclipse/pde/internal/runtime/registry/PluginAdapter.java (-39 lines)
Removed 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.eclipse.pde.internal.runtime.registry.RegistryBrowserContentProvider.BundleFolder;
14
import org.osgi.framework.Bundle;
15
16
/**
17
 * Adapter for bundle objects.
18
 *
19
 */
20
public class PluginAdapter extends ParentAdapter {
21
22
	public PluginAdapter(Bundle object) {
23
		super(object);
24
	}
25
26
	protected Object[] createChildren() {
27
		Bundle bundle = (Bundle) getObject();
28
29
		Object[] array = new Object[7];
30
		array[0] = new BundleFolder(bundle, IBundleFolder.F_LOCATION);
31
		array[1] = new BundleFolder(bundle, IBundleFolder.F_IMPORTS);
32
		array[2] = new BundleFolder(bundle, IBundleFolder.F_LIBRARIES);
33
		array[3] = new BundleFolder(bundle, IBundleFolder.F_EXTENSION_POINTS);
34
		array[4] = new BundleFolder(bundle, IBundleFolder.F_EXTENSIONS);
35
		array[5] = new BundleFolder(bundle, IBundleFolder.F_REGISTERED_SERVICES);
36
		array[6] = new BundleFolder(bundle, IBundleFolder.F_SERVICES_IN_USE);
37
		return array;
38
	}
39
}
(-)src/org/eclipse/pde/internal/runtime/registry/IConfigurationAttribute.java (-15 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 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
public interface IConfigurationAttribute {
14
	public String getLabel();
15
}
(-)src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserContentProvider.java (-77 / +6 lines)
Lines 12-103 Link Here
12
12
13
import java.util.*;
13
import java.util.*;
14
import org.eclipse.core.runtime.*;
14
import org.eclipse.core.runtime.*;
15
import org.eclipse.core.runtime.IConfigurationElement;
16
import org.eclipse.core.runtime.IExtensionPoint;
15
import org.eclipse.jface.viewers.ITreeContentProvider;
17
import org.eclipse.jface.viewers.ITreeContentProvider;
16
import org.eclipse.jface.viewers.Viewer;
18
import org.eclipse.jface.viewers.Viewer;
17
import org.eclipse.osgi.util.ManifestElement;
19
import org.eclipse.osgi.util.ManifestElement;
18
import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
20
import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
21
import org.eclipse.pde.internal.runtime.registry.model.*;
22
import org.eclipse.pde.internal.runtime.registry.model.impl.generic.PluginObjectAdapter;
23
import org.eclipse.pde.internal.runtime.registry.model.impl.local.*;
19
import org.osgi.framework.*;
24
import org.osgi.framework.*;
20
25
21
public class RegistryBrowserContentProvider implements ITreeContentProvider {
26
public class RegistryBrowserContentProvider implements ITreeContentProvider {
22
	private Hashtable fExtensionPointMap = new Hashtable();
27
	private Hashtable fExtensionPointMap = new Hashtable();
23
	public boolean isInExtensionSet;
28
	public boolean isInExtensionSet;
24
29
25
	static class BundleFolder implements IBundleFolder {
26
		private int id;
27
		private Bundle bundle;
28
		private Object[] children;
29
30
		public BundleFolder(Bundle pd, int id) {
31
			this.bundle = pd;
32
			this.id = id;
33
		}
34
35
		public Bundle getBundle() {
36
			return bundle;
37
		}
38
39
		public Object[] getChildren() {
40
			if (children == null) {
41
				children = getFolderChildren(bundle, id);
42
			}
43
			return children;
44
		}
45
46
		/**
47
		 * Resets folder's previously cached knowledge about it's children. 
48
		 */
49
		public void refresh() {
50
			children = null;
51
		}
52
53
		public int getFolderId() {
54
			return id;
55
		}
56
57
		public Object getAdapter(Class key) {
58
			return null;
59
		}
60
	}
61
62
	static class BundlePrerequisite implements IBundlePrerequisite {
63
		private ManifestElement underlyingElement;
64
65
		public BundlePrerequisite(ManifestElement element) {
66
			underlyingElement = element;
67
		}
68
69
		public ManifestElement getPrerequisite() {
70
			return underlyingElement;
71
		}
72
73
		public boolean isExported() {
74
			String visibility = underlyingElement.getDirective(Constants.VISIBILITY_DIRECTIVE);
75
			return Constants.VISIBILITY_REEXPORT.equals(visibility);
76
		}
77
78
		public String getLabel() {
79
			String version = underlyingElement.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE);
80
			String value = underlyingElement.getValue();
81
			if (version == null)
82
				return value;
83
			if (Character.isDigit(version.charAt(0)))
84
				version = '(' + version + ')';
85
			return value + ' ' + version;
86
		}
87
	}
88
89
	static class BundleLibrary implements IBundleLibrary {
90
		private ManifestElement underlyingElement;
91
92
		public BundleLibrary(ManifestElement element) {
93
			underlyingElement = element;
94
		}
95
96
		public String getLibrary() {
97
			return underlyingElement.getValue();
98
		}
99
	}
100
101
	/**
30
	/**
102
	 * Creates contents adapter for given folder id.
31
	 * Creates contents adapter for given folder id.
103
	 * @param object Folder contents to be wrapped in adapter
32
	 * @param object Folder contents to be wrapped in adapter
Lines 185-191 Link Here
185
		return null;
114
		return null;
186
	}
115
	}
187
116
188
	protected static Object[] getFolderChildren(Bundle bundle, int id) {
117
	public static Object[] getFolderChildren(Bundle bundle, int id) {
189
		Object[] array = null;
118
		Object[] array = null;
190
		String bundleId = bundle.getSymbolicName();
119
		String bundleId = bundle.getSymbolicName();
191
		switch (id) {
120
		switch (id) {
(-)src/org/eclipse/pde/internal/runtime/registry/IBundlePrerequisite.java (-21 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 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.eclipse.osgi.util.ManifestElement;
14
15
public interface IBundlePrerequisite {
16
	public ManifestElement getPrerequisite();
17
18
	public boolean isExported();
19
20
	public String getLabel();
21
}
(-)src/org/eclipse/pde/internal/runtime/registry/ParentAdapter.java (-27 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 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
public abstract class ParentAdapter extends PluginObjectAdapter {
14
	Object[] fChildren;
15
16
	public ParentAdapter(Object object) {
17
		super(object);
18
	}
19
20
	protected abstract Object[] createChildren();
21
22
	public Object[] getChildren() {
23
		if (fChildren == null)
24
			fChildren = createChildren();
25
		return fChildren;
26
	}
27
}
(-)src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java (+6 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.runtime.registry;
12
package org.eclipse.pde.internal.runtime.registry;
13
13
14
import org.eclipse.pde.internal.runtime.registry.model.impl.generic.PluginObjectAdapter;
15
16
import org.eclipse.pde.internal.runtime.registry.model.impl.local.PluginAdapter;
17
18
import org.eclipse.pde.internal.runtime.registry.model.IBundleFolder;
19
14
import java.util.*;
20
import java.util.*;
15
import java.util.List;
21
import java.util.List;
16
import org.eclipse.core.runtime.*;
22
import org.eclipse.core.runtime.*;
(-)src/org/eclipse/pde/internal/runtime/registry/ExtensionAdapter.java (-33 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 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.eclipse.core.runtime.IConfigurationElement;
14
import org.eclipse.core.runtime.IExtension;
15
16
public class ExtensionAdapter extends ParentAdapter {
17
18
	public ExtensionAdapter(Object object) {
19
		super(object);
20
	}
21
22
	protected Object[] createChildren() {
23
		IExtension extension = (IExtension) getObject();
24
25
		IConfigurationElement[] elements = extension.getConfigurationElements();
26
		Object[] result = new ConfigurationElementAdapter[elements.length];
27
		for (int i = 0; i < elements.length; i++) {
28
			IConfigurationElement config = elements[i];
29
			result[i] = new ConfigurationElementAdapter(config);
30
		}
31
		return result;
32
	}
33
}
(-)src/org/eclipse/pde/internal/runtime/registry/ExtensionPointAdapter.java (-33 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 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.eclipse.core.runtime.IExtension;
14
import org.eclipse.core.runtime.IExtensionPoint;
15
16
public class ExtensionPointAdapter extends ParentAdapter {
17
18
	public ExtensionPointAdapter(Object object) {
19
		super(object);
20
	}
21
22
	protected Object[] createChildren() {
23
		IExtensionPoint extensionPoint = (IExtensionPoint) getObject();
24
25
		IExtension[] extensions = extensionPoint.getExtensions();
26
		Object[] result = new Object[extensions.length];
27
		for (int i = 0; i < extensions.length; i++) {
28
			IExtension extension = extensions[i];
29
			result[i] = new ExtensionAdapter(extension);
30
		}
31
		return result;
32
	}
33
}
(-)src/org/eclipse/pde/internal/runtime/registry/ServiceReferenceAdapter.java (-35 lines)
Removed 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/PluginObjectAdapter.java (-25 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 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.eclipse.core.runtime.PlatformObject;
14
15
public class PluginObjectAdapter extends PlatformObject {
16
	private Object fObject;
17
18
	public PluginObjectAdapter(Object object) {
19
		this.fObject = object;
20
	}
21
22
	public Object getObject() {
23
		return fObject;
24
	}
25
}
(-)src/org/eclipse/pde/internal/runtime/registry/ConfigurationElementAdapter.java (-51 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 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.eclipse.core.runtime.IConfigurationElement;
14
15
public class ConfigurationElementAdapter extends ParentAdapter {
16
17
	class ConfigurationAttribute implements IConfigurationAttribute {
18
		private String fLabel;
19
20
		public ConfigurationAttribute(String name, String value) {
21
			fLabel = name + " = " + value; //$NON-NLS-1$
22
		}
23
24
		public String getLabel() {
25
			return fLabel;
26
		}
27
	}
28
29
	public ConfigurationElementAdapter(Object object) {
30
		super(object);
31
	}
32
33
	protected Object[] createChildren() {
34
		IConfigurationElement config = (IConfigurationElement) getObject();
35
		String[] atts = config.getAttributeNames();
36
		IConfigurationAttribute[] catts = new IConfigurationAttribute[atts.length];
37
		for (int i = 0; i < atts.length; i++)
38
			catts[i] = new ConfigurationAttribute(atts[i], config.getAttribute(atts[i]));
39
		IConfigurationElement[] children = config.getChildren();
40
		Object[] result = new Object[children.length + catts.length];
41
		for (int i = 0; i < children.length; i++) {
42
			IConfigurationElement child = children[i];
43
			result[i] = new ConfigurationElementAdapter(child);
44
		}
45
		for (int i = 0; i < catts.length; i++) {
46
			IConfigurationAttribute child = catts[i];
47
			result[children.length + i] = new ConfigurationAttributeAdapter(child);
48
		}
49
		return result;
50
	}
51
}
(-)src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserListener.java (-1 / +5 lines)
Lines 10-17 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.runtime.registry;
11
package org.eclipse.pde.internal.runtime.registry;
12
12
13
import org.eclipse.pde.internal.runtime.registry.model.impl.generic.PluginObjectAdapter;
14
15
import org.eclipse.pde.internal.runtime.registry.model.impl.local.*;
16
13
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
14
import org.eclipse.pde.internal.runtime.registry.RegistryBrowserContentProvider.BundleFolder;
18
import org.eclipse.pde.internal.runtime.registry.model.IBundleFolder;
15
import org.eclipse.swt.widgets.Tree;
19
import org.eclipse.swt.widgets.Tree;
16
import org.eclipse.swt.widgets.TreeItem;
20
import org.eclipse.swt.widgets.TreeItem;
17
import org.osgi.framework.*;
21
import org.osgi.framework.*;
(-)src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserLabelProvider.java (+10 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.runtime.registry;
11
package org.eclipse.pde.internal.runtime.registry;
12
12
13
import org.eclipse.pde.internal.runtime.registry.model.impl.generic.PluginObjectAdapter;
14
15
import org.eclipse.pde.internal.runtime.registry.model.IConfigurationAttribute;
16
17
import org.eclipse.pde.internal.runtime.registry.model.IBundlePrerequisite;
18
19
import org.eclipse.pde.internal.runtime.registry.model.IBundleLibrary;
20
21
import org.eclipse.pde.internal.runtime.registry.model.IBundleFolder;
22
13
import java.io.IOException;
23
import java.io.IOException;
14
import java.net.URL;
24
import java.net.URL;
15
import java.util.Arrays;
25
import java.util.Arrays;
(-)src/org/eclipse/pde/internal/runtime/registry/IBundleFolder.java (-32 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 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.eclipse.core.runtime.IAdaptable;
14
import org.osgi.framework.Bundle;
15
16
public interface IBundleFolder extends IAdaptable {
17
	public static final int F_LOCATION = 0;
18
	public static final int F_EXTENSIONS = 1;
19
	public static final int F_EXTENSION_POINTS = 2;
20
	public static final int F_IMPORTS = 3;
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;
24
25
	public Object[] getChildren();
26
27
	public void refresh();
28
29
	int getFolderId();
30
31
	public Bundle getBundle();
32
}
(-)src/org/eclipse/pde/internal/runtime/registry/IBundleLibrary.java (-15 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 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
public interface IBundleLibrary {
14
	public String getLibrary();
15
}
(-)META-INF/MANIFEST.MF (+3 lines)
Lines 17-22 Link Here
17
Eclipse-LazyStart: true
17
Eclipse-LazyStart: true
18
Export-Package: org.eclipse.pde.internal.runtime;x-internal:=true,
18
Export-Package: org.eclipse.pde.internal.runtime;x-internal:=true,
19
 org.eclipse.pde.internal.runtime.registry;x-internal:=true,
19
 org.eclipse.pde.internal.runtime.registry;x-internal:=true,
20
 org.eclipse.pde.internal.runtime.registry.model;x-internal:=true,
21
 org.eclipse.pde.internal.runtime.registry.model.impl.generic;x-internal:=true,
22
 org.eclipse.pde.internal.runtime.registry.model.impl.local;x-internal:=true,
20
 org.eclipse.pde.internal.runtime.spy;x-internal:=true,
23
 org.eclipse.pde.internal.runtime.spy;x-internal:=true,
21
 org.eclipse.pde.internal.runtime.spy.dialogs;x-internal:=true,
24
 org.eclipse.pde.internal.runtime.spy.dialogs;x-internal:=true,
22
 org.eclipse.pde.internal.runtime.spy.handlers;x-internal:=true,
25
 org.eclipse.pde.internal.runtime.spy.handlers;x-internal:=true,
(-)src/org/eclipse/pde/internal/runtime/registry/model/IRegistryModel.java (+14 lines)
Added Link Here
1
package org.eclipse.pde.internal.runtime.registry.model;
2
3
public interface IRegistryModel {
4
5
	void connect();
6
7
	IBundle[] getBundles();
8
9
	IService[] getServices();
10
11
	IExtensionPoint[] getExtensionPoints();
12
13
	void disconnect();
14
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/IModelObject.java (+8 lines)
Added Link Here
1
package org.eclipse.pde.internal.runtime.registry.model;
2
3
4
public interface IModelObject {
5
6
	IModelObject getParent();
7
8
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/IExtension.java (+5 lines)
Added Link Here
1
package org.eclipse.pde.internal.runtime.registry.model;
2
3
public interface IExtension extends IModelObject {
4
5
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/impl/generic/ConfigurationAttribute.java (+24 lines)
Added Link Here
1
/**
2
 * 
3
 */
4
package org.eclipse.pde.internal.runtime.registry.model.impl.generic;
5
6
import org.eclipse.pde.internal.runtime.registry.model.IConfigurationAttribute;
7
import org.eclipse.pde.internal.runtime.registry.model.IModelObject;
8
9
public class ConfigurationAttribute implements IConfigurationAttribute {
10
	private String fLabel;
11
12
	public ConfigurationAttribute(String name, String value) {
13
		fLabel = name + " = " + value; //$NON-NLS-1$
14
	}
15
16
	public String getLabel() {
17
		return fLabel;
18
	}
19
20
	public IModelObject getParent() {
21
		// TODO Auto-generated method stub
22
		return null;
23
	}
24
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/IBundle.java (+5 lines)
Added Link Here
1
package org.eclipse.pde.internal.runtime.registry.model;
2
3
public interface IBundle extends IModelObject {
4
5
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/impl/generic/ParentAdapter.java (+28 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 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.model.impl.generic;
12
13
14
public abstract class ParentAdapter extends PluginObjectAdapter {
15
	Object[] fChildren;
16
17
	public ParentAdapter(Object object) {
18
		super(object);
19
	}
20
21
	protected abstract Object[] createChildren();
22
23
	public Object[] getChildren() {
24
		if (fChildren == null)
25
			fChildren = createChildren();
26
		return fChildren;
27
	}
28
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/IBundleFolder.java (+31 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 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.model;
12
13
import org.osgi.framework.Bundle;
14
15
public interface IBundleFolder extends IModelObject {
16
	public static final int F_LOCATION = 0;
17
	public static final int F_EXTENSIONS = 1;
18
	public static final int F_EXTENSION_POINTS = 2;
19
	public static final int F_IMPORTS = 3;
20
	public static final int F_LIBRARIES = 4;
21
	public static final int F_REGISTERED_SERVICES = 5;
22
	public static final int F_SERVICES_IN_USE = 6;
23
24
	public Object[] getChildren();
25
26
	public void refresh();
27
28
	int getFolderId();
29
30
	public Bundle getBundle();
31
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/IBundleLibrary.java (+15 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 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.model;
12
13
public interface IBundleLibrary extends IModelObject {
14
	public String getLibrary();
15
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/impl/local/ExtensionPointAdapter.java (+35 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 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.model.impl.local;
12
13
import org.eclipse.pde.internal.runtime.registry.model.impl.generic.ParentAdapter;
14
15
import org.eclipse.core.runtime.IExtension;
16
import org.eclipse.core.runtime.IExtensionPoint;
17
18
public class ExtensionPointAdapter extends ParentAdapter {
19
20
	public ExtensionPointAdapter(Object object) {
21
		super(object);
22
	}
23
24
	protected Object[] createChildren() {
25
		IExtensionPoint extensionPoint = (IExtensionPoint) getObject();
26
27
		IExtension[] extensions = extensionPoint.getExtensions();
28
		Object[] result = new Object[extensions.length];
29
		for (int i = 0; i < extensions.length; i++) {
30
			IExtension extension = extensions[i];
31
			result[i] = new ExtensionAdapter(extension);
32
		}
33
		return result;
34
	}
35
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/impl/local/ExtensionAdapter.java (+36 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 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.model.impl.local;
12
13
import org.eclipse.pde.internal.runtime.registry.model.impl.generic.ParentAdapter;
14
15
16
import org.eclipse.core.runtime.IConfigurationElement;
17
import org.eclipse.core.runtime.IExtension;
18
19
public class ExtensionAdapter extends ParentAdapter {
20
21
	public ExtensionAdapter(Object object) {
22
		super(object);
23
	}
24
25
	protected Object[] createChildren() {
26
		IExtension extension = (IExtension) getObject();
27
28
		IConfigurationElement[] elements = extension.getConfigurationElements();
29
		Object[] result = new ConfigurationElementAdapter[elements.length];
30
		for (int i = 0; i < elements.length; i++) {
31
			IConfigurationElement config = elements[i];
32
			result[i] = new ConfigurationElementAdapter(config);
33
		}
34
		return result;
35
	}
36
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/impl/local/ServiceReferenceAdapter.java (+37 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.model.impl.local;
12
13
import org.eclipse.pde.internal.runtime.registry.model.impl.generic.ParentAdapter;
14
15
import org.osgi.framework.ServiceReference;
16
17
public class ServiceReferenceAdapter extends ParentAdapter {
18
19
	public ServiceReferenceAdapter(ServiceReference object) {
20
		super(object);
21
	}
22
23
	protected Object[] createChildren() {
24
		// TODO pluggable support for different services
25
		return null;
26
	}
27
28
	public boolean equals(Object obj) {
29
		// imitate ServiceReference behavior, that multiple ServiceReference instances are equal
30
		return (obj instanceof ServiceReferenceAdapter) ? getObject().equals(((ServiceReferenceAdapter) obj).getObject()) : false;
31
	}
32
33
	public int hashCode() {
34
		// imitate ServiceReference behavior, that multiple ServiceReference instances return the same hashCode
35
		return getObject().hashCode();
36
	}
37
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/IBundlePrerequisite.java (+21 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 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.model;
12
13
import org.eclipse.osgi.util.ManifestElement;
14
15
public interface IBundlePrerequisite extends IModelObject {
16
	public ManifestElement getPrerequisite();
17
18
	public boolean isExported();
19
20
	public String getLabel();
21
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/impl/local/ConfigurationElementAdapter.java (+46 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 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.model.impl.local;
12
13
14
import org.eclipse.pde.internal.runtime.registry.model.impl.generic.ParentAdapter;
15
16
import org.eclipse.pde.internal.runtime.registry.model.impl.generic.ConfigurationAttribute;
17
18
import org.eclipse.pde.internal.runtime.registry.model.IConfigurationAttribute;
19
20
import org.eclipse.core.runtime.IConfigurationElement;
21
22
public class ConfigurationElementAdapter extends ParentAdapter {
23
24
	public ConfigurationElementAdapter(Object object) {
25
		super(object);
26
	}
27
28
	protected Object[] createChildren() {
29
		IConfigurationElement config = (IConfigurationElement) getObject();
30
		String[] atts = config.getAttributeNames();
31
		IConfigurationAttribute[] catts = new IConfigurationAttribute[atts.length];
32
		for (int i = 0; i < atts.length; i++)
33
			catts[i] = new ConfigurationAttribute(atts[i], config.getAttribute(atts[i]));
34
		IConfigurationElement[] children = config.getChildren();
35
		Object[] result = new Object[children.length + catts.length];
36
		for (int i = 0; i < children.length; i++) {
37
			IConfigurationElement child = children[i];
38
			result[i] = new ConfigurationElementAdapter(child);
39
		}
40
		for (int i = 0; i < catts.length; i++) {
41
			IConfigurationAttribute child = catts[i];
42
			result[children.length + i] = new ConfigurationAttributeAdapter(child);
43
		}
44
		return result;
45
	}
46
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/IExtensionPoint.java (+5 lines)
Added Link Here
1
package org.eclipse.pde.internal.runtime.registry.model;
2
3
public interface IExtensionPoint extends IModelObject {
4
5
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/impl/local/BundlePrerequisite.java (+41 lines)
Added Link Here
1
/**
2
 * 
3
 */
4
package org.eclipse.pde.internal.runtime.registry.model.impl.local;
5
6
import org.eclipse.osgi.util.ManifestElement;
7
import org.eclipse.pde.internal.runtime.registry.model.IBundlePrerequisite;
8
import org.eclipse.pde.internal.runtime.registry.model.IModelObject;
9
import org.osgi.framework.Constants;
10
11
public class BundlePrerequisite implements IBundlePrerequisite {
12
	private ManifestElement underlyingElement;
13
14
	public BundlePrerequisite(ManifestElement element) {
15
		underlyingElement = element;
16
	}
17
18
	public ManifestElement getPrerequisite() {
19
		return underlyingElement;
20
	}
21
22
	public boolean isExported() {
23
		String visibility = underlyingElement.getDirective(Constants.VISIBILITY_DIRECTIVE);
24
		return Constants.VISIBILITY_REEXPORT.equals(visibility);
25
	}
26
27
	public String getLabel() {
28
		String version = underlyingElement.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE);
29
		String value = underlyingElement.getValue();
30
		if (version == null)
31
			return value;
32
		if (Character.isDigit(version.charAt(0)))
33
			version = '(' + version + ')';
34
		return value + ' ' + version;
35
	}
36
37
	public IModelObject getParent() {
38
		// TODO Auto-generated method stub
39
		return null;
40
	}
41
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/RegistryModelFactory.java (+22 lines)
Added Link Here
1
package org.eclipse.pde.internal.runtime.registry.model;
2
3
import java.net.URL;
4
5
/**
6
 * Produces RegistryModels for URLs. Valid URLs:
7
 * local
8
 * target
9
 * remote://host:port
10
 *
11
 */
12
public class RegistryModelFactory {
13
14
	/**
15
	 * 
16
	 * @param codename
17
	 * @return never returns null
18
	 */
19
	public IRegistryModel getRegistryModel(URL codename) {
20
		return null;
21
	}
22
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/impl/generic/PluginObjectAdapter.java (+25 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 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.model.impl.generic;
12
13
import org.eclipse.core.runtime.PlatformObject;
14
15
public class PluginObjectAdapter extends PlatformObject {
16
	private Object fObject;
17
18
	public PluginObjectAdapter(Object object) {
19
		this.fObject = object;
20
	}
21
22
	public Object getObject() {
23
		return fObject;
24
	}
25
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/IConfigurationAttribute.java (+15 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 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.model;
12
13
public interface IConfigurationAttribute extends IModelObject {
14
	public String getLabel();
15
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/IService.java (+5 lines)
Added Link Here
1
package org.eclipse.pde.internal.runtime.registry.model;
2
3
public interface IService extends IModelObject {
4
5
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/impl/local/ConfigurationAttributeAdapter.java (+25 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 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.model.impl.local;
12
13
import org.eclipse.pde.internal.runtime.registry.model.impl.generic.ParentAdapter;
14
15
public class ConfigurationAttributeAdapter extends ParentAdapter {
16
17
	public ConfigurationAttributeAdapter(Object object) {
18
		super(object);
19
	}
20
21
	protected Object[] createChildren() {
22
		return null;
23
	}
24
25
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/IConfigurationElement.java (+5 lines)
Added Link Here
1
package org.eclipse.pde.internal.runtime.registry.model;
2
3
public interface IConfigurationElement extends IModelObject {
4
5
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/impl/local/BundleFolder.java (+51 lines)
Added Link Here
1
/**
2
 * 
3
 */
4
package org.eclipse.pde.internal.runtime.registry.model.impl.local;
5
6
import org.eclipse.pde.internal.runtime.registry.RegistryBrowserContentProvider;
7
import org.eclipse.pde.internal.runtime.registry.model.IBundleFolder;
8
import org.eclipse.pde.internal.runtime.registry.model.IModelObject;
9
import org.osgi.framework.Bundle;
10
11
public class BundleFolder implements IBundleFolder {
12
	private int id;
13
	private Bundle bundle;
14
	private Object[] children;
15
16
	public BundleFolder(Bundle pd, int id) {
17
		this.bundle = pd;
18
		this.id = id;
19
	}
20
21
	public Bundle getBundle() {
22
		return bundle;
23
	}
24
25
	public Object[] getChildren() {
26
		if (children == null) {
27
			children = RegistryBrowserContentProvider.getFolderChildren(bundle, id);
28
		}
29
		return children;
30
	}
31
32
	/**
33
	 * Resets folder's previously cached knowledge about it's children. 
34
	 */
35
	public void refresh() {
36
		children = null;
37
	}
38
39
	public int getFolderId() {
40
		return id;
41
	}
42
43
	public Object getAdapter(Class key) {
44
		return null;
45
	}
46
47
	public IModelObject getParent() {
48
		// TODO Auto-generated method stub
49
		return null;
50
	}
51
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/impl/local/PluginAdapter.java (+41 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.model.impl.local;
12
13
import org.eclipse.pde.internal.runtime.registry.model.impl.generic.ParentAdapter;
14
15
import org.eclipse.pde.internal.runtime.registry.model.IBundleFolder;
16
import org.osgi.framework.Bundle;
17
18
/**
19
 * Adapter for bundle objects.
20
 *
21
 */
22
public class PluginAdapter extends ParentAdapter {
23
24
	public PluginAdapter(Bundle object) {
25
		super(object);
26
	}
27
28
	protected Object[] createChildren() {
29
		Bundle bundle = (Bundle) getObject();
30
31
		Object[] array = new Object[7];
32
		array[0] = new BundleFolder(bundle, IBundleFolder.F_LOCATION);
33
		array[1] = new BundleFolder(bundle, IBundleFolder.F_IMPORTS);
34
		array[2] = new BundleFolder(bundle, IBundleFolder.F_LIBRARIES);
35
		array[3] = new BundleFolder(bundle, IBundleFolder.F_EXTENSION_POINTS);
36
		array[4] = new BundleFolder(bundle, IBundleFolder.F_EXTENSIONS);
37
		array[5] = new BundleFolder(bundle, IBundleFolder.F_REGISTERED_SERVICES);
38
		array[6] = new BundleFolder(bundle, IBundleFolder.F_SERVICES_IN_USE);
39
		return array;
40
	}
41
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/impl/local/BundleLibrary.java (+25 lines)
Added Link Here
1
/**
2
 * 
3
 */
4
package org.eclipse.pde.internal.runtime.registry.model.impl.local;
5
6
import org.eclipse.osgi.util.ManifestElement;
7
import org.eclipse.pde.internal.runtime.registry.model.IBundleLibrary;
8
import org.eclipse.pde.internal.runtime.registry.model.IModelObject;
9
10
public class BundleLibrary implements IBundleLibrary {
11
	private ManifestElement underlyingElement;
12
13
	public BundleLibrary(ManifestElement element) {
14
		underlyingElement = element;
15
	}
16
17
	public String getLibrary() {
18
		return underlyingElement.getValue();
19
	}
20
21
	public IModelObject getParent() {
22
		// TODO Auto-generated method stub
23
		return null;
24
	}
25
}

Return to bug 243441