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: Alayna Houston
date: 2016-10-17 08:42:18.000000000

Uploaded patch set 2.

-------------------------------------
author: Brenden Conley
date: 2016-10-17 08:42:24.000000000

Patch Set 2:

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

-------------------------------------
author: Brenden Conley
date: 2016-10-17 09:06:49.000000000

Patch Set 2: Code-Review-1

Build Unstable 

https://hudson.eclipse.org/egit/job/egit.gerrit/9152/ : UNSTABLE

-------------------------------------
author: Brenden Conley
date: 2016-10-17 09:08:40.000000000

Patch Set 2: -Code-Review

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

-------------------------------------
author: Brenden Conley
date: 2016-10-17 09:58:46.000000000

Patch Set 2: Verified-1

Build Failed 

https://hudson.eclipse.org/egit/job/egit.gerrit/9153/ : ABORTED

-------------------------------------
author: Brenden Conley
date: 2016-10-17 17:51:24.000000000

Patch Set 2: -Verified

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

-------------------------------------
author: Brenden Conley
date: 2016-10-17 18:16:50.000000000

Patch Set 2: Code-Review-1

Build Unstable 

https://hudson.eclipse.org/egit/job/egit.gerrit/9154/ : UNSTABLE

-------------------------------------
author: Alayna Houston
date: 2016-10-17 20:17:04.000000000

Patch Set 2:

> https://hudson.eclipse.org/egit/job/egit.gerrit/9154/ : UNSTABLE

Strange failure. Screenshot shows the currently checked out master branch still selected, but the code at that point already has selected the other branch. UI didn't follow yet, and then couldn't find the menu. I notice that SWTBot's select() fires events asynchronously...

-------------------------------------
author: Brenden Conley
date: 2016-10-17 20:17:20.000000000

Patch Set 2: -Code-Review

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

-------------------------------------
author: Brenden Conley
date: 2016-10-17 20:43:32.000000000

Patch Set 2: Verified+1

Build Successful 

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

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

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

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