How to highlight a line range in gutter bar?

For an example if I want to highlight from line number 11 to 25 of a certain file how can I do that? And also I want to add multiple highlights to the same file with several colors. Idea already does this as shown in the follwing screenshot.

Capture18.PNG

5 comments
Comment actions Permalink

Use editor.getMarkupModel().addRangeHighlighter() and RangeHighlighter.setErrorStripeMarkColor(). You can create as many such highlighters as you need.

0
Comment actions Permalink

Hi Dimitri, I tried it and could only get text highlighted. What I want to do is to add highlights to the gutter bar as I have shown in the above photo.

0
Comment actions Permalink

Please show the code that you tried to use.


0
Comment actions Permalink

I tried it again and now it works :) thank you Dimitry.

0
Comment actions Permalink

Hi Kasun, I too tried Dmitry's solution, However I am not able to get the gutter Icons. I dont know if thats because I am adding the editor to a Jframe. Can you post your code/ tell what have you done to get the gutter icons?
Thanks
Preetam

0

Please sign in to leave a comment.