Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Change background color of in text editor selected words
Change background color of in text editor selected words [message #1007763] Thu, 07 February 2013 07:39 Go to next message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 695
Registered: November 2009
Senior Member
Hello,

I use the following code in a SelectionListener to change the background color of the word currently selected.

sourceViewer.getTextWidget().setStyleRange(new StyleRange(new TextStyle(null, black, grey)));


The problem is that nothing happens and no Exception is thrown. What do I miss here? Is there a other way to do it?

Ralph
Re: Change background color of in text editor selected words [message #1008173 is a reply to message #1007763] Mon, 11 February 2013 04:19 Go to previous message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 695
Registered: November 2009
Senior Member
Hi all,

I solved it by adding an Annotation of type org.eclipse.jdt.ui.occurrences to the word where the cursor is placed.

Ralph
Previous Topic:Is there a way to show welcome page in editor area?
Next Topic:Setting the image of a viewreference programmatically
Goto Forum:
  


Current Time: Wed Apr 16 20:59:55 EDT 2014

Powered by FUDForum. Page generated in 0.02159 seconds