void (RegExpMatchResult result, @NotNull PsiFile regExpFile) { switch (result) { case NO_MATCH -> { setIconAndTooltip(mySampleIcon, AllIcons.General.BalloonError, RegExpBundle.message("tooltip.no.match")); setIconAndTooltip(myRegExpIcon, null, null); } case MATCHES -> { setIconAndTooltip(mySampleIcon, AllIcons.General.InspectionsOK, RegExpBundle.message("tooltip.matches")); setIconAndTooltip(myRegExpIcon, null, null); final Editor editor = mySampleText.getEditor(); if (editor != null) { final HighlightManager highlightManager = HighlightManager.getInstance(regExpFile.getProject()); removeHighlights(highlightManager); } } case FOUND -> { final List<RegExpMatch> matches = getMatches(regExpFile); final Editor editor = mySampleText.getEditor(); if (editor != null) { final HighlightManager highlightManager = HighlightManager.getInstance(regExpFile.getProject()); removeHighlights(highlightManager); highlightMatchGroup(highlightManager, matches, 0); } if (matches.size() > 1) { setIconAndTooltip(mySampleIcon, AllIcons.General.InspectionsOK, RegExpBundle.message("tooltip.found.multiple", matches.size())); } else { setIconAndTooltip(mySampleIcon, AllIcons.General.InspectionsOK, RegExpBundle.message("tooltip.found")); } setIconAndTooltip(myRegExpIcon, null, null); } case INCOMPLETE -> { setIconAndTooltip(mySampleIcon, AllIcons.General.BalloonWarning, RegExpBundle.message("tooltip.more.input.expected")); setIconAndTooltip(myRegExpIcon, null, null); } case BAD_REGEXP -> { setIconAndTooltip(mySampleIcon, null, null); setIconAndTooltip(myRegExpIcon, AllIcons.General.BalloonError, RegExpBundle.message("tooltip.bad.pattern")); } case TIMEOUT -> { setIconAndTooltip(mySampleIcon, null, null); setIconAndTooltip(myRegExpIcon, AllIcons.General.BalloonWarning, RegExpBundle.message("tooltip.pattern.is.too.complex")); } } }