(no subject) [message #723063] |
Wed, 07 September 2011 14:14  |
Eclipse User |
|
|
|
Hi, I would like to programmatically mark a given IJavaElement with a specific background color. Which is the best way to do it?
I can open the editor corresponding to the element:
editorPart = JavaUI.openInEditor(elementToShow);
if (editorPart != null)
JavaUI.revealInEditor(editorPart, elementToShow);
and find start and end position of the element inside the editor:
int startCol = element.getColumnNumber(0);
int startLine = element.getLineNumber(0);
int endCol = element.getColumnNumber(cu.getLength()-1);
int endLine = element.getLineNumber(cu.getLength()-1);
but then I am stuck...
--
website: http://www.federico-tomassetti.it
|
|
|
Re: Change background for a given IJavaElement [message #725193 is a reply to message #723063] |
Wed, 14 September 2011 07:54  |
Eclipse User |
|
|
|
On 07.09.2011 16:14, Federico Tomassetti wrote:
> Hi, I would like to programmatically mark a given IJavaElement with a
> specific background color. Which is the best way to do it?
Add your own annotations to the document. This might help:
http://www.eclipse.org/eclipse/platform-text/eclipseCon/2006/texteditorrecipes.pdf
Dani
>
> I can open the editor corresponding to the element:
>
>
> editorPart = JavaUI.openInEditor(elementToShow);
> if (editorPart != null)
>
> JavaUI.revealInEditor(editorPart, elementToShow);
>
>
> and find start and end position of the element inside the editor:
>
>
> int startCol = element.getColumnNumber(0);
> int startLine = element.getLineNumber(0);
> int endCol = element.getColumnNumber(cu.getLength()-1);
> int endLine = element.getLineNumber(cu.getLength()-1);
>
>
> but then I am stuck...
|
|
|
Powered by
FUDForum. Page generated in 0.08101 seconds