Show hint/ message near highlighted code

Hi,  I have a RangeHighlighter in place, highlighting all the ranges in a map. I want to show a hint/message beside all the highlighted code so that user can directly navigate to the position. However

highlighter.setErrorStripeTooltip("text changed");
highlighter.setErrorStripeMarkColor(JBColor.RED);

doesnt show any thing. How to achieve this?
My code:

EditorEx myEditor2 = (EditorEx) editorFactory.createEditor(document2, project);
myEditor2.getHighlighter().createIterator(0);
EditorSettings settings = myEditor2.getSettings();

settings.setLineNumbersShown(true);
if(rangeToHighlight!=null)
        {
            for(Map.Entry<Integer,Integer> entry : rangeToHighlight.entrySet())
            {
                System.out.println(entry.getKey() + " " + entry.getValue());
                Color foreGroundColor= EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.SELECTION_FOREGROUND_COLOR);
                Color backGroundColor=EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.SELECTION_BACKGROUND_COLOR).brighter();
                Color effectColor= JBColor.RED;//EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.SELECTION_BACKGROUND_COLOR);

                RangeHighlighter highlighter=myEditor2.getMarkupModel().addRangeHighlighter(entry.getKey(),
                        entry.getValue(), 6000, new TextAttributes(foreGroundColor, backGroundColor, effectColor,
                                EffectType.SEARCH_MATCH, Font.ITALIC), HighlighterTargetArea.EXACT_RANGE);

                highlighter.setErrorStripeTooltip("text changed");
                highlighter.setErrorStripeMarkColor(JBColor.RED);
            }
        }

myEditor2.setHighlighter(EditorHighlighterFactory.getInstance().createEditorHighlighter(project, fileType));
        JPanel box2 = new JPanel();
        box2.add(myEditor2.getScrollPane());

then box2 added to JFrame.
Thanks.

1 comment
Comment actions Permalink

Hi Preetam!

I am encountering a similar issue to yours, as I would like to also display hint messages near highlighted lines just as you do.

Have you any solutions for this problem? Please share.

Thank you in advance.

Jan

0

Please sign in to leave a comment.