Sunday, January 06, 2008

Integration with java projects

The only thing keeping me from doing a new release is having the integration with JDT finished.

Pydev is already able (in the cvs version) to deal with java projects in a basic level (code-completion is there), but some things as find definition (among others) are missing.

Currently when a request for getting the completions is issued, a wrapper to manage referenced java projects is created (and that reference will be kept until the completion finishes) -- that's done in ProjectModulesManager#addModuleManagers

That 'modules manager' for java (namely: JavaProjectModulesManager) is able to create the java modules for classes it's able to resolve in that project: JavaProjectModulesManager#getModuleInDirectManager (modules that come from the system configuration are discarded -- that's handled in the jython system configuration already)

In that structure, each java class is internally mapping to a jython module and the completions are gathered from those modules -- those completions are transformed into ITokens to fit nicely the internal structure:
- AbstractJavaClassModule: has a collector for getting the completions and transforming them to ITokens;
- JavaClassModuleInProject: uses that collector for getting tokens at a java project;
- JavaZipClassModule: uses that collector for getting tokens in the system jars.

Yesterday I spent most of the day setting up a unit-test so that I could test those things (JavaClassModuleTestWorkbench), but now that it's done, I hope things will flow better in that integration (those JDT APIs are not really done for use outside of the JDT structure, so I've spent lot's of time to make it work -- and I'll probably spend some more time to make it work 'right'...)

Some of the doubts I had in the process:
JDT code-completion for external jar in non java project: Implemented at: JavaZipClassModule

API to find out about available JDT packages/classes in a project: Implemented at: JavaClassModuleInProject

No comments: