[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.jdt] Re: Using CompilationUnitEditor without a .java file?

David Coppit wrote:

Hi all,

I'm implementing an editor for Java source code, where the source is unpacked from another file. As a result, there is no .java resource in the project. Can someone give me some guidance on how best to set up a CompilationUnitEditor to code from a buffer in memory?

It should be sufficient to write your own editor input and then use IDE.openEditor(page, editorInput, editorID). What stopped this from working?


Dani


Here's what I've done so far:

- I created a new input derived from IStorageEditorInput.
- I created a new document provider derived from StorageDocumentProvider.
- I created a new editor derived from CompilationUnitEditor that sets the document provider to my document provider in the constructor.


What I'm fuzzy on is where exactly the file dependencies are. It's pretty clear that CompilationUnitDocumentProvider assumes a file, and that CompilationUnitEditor tests the document provider against ICompilationUnitDocumentProvider. Is this the only file dependency in CompilationUnitEditor? If so, would it be sufficient to have my document provider implement ICompilationUnitDocumentProvider?

Thanks,
David