1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| private String[] _getClassesNames (final String packageName, final String pluginName)
// -----------------------------------------------------------------
{
Vector<String> items = new Vector<String>();
Bundle[] bs = Topics_Plugin.context.getBundles();
String pckgName = new String(packageName);
if (!packageName.startsWith("/"))
{
pckgName = "/" + packageName;
}
pckgName = packageName.replace('.', '/');
if (bs.length > 0) {
for (Bundle b : bs) {
if (b.getSymbolicName().startsWith(pluginName)) {
URL url = b.getResource(pckgName);
if (url != null) {
Enumeration<URL> e = b.findEntries("/", null, true);
while (e.hasMoreElements()) {
URL i = e.nextElement();
String path = i.getPath();
if (path.endsWith(".class")) {
if (path.indexOf(pckgName) != -1) {
String className = path.substring(pckgName.length() + 6, path.length() - 6);
items.add(className);
}
}
}
}
}
}
}
String[] classesNameT = items.toArray(new String[0]);
return classesNameT;
} |
Partager