static @NotNull Collection<DocumentReference> getDocumentReferences(@NotNull FileEditor editor) {
    List<DocumentReference> result = new ArrayList<>();

    if (editor instanceof DocumentReferenceProvider) {
      result.addAll(((DocumentReferenceProvider)editor).getDocumentReferences());
      return result;
    }

    Document[] documents = TextEditorProvider.getDocuments(editor);
    for (Document each : documents) {
      Document original = getOriginal(each);
      // KirillK : in AnAction.update we may have an editor with an invalid file
      VirtualFile f = FileDocumentManager.getInstance().getFile(each);
      if (f != null && !f.isValid()) continue;
      result.add(DocumentReferenceManager.getInstance().create(original));
    }
    return result;
  }
static @NotNull Collection<DocumentReference> getDocumentReferences(@NotNull FileEditor editor)