|
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) { |