private void disposeListeners() {
   FileStatusManager.getInstance(myProject).removeFileStatusListener(myFileStatusListener);
   VirtualFileManager.getInstance().removeVirtualFileListener(myFileListener);
   VirtualFileManager.getInstance().removeVirtualFileManagerListener(myVirtualFileManagerListener);
   myProject
       .getComponent(ProjectLevelVcsManager.class)
       .removeVcsListener(myDirectoryMappingListener);
   ChangeListManager.getInstance(myProject).removeChangeListListener(myChangeListListener);
   myMessageBusConnection.disconnect();
 }
  private void installListeners() {
    FileStatusManager.getInstance(myProject)
        .addFileStatusListener(myFileStatusListener = new FileStatusChangeListener());
    VirtualFileManager.getInstance()
        .addVirtualFileListener(myFileListener = new FileChangesListener());
    VirtualFileManager.getInstance()
        .addVirtualFileManagerListener(myVirtualFileManagerListener = new RefreshListener());
    myDirectoryMappingListener =
        new VcsListener() {
          public void directoryMappingChanged() {
            rebuildTreeLater();
          }
        };
    myProject.getComponent(ProjectLevelVcsManager.class).addVcsListener(myDirectoryMappingListener);
    ChangeListManager.getInstance(myProject)
        .addChangeListListener(myChangeListListener = new ChangeListUpdateListener());
    myMessageBusConnection = myBus.connect();
    myMessageBusConnection.subscribe(
        FileEditorManagerListener.FILE_EDITOR_MANAGER,
        new FileEditorManagerAdapter() {
          @Override
          public void fileOpened(FileEditorManager source, VirtualFile file) {
            if (myProjectView.isAutoscrollFromSource(getId())) {
              selectNode(file, false);
            }
          }

          @Override
          public void selectionChanged(FileEditorManagerEvent event) {
            if (myProjectView.isAutoscrollFromSource(getId())) {
              VirtualFile newFile = event.getNewFile();
              if (newFile != null) {
                selectNode(newFile, false);
              }
            }
          }
        });
  }