Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-ui-dev] Best way to implement plugin for compound java files?

Hi all,

First, sorry to intrude on the developer's list, but I'm searching for
experts on JDT internals. I tried eclipse.platform and eclipse.tools.jdt
without much luck.

I'm implementing a plugin that extracts multiple java files from a single
file and displays it in multiple editors (actually a MultiPageEditorPart).
In order to get all the Java goodies my editor subclasses
CompilationUnitEditor. (I know, there be dragons...) Because some portions
of the java files are shared, I need to synchronize some edits between
editors. Only one of these views will be compiled--for that I plan a
builder that invokes the normal Java builder.

My question: How should I go about implementing compound documents?

My first crack at it was to subclass IEditorInput, thinking that this
subclass would give each editor a partial view on the file. But it seems
to me that CompilationUnitEditor expects an IFileEditorInput for saving
and whatnot. At least, I can't yet get it to work with just an
IEditorInput-derived class.

Another approach might be to create derived .java resources from the
master compound document, and try to manage the compound document by
trapping all edits to the derived files. My editor currently can open
separate .java files in the workspace, but is it possible to synchronize
the editors, and filter the workspace so that the derived .java files are
not visible to the user or the compiler?

But now I'm thinking that I should create a custom document provider: one
that stitches together fragments from the original file? (Code folding
doesn't exactly do what I want since the fragments may appear in different
orders in different editors.) If I go this route, will I still be
compatible with JDT features such as code folding?

Thanks for the advice,
David


Back to the top