@Override
  public @Nullable Function<? super @NotNull FileEditor, ? extends @Nullable JComponent> collectNotificationData(@NotNull Project project,
                                                                                                                 @NotNull VirtualFile file) {
    if (!DebuggerSettings.getInstance().SHOW_ALTERNATIVE_SOURCE) {
      return null;
    }

    if (DumbService.getInstance(project).isDumb()) {
      return null;
    }

    DebuggerSession javaSession = DebuggerManagerEx.getInstanceEx(project).getContext().getDebuggerSession();
    XDebugSession session = javaSession != null ? javaSession.getXDebugSession() : null;

    if (session == null) {
      setFileProcessed(file, false);
      return null;
    }

    XSourcePosition position = session.getCurrentPosition();
    if (position == null || !file.equals(position.getFile())) {
      setFileProcessed(file, false);
      return null;
    }

    final PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
    if (!(psiFile instanceof PsiJavaFile)) {
      return null;
    }

    PsiClass[] classes = ((PsiJavaFile)psiFile).getClasses();
    if (classes.length == 0) {
      return null;
    }

    PsiClass baseClass = classes[0];
    String name = baseClass.getQualifiedName();
    if (name == null) {
      return null;
    }

    PsiClass[] altClasses = JavaPsiFacade.getInstance(project).findClasses(name, javaSession.getSearchScope());
    if (altClasses.length == 0) {
      altClasses = JavaPsiFacade.getInstance(project).findClasses(name, GlobalSearchScope.allScope(project));
    }
    setFileProcessed(file, true);
    Set<PsiClass> uniqClasses = ContainerUtil.newHashSet(altClasses);
    if (uniqClasses.size() <= 1) {
      return null;
    }
    List<PsiClass> otherClasses = ContainerUtil.filter(uniqClasses,
      cls -> !(cls.equals(baseClass) || cls.getNavigationElement().equals(baseClass)));
    List<PsiClass> allClasses = ContainerUtil.prepend(otherClasses, baseClass);
    AlternativeSourceElement[] elems = ContainerUtil.map2Array(allClasses,
                                                               AlternativeSourceElement.class,
                                                               psiClass -> new AlternativeSourceElement(psiClass.getNavigationElement()));

    String locationDeclName = null;
    XStackFrame frame = session.getCurrentStackFrame();
    if (frame instanceof JavaStackFrame) {
      Location location = ((JavaStackFrame)frame).getDescriptor().getLocation();
      if (location != null) {
        locationDeclName = location.declaringType().name();
      }
    }

    String finalLocationDeclName = locationDeclName;
    return fileEditor -> new AlternativeSourceNotificationPanel(fileEditor,
                                                                project,
                                                                JavaDebuggerBundle.message("editor.notification.alternative.source", name),
                                                                file,
                                                                elems,
                                                                finalLocationDeclName
    );
  }
@Override
  public @Nullable Function<? super @NotNull FileEditor, ? extends @Nullable JComponent> collectNotificationData(@NotNull Project project,
                                                                                                                 @NotNull VirtualFile file)