 BrowserWindow = null # Defer require until actually used
-RendererIpc = require 'ipc'
+{ipcRenderer} = require 'electron'
 
 {$, View} = require 'atom-space-pen-views'
 _ = require 'underscore-plus'

      element = projectRoots.eq(newDropTargetIndex - 1).addClass 'drop-target-is-after'
      @getPlaceholder().insertAfter(element)

  onDropOnOtherWindow: (fromItemIndex) =>
    paths = atom.project.getPaths()
    paths.splice(fromItemIndex, 1)
    atom.project.setPaths(paths)

  constructor: (@treeView) ->
    @treeView.on 'dragend', '.project-root-header', @onDragEnd

    ipcRenderer.on('tree-view:project-folder-dropped', @onDropOnOtherWindow)

  # unused
  unsubscribe: ->
    ipcRenderer.removeListener('tree-view:project-folder-dropped', @onDropOnOtherWindow)

  onDragStart: (event) =>
    event.originalEvent.dataTransfer.setData 'atom-event', 'true'
