@Override
  public @Nullable Element export(@NotNull RefEntity refEntity, final int actualLine) {
    refEntity = getRefinedElement(refEntity);

    Element problem = new Element("problem");

    if (refEntity instanceof RefDirectory) {
      Element fileElement = new Element("file");
      VirtualFile virtualFile = ((PsiDirectory)((RefDirectory)refEntity).getPsiElement()).getVirtualFile();
      fileElement.addContent(virtualFile.getUrl());
      problem.addContent(fileElement);
    }
    else if (refEntity instanceof RefElement refElement) {
      final SmartPsiElementPointer<?> pointer = refElement.getPointer();
      if (pointer == null) return null;
      PsiFile psiFile = pointer.getContainingFile();
      if (psiFile == null) return null;

      Element fileElement = new Element("file");
      final VirtualFile virtualFile = psiFile.getVirtualFile();
      LOG.assertTrue(virtualFile != null);
      fileElement.addContent(virtualFile.getUrl());
      problem.addContent(fileElement);

      int resultLine;
      if (actualLine == -1) {
        final Document document = PsiDocumentManager.getInstance(pointer.getProject()).getDocument(psiFile);
        LOG.assertTrue(document != null);
        final Segment range = pointer.getRange();
        resultLine = range == null ? -1 : document.getLineNumber(range.getStartOffset()) + 1;
      }
      else {
        resultLine = actualLine + 1;
      }

      Element lineElement = new Element("line");
      lineElement.addContent(String.valueOf(resultLine));
      problem.addContent(lineElement);

      appendModule(problem, refElement.getModule());
    }
    else if (refEntity instanceof RefModule refModule) {
      final VirtualFile moduleFile = refModule.getModule().getModuleFile();
      final Element fileElement = new Element("file");
      fileElement.addContent(moduleFile != null ? moduleFile.getUrl() : refEntity.getName());
      problem.addContent(fileElement);
      appendModule(problem, refModule);
    }

    for (RefManagerExtension<?> extension : myExtensions.values()) {
      extension.export(refEntity, problem);
    }

    new SmartRefElementPointerImpl(refEntity, true).writeExternal(problem);
    return problem;
  }
@Override
  public @Nullable Element export(@NotNull RefEntity refEntity, final int actualLine)