private static void reinitBreadcrumbsComponent(
      @NotNull final FileEditorManager fileEditorManager, @NotNull VirtualFile file) {
    if (isSuitable(fileEditorManager.getProject(), file)) {
      FileEditor[] fileEditors = fileEditorManager.getAllEditors(file);
      for (final FileEditor fileEditor : fileEditors) {
        if (fileEditor instanceof TextEditor) {
          Editor editor = ((TextEditor) fileEditor).getEditor();
          if (BreadcrumbsXmlWrapper.getBreadcrumbsComponent(editor) != null) {
            continue;
          }
          final BreadcrumbsXmlWrapper wrapper = new BreadcrumbsXmlWrapper(editor);
          final JComponent c = wrapper.getComponent();
          fileEditorManager.addTopComponent(fileEditor, c);

          Disposer.register(
              fileEditor,
              new Disposable() {
                @Override
                public void dispose() {
                  disposeWrapper(fileEditorManager, fileEditor, wrapper);
                }
              });
        }
      }
    } else {
      removeBreadcrumbs(fileEditorManager, file);
    }
  }
 private static void disposeWrapper(
     @NotNull FileEditorManager fileEditorManager,
     @NotNull FileEditor fileEditor,
     @NotNull BreadcrumbsXmlWrapper wrapper) {
   fileEditorManager.removeTopComponent(fileEditor, wrapper.getComponent());
   Disposer.dispose(wrapper);
 }
  private static boolean isSuitable(@NotNull Project project, @NotNull VirtualFile file) {
    if (file instanceof HttpVirtualFile) {
      return false;
    }

    final FileViewProvider provider = PsiManager.getInstance(project).findViewProvider(file);
    return provider != null && BreadcrumbsXmlWrapper.findInfoProvider(provider) != null;
  }
 private static void removeBreadcrumbs(
     @NotNull FileEditorManager fileEditorManager, @NotNull VirtualFile file) {
   final FileEditor[] fileEditors = fileEditorManager.getAllEditors(file);
   for (FileEditor fileEditor : fileEditors) {
     if (fileEditor instanceof TextEditor) {
       Editor editor = ((TextEditor) fileEditor).getEditor();
       BreadcrumbsXmlWrapper wrapper = BreadcrumbsXmlWrapper.getBreadcrumbsComponent(editor);
       if (wrapper != null) {
         disposeWrapper(fileEditorManager, fileEditor, wrapper);
       }
     }
   }
 }