HighlightManager - how to enable F3 functionality

Hi

Using the HighlightManager as suggested by Bas, I'm now able to highlight the elements that I want to:

HighlightManager#addOccurrenceHighlights(Editor, PsiElement[], TextAttributes, boolean, ArrayList]]>)


One thing I haven't figured out, though, is how to enable IDEA's F3 functionality (Find Next) for my highlighted elements.

Does anybody have an idea how I can achieve this? Or maybe someone from JB could explain the implementation of the F3 Next action provided by IDEA, in case that would open a (back)door for me.

Thanks for any help. It's the last missing piece I need...

etienne

0
6 comments


etienne wrote:

One thing I haven't figured out, though, is how to enable IDEA's F3 functionality (Find Next) for my highlighted elements.


Do this after the highlight:


Bas

0

Thanks. It works great!

Unfortunately, there are no buttons available that allow me to mark the answer as correct :(

etienne

null

0

Thanks. It works great!

Unfortunately, there are no buttons available that allow me to mark the answer as correct :(

etienne

0

That's because I posted that via NNTP. But I don't mind, I'm not here to collects points.

Bas

0
Avatar
Breandan Considine

Unfortunately this answer is no longer visible. What did it say?

0

It was probably something like this:

 

final FindManager findmanager = FindManager.getInstance(project);
FindModel findmodel = findmanager.getFindNextModel();
if (findmodel == null) {
findmodel = findmanager.getFindInFileModel();
}
findmodel.setSearchHighlighters(true);
findmanager.setFindWasPerformed();
findmanager.setFindNextModel(findmodel);
application.invokeLater(() -> {
final WindowManager windowManager = WindowManager.getInstance();
final StatusBar statusBar = windowManager.getStatusBar(project);
if (statusBar != null) {
statusBar.setInfo("Press Escape to remove highlighting");
}
});
0

Please sign in to leave a comment.