void (String filter, Project project, Editor editor) { HighlightManager highlightManager = HighlightManager.getInstance(project); EditorColorsManager colorManager = EditorColorsManager.getInstance(); TextAttributes attributes = colorManager.getGlobalScheme().getAttributes(EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES); String documentText = editor.getDocument().getText(); int i = -1; while (true) { int nextOccurrence = StringUtil.indexOfIgnoreCase(documentText, filter, i + 1); if (nextOccurrence < 0) { break; } i = nextOccurrence; highlightManager.addOccurrenceHighlight(editor, i, i + filter.length(), attributes, HighlightManager.HIDE_BY_TEXT_CHANGE, null, null); } }