| Summary: | Remove type from extension point for custom controls | ||
|---|---|---|---|
| Product: | [Modeling] ECP | Reporter: | Harald Stangl <stanglh> |
| Component: | Common | Assignee: | Jonas Helming <jhelming> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | corrmage, jhelming, mkoegel |
| Version: | unspecified | ||
| Target Milestone: | 0.8.9 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Harald Stangl
Or, ECP can load class by name using more complicated way than Class.forName, which doesn't work, because Editor plugin doesn't import user plugins (packages), so It can't "see" class. that is correct, the type should be removed fixed in master what would be this "more complicated way" something like this:
Bundle b = Activator.getDefault().getBundle();
ServiceReference<PackageAdmin> sr = b.getBundleContext().getServiceReference(PackageAdmin.class);
PackageAdmin pa = b.getBundleContext().getService(sr);
String typeName = e.getAttribute("type");
String packageName = forClass.substring(0, forClass.lastIndexOf("."));
ExportedPackage pkg = pa.getExportedPackage(packageName);
Bundle neededBundle = pkg.getExportingBundle();
Class<?> cls = neededBundle.loadClass(typeName);
I'm not OSGi expert, maybe there is more right way to load class from bundle (because PackageAdmin service is obsolete in OSGi), about which ecp editor bundle doesn't know.
Thanks for this hint, that looks interesting. I actually thought it trough. The only reason to offer the type attribute is to allow a filtering of widgets in a declaritive way. We have another filter mechnism in the canrender method. I do not think this is really performance critical, so it might also be sufficient to just remove the type attribute. This makes the API simpler. What do you think? |