[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Re: How to highlight lines in Text Editor

"Lisa" wrote.
> I am trying to highlight lines of text in my Text Editor. I found if I use
>
> textEditor.setHighlightRange();
>
> textEditor.showHighlightRangeOnly(truee);
>
> textEditor.selectAndReveal();
>
> I can get text selected with some background color. But the selection will
> go away if I click on the editor.
>
> Are there any way to do the highlight but the select will not go away?
>

If it is your Text Editor, you could use

  org.eclipse.swt.custom.StyledText#setLineBackground(int,int,Color)

as a alternative. Or create a LineBackgroundListener for the StyledText.
If you use it, you have to be aware of the text colors. The line background
color is independent from the selection mechanism and a selection would
"override" the background color. (AFAIK)

--
Harald