Refresh Open Editor After Adding RangeHighlighter

I am adding and removing RangeHighlighters from MarkupModels.  When I do this in response to a change made in the currently open file then the highlighter is correctly added or removed from the gutter of the open editor.  But if add or remove highlighters from other open but not currently selected editors then the highlighter is not correctly displayed when the user switches to the that editor.  As soon as the file in that editor is modified the highlighter is correctly displayed.  How do I force IDEA to refresh the RangeHighlighters for a given editor or file?

Thanks,

Rod

5 comments
Comment actions Permalink

Hello Roderick,

What are you trying to achieve? Our API is designed with the assumption that
all highlighting happens only in a visible editor.

I am adding and removing RangeHighlighters from MarkupModels. When I
do this in response to a change made in the currently open file then
the highlighter is correctly added or removed from the gutter of the
open editor. But if add or remove highlighters from other open but
not currently selected e

ditors then the highlighter is not correctly displayed when the user
switches to the that editor. As soon as the file in that editor is
modified the highlighter is correctly displayed. How do I force IDEA
to refresh the RangeHighlighters for a given editor or file?

Thanks,

Rod

---
Original message URL:
http://www.jetbrains.net/devnet/message/5239105#5239105

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Hi Dmitry,

Thanks for your offer of help!  I am trying to place a gutter annotation on particular lines in Java classes in response to asynchronous testing events.  These classes may already be open in an editor, may be open but not visible, or may not be opened yet at all.  As I mentioned the approach I am currently using is to add a RangeHighlight with a GutterIconRenderer to the appropriate MarkupModels.  I am opened to other approaches as well, what would you recommend?

Thanks,

Rod

0
Comment actions Permalink

Hello Roderick,

You should store the lines to be annotated in your own model, and create
a highlighting pass or a LineMarkerProvider to place the information from
your model into the editor.

Thanks for your offer of help! I am trying to place a gutter
annotation on particular lines in Java classes in response to
asynchronous testing events. These classes may already be open in an
editor, may be open but not visible, or may not be opened yet at all.
As I mentioned the approach I am cu

rrently using is to add a RangeHighlight with a GutterIconRenderer to
the appropriate MarkupModels. I am opened to other approaches as
well, what would you recommend?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Hi Dmity,

Sounds promising, thanks!  I'll give that a whirl in the next day or two and post back here how it worked out.

Thanks,

Rod

0
Comment actions Permalink

Hi Dmitry,

The HighlightingPass approach worked perfectly, thanks!

Rod

0

Please sign in to leave a comment.