DESCRIPTION

Fix drag&drop in staging view

Drag&drop offers a FileTransfer, but considered only StagingEntries.
If only StagingFolderEntries were selected, the resulting FileTransfer
would be empty, which is not allowed and produces a SWTException,
making the drag&drop fail.

This is especially devastating on GTK, where the FileTransfer sometimes
gets created up front, and thus even drags between our own two viewers
failed frequently. On Mac, the FileTransfer is created lazily when
hovering over an item (such as a Finder window) that accepts such
transfers, and the problem thus went largely unnoticed there.

Fix this by also considering folders and including the staged or
unstaged files contained in those folders when creating a FileTransfer.
Transfer creation may still fail and log an exception if the selection
includes only deleted files. In my tests on GTK, drag&drop of deleted
files between the staged and unstaged viewer worked all the same.

Also reduce code duplication by factoring out the creation of the
staged and unstaged viewers into a common method.

Additionally, ensure that dropping onto the same staged or unstaged
viewer the drag&drop initially started from is a no-op; otherwise this
did inadvertently stage/unstage other files contained in selected
folders.

Bug: 453637
Bug: 505923
Change-Id: I3016da202f7d02365374fd9b90ca3537e277ece1


COMMENTS

author: Douglas Trujillo
date: 2016-10-18 22:51:18.000000000

Uploaded patch set 3: Patch Set 2 was rebased.

-------------------------------------
author: Douglas Trujillo
date: 2016-10-18 22:51:58.000000000

Patch Set 3: Code-Review+1

on Mac this works nicely

-------------------------------------
author: Brenden Conley
date: 2016-10-18 23:06:09.000000000

Patch Set 3:

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/9160/

-------------------------------------
author: Brenden Conley
date: 2016-10-18 23:32:20.000000000

Patch Set 3: Verified+1

Build Successful 

https://hudson.eclipse.org/egit/job/egit.gerrit/9160/ : SUCCESS

-------------------------------------
author: Alayna Houston
date: 2016-10-19 09:38:11.000000000

Patch Set 3:

I tested on

* Mac OS X (10.7.5 and 10.9.5)
* Windows 7
* Ubuntu 16.04/GTK 3.18.9
* RHEL 7.2/GTK 2 (not sure which version; I have /usr/lib64/gtk-2.0/2.10.0 and /usr/lib64/libgtk-x11-2.0.so.0.2400.28, and org.eclipse.swt.internal.gtk.version=2.24.28, so I presume it's GTK 2.24.28)

all successfully.

-------------------------------------
author: Douglas Trujillo
date: 2016-10-19 12:25:57.000000000

Patch Set 3: Code-Review+2

-------------------------------------
author: Gerrit Johnathan Pham
date: 2016-10-19 12:26:02.000000000

Change has been successfully merged into the git repository by Douglas Trujillo

-------------------------------------
