Questions about OSGi plugin development

Hi all,

We're using OSGi extensively in our project, and I'm starting to wish IDEA had some support for it. I'm looking into developing something fairly modest supporting only editing features at the moment, and I'd like some advice on how easy this would be to implement. I think it will come down to how much control OpenAPI gives over the classpath and the import procedure.

The basic features should be:

1. A new module type of bundle. This should have the usual creation features to generate a default bundle structure.
2. The classpath of this module should be restricted to the classpath defined in the manifest, i.e. a subset of all classes available in the project, defined as a list of packages. The dependencies between modules should be automatically maintained based on which imports/exports each defines.
3. When IntelliJ wants to import a class, initially it should only display classes available according to the manifest. If it's possible to control the classpath of a module at a reasonably fine level this should be automatic following step 2.
4. If a class not allowed in the manifest is imported (probably using Ctrl-Alt-Space), an import should be automatically added to the manifest.
5. If an imported class is not exported by the bundle in which it is defined, an error should be shown with a quickfix to add the export to the other bundle.
6. The classpath for the module should be used for compilation, and it should ensure that classes in the classpath are exported by the appropriate bundles.

So all this really requires:
1. Programmatic access to modules and their attributes.
2. Fine-grained control over the classpath of each module, including compilation.
3. Hooks into the automatic import functionality.

Is this possible?

Thanks for any advice,

Please sign in to leave a comment.