       default: 300
 
   activate: ->
+    @subscriptions = new CompositeDisposable
+
     require('atom-package-deps').install('flex-tool-bar')
 
     return unless @resolveConfigPath()
-
-    @subscriptions = new CompositeDisposable
-    @watcherList = []
 
     @resolveProjectConfigPath()
     @storeProject()



  registerWatch: ->
    if atom.config.get('flex-tool-bar.reloadToolBarWhenEditConfigFile')
      watcher = chokidar.watch @configFilePath
        .on 'change', =>
          @reloadToolbar(@reloadToolBarNotification)
      @watcherList.push watcher

  registerProjectWatch: ->
    if @projectConfigFilePath and @watchList.indexOf(@projectConfigFilePath) < 0
      @watchList.push @projectConfigFilePath
      watcher = chokidar.watch @projectConfigFilePath
        .on 'change', (event, filename) =>
          @reloadToolbar(@reloadToolBarNotification)
      @watcherList.push watcher

  registerTypes: ->
    typeFiles = fs.listSync path.join __dirname, '../types'

    @toolBar?.removeItems()

  deactivate: ->
    @configWatcher?.close()
    @configWatcher = null
    @projectConfigWatcher?.close()
    @projectConfigWatcher = null
    @subscriptions.dispose()
    @subscriptions = null
    @removeButtons()
