Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Using CompilationUnitEditor without a .java file?
Using CompilationUnitEditor without a .java file? [message #227093] Mon, 03 April 2006 21:45 Go to next message
Eclipse UserFriend
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?

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
Re: Using CompilationUnitEditor without a .java file? [message #227235 is a reply to message #227093] Tue, 04 April 2006 15:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daniel.megert.eclipse.org

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
Re: Using CompilationUnitEditor without a .java file? [message #227384 is a reply to message #227235] Thu, 06 April 2006 17:55 Go to previous messageGo to next message
Eclipse UserFriend
Daniel Megert wrote:

>> 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?

My editor is being opened in a page of a MultiPageEditor. openEditor is
for a top-level editor. I did try what you suggested anyway, and I did
get syntax highlighting, but not the annotations ruler.

So I gave up on an in-memory editor input. Now I create temporary files
in the workspace, and that seems to work well. I'll end up filtering
them out of the workspace view so that the user doesn't notice.

David
Re: Using CompilationUnitEditor without a .java file? [message #227456 is a reply to message #227384] Sun, 09 April 2006 12:20 Go to previous message
Eclipse UserFriend
Originally posted by: daniel.megert.eclipse.org

David Coppit wrote:

> Daniel Megert wrote:
>
>>> 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?
>
>
> My editor is being opened in a page of a MultiPageEditor. openEditor
> is for a top-level editor. I did try what you suggested anyway, and I
> did get syntax highlighting, but not the annotations ruler.

Which build did you use?

Dani

>
> So I gave up on an in-memory editor input. Now I create temporary
> files in the workspace, and that seems to work well. I'll end up
> filtering them out of the workspace view so that the user doesn't notice.
>
> David
Previous Topic:Zip Files incompatible with Windows XP Shell
Next Topic:Newbie needs help: How does javadoc capture highlighting??? NEED HELP REAL BAD!
Goto Forum:
  


Current Time: Thu Nov 06 23:40:42 EST 2025

Powered by FUDForum. Page generated in 0.25251 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top