Syntax Coloring for a Non-File based Editor [message #336137] |
Tue, 26 May 2009 07:30 |
Eclipse User |
|
|
|
Originally posted by: pajai.extrabright.com
Hi everybody,
I am trying to get the syntax coloring working when setting an editor's
content programmatically (for an existing editor, e.g. the Java one),
but I have not come to a solution until now. I am not able to set the
content type programmatically. The syntax coloring appears to work only
when opening a file which extension is defined in the
org.eclipse.ui.editors extension point.
What I am doing until now:
- define MyEditorInput extending IEditorInput
- define MyDocumentProvider extending AbstractDocumentProvider and
override createDocument, where I return a Document with the content I
want if getting a parameter of type MyEditorInput. (I tried to override
the method getContentType(Object), but it is never called.)
- Open the Java editor programmatically with my custom input.
Anyone has an idea what I should do for the syntax coloring to work or
how I can set the content type programmatically?
Thanks in advance.
Cheers,
Patrick
|
|
|
|
|
Re: Syntax Coloring for a Non-File based Editor [message #336213 is a reply to message #336137] |
Fri, 29 May 2009 18:13 |
|
Patrick J. wrote:
> Hi everybody,
>
> I am trying to get the syntax coloring working when setting an editor's
> content programmatically (for an existing editor, e.g. the Java one),
> but I have not come to a solution until now. I am not able to set the
> content type programmatically. The syntax coloring appears to work only
> when opening a file which extension is defined in the
> org.eclipse.ui.editors extension point.
>
> What I am doing until now:
>
> - define MyEditorInput extending IEditorInput
>
> - define MyDocumentProvider extending AbstractDocumentProvider and
> override createDocument, where I return a Document with the content I
> want if getting a parameter of type MyEditorInput. (I tried to override
> the method getContentType(Object), but it is never called.)
>
> - Open the Java editor programmatically with my custom input.
Have you tried implementing IStorageEditorInput and *not* overriding
the document provider?
--
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
Powered by
FUDForum. Page generated in 0.03021 seconds