Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » (no subject)
(no subject) [message #723063] Wed, 07 September 2011 14:14 Go to next message
Federico Tomassetti is currently offline Federico TomassettiFriend
Messages: 190
Registered: July 2009
Location: Dublin
Senior Member

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 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
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...
Previous Topic:How to identify unused properties in eclipse
Next Topic:Distinguishing Quick Fix Popup vs. Content Assist Popup
Goto Forum:
  


Current Time: Wed Apr 24 15:11:20 GMT 2024

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

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

Back to the top