AnAction (@NotNull Project project, @NotNull PsiElement element, @Nullable Editor originalEditor) { if (myAnalysisWasActivated) { // Do not show the balloon if analysis was already activated once on this link return null; } Supplier<List<StackLine>> supplier; if (originalEditor != null) { Document origDocument = originalEditor.getDocument(); supplier = () -> { int stackLineNumber = origDocument.getLineNumber(myTextEndOffset); if (stackLineNumber < 1) return Collections.emptyList(); int lineCount = Math.min(origDocument.getLineCount(), stackLineNumber + 100); List<StackLine> nextLines = new ArrayList<>(); for (int i = stackLineNumber - 1; i < lineCount; i++) { String traceLine = origDocument.getText(TextRange.create(origDocument.getLineStartOffset(i), origDocument.getLineEndOffset(i))); ParsedLine line = parseExceptionLine(traceLine); if (line == null) break; String methodName = line.methodNameRange.substring(traceLine); if (methodName.startsWith("access$")) continue; StackLine stackLine = new StackLine(line.classFqnRange.substring(traceLine), methodName, line.fileName); nextLines.add(stackLine); } return nextLines; }; } else { supplier = Collections::emptyList; } ExceptionInfo info = myElementMatcher.getExceptionInfo(); ExceptionAnalysisProvider exceptionAnalysisProvider = project.getService(ExceptionAnalysisProvider.class); AnAction action; if (info == null) { action = exceptionAnalysisProvider.getIntermediateRowAnalysisAction(element, supplier); } else { action = exceptionAnalysisProvider.getAnalysisAction(element, info, supplier); } return action; }