@Override
  public void reset() {
    if (myFilePointersDisposable != null) {
      Disposer.dispose(myFilePointersDisposable);
    }

    myFilePointersDisposable = Disposer.newDisposable();
    for (PyRootTypeProvider provider : myRootTypeProviders) {
      provider.reset(myFilePointersDisposable, this, myModule);
    }

    if (myRootTreeEditor != null) {
      ContentEntryEditor editor = myRootTreeEditor.getContentEntryEditor();
      if (editor != null) editor.update();
      myRootTreeEditor.update();
    }
  }
 @Override
 public void deleteContentFolder(ContentEntry contentEntry, ContentFolder folder) {
   for (PyRootTypeProvider provider : myRootTypeProviders) {
     if (provider.isMine(folder)) {
       removeRoot(contentEntry, folder.getUrl(), provider);
       return;
     }
   }
   super.deleteContentFolder(contentEntry, folder);
 }
  /** @param contentEntryEditor : null means to clear the editor */
  public void setContentEntryEditor(final ContentEntryEditor contentEntryEditor) {
    if (myContentEntryEditor != null && myContentEntryEditor.equals(contentEntryEditor)) {
      return;
    }
    if (myFileSystemTree != null) {
      Disposer.dispose(myFileSystemTree);
      myFileSystemTree = null;
    }
    if (myContentEntryEditor != null) {
      myContentEntryEditor.removeContentEntryEditorListener(myContentEntryEditorListener);
      myContentEntryEditor = null;
    }
    if (contentEntryEditor == null) {
      ((DefaultTreeModel) myTree.getModel()).setRoot(EMPTY_TREE_ROOT);
      myTreePanel.setVisible(false);
      if (myFileSystemTree != null) {
        Disposer.dispose(myFileSystemTree);
      }
      return;
    }
    myTreePanel.setVisible(true);
    myContentEntryEditor = contentEntryEditor;
    myContentEntryEditor.addContentEntryEditorListener(myContentEntryEditorListener);

    final ContentEntry entry = contentEntryEditor.getContentEntry();
    assert entry != null : contentEntryEditor;
    final VirtualFile file = entry.getFile();
    myDescriptor.setRoots(file);
    if (file == null) {
      final String path = VfsUtilCore.urlToPath(entry.getUrl());
      myDescriptor.setTitle(FileUtil.toSystemDependentName(path));
    }

    final Runnable init =
        new Runnable() {
          @Override
          public void run() {
            //noinspection ConstantConditions
            myFileSystemTree.updateTree();
            myFileSystemTree.select(file, null);
          }
        };

    myFileSystemTree =
        new FileSystemTreeImpl(
            myProject, myDescriptor, myTree, getContentEntryCellRenderer(), init, null) {
          @Override
          protected AbstractTreeBuilder createTreeBuilder(
              JTree tree,
              DefaultTreeModel treeModel,
              AbstractTreeStructure treeStructure,
              Comparator<NodeDescriptor> comparator,
              FileChooserDescriptor descriptor,
              final Runnable onInitialized) {
            return new MyFileTreeBuilder(
                tree, treeModel, treeStructure, comparator, descriptor, onInitialized);
          }
        };
    myFileSystemTree.showHiddens(true);
    Disposer.register(myProject, myFileSystemTree);

    final NewFolderAction newFolderAction = new MyNewFolderAction();
    final DefaultActionGroup mousePopupGroup = new DefaultActionGroup();
    mousePopupGroup.add(myEditingActionsGroup);
    mousePopupGroup.addSeparator();
    mousePopupGroup.add(newFolderAction);
    myFileSystemTree.registerMouseListener(mousePopupGroup);
  }