DESCRIPTION

Fix expansion problems and provide auto selection support.

The changes also include enhancements. When you have a large set of
changes, but you only want to selectively commit some of them, each time
you drag from unstaged to staged, both views scroll back to the top, and
you lose where you were reviewing the changes.

Enhancements include ensuring that collapse all is always available,
except for the list view as well as decoupling the expand all item
visibility so that it's only unavailable in the specific view with too
many items.

Another enhancement is that when you drag something from one view to
another, the result will be selected (and revealed) in the target view.
The selection is smart to select only a parent if all the children were
newly added, i.e., the selection designed to be minimal with the design
intent being that if selected added things are immediately dragged back
again, the operation will be undone.  The logic also sets a new
selection in source the view that otherwise no longer has a selection.  

Yet another enhancement is that when the viewer input is changed, there
is logic track the top item in the tree so that it can be restored after
the viewer update.  Then ensures that the scroll position is as stable
as possible and one can stage and unstage things (or refresh the
repository state) without losing your context.

One very bad behavior that's also fixed is that the
TreeViewer.getAllExpandedElements returns elements that aren't visible,
so updates often result in the tree becoming fully (way too) expanded
after each update. 

Also, switching presentations resulted in different expand-all and
collapse-all states than you'd get after an update.  One path considered
the total items in both views, removing the actions in both views, and
the other path considered whether either of the two views has too many
items and then removed both actions for both views.  I believe the
current implementation is much more consistent.  

Another bad behavior that's also fixed is that the recorded additional
elements to expand (computing while staging or unstaging the selection)
were not reset after they were used.  This also resulted in elements
that just kept expanding for no apparent good reason.

Bug: 451216
Change-Id: I748f61ec41fe34b3cee9612ed8dc156bd29b5812
Signed-off-by: Ronan Romero xxx@xxx.xxx

COMMENTS

author: Ronan Romero
date: 2016-08-17 05:33:33.000000000

Uploaded patch set 5.

-------------------------------------
author: Brenden Conley
date: 2016-08-17 05:33:39.000000000

Patch Set 5:

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

-------------------------------------
author: Brenden Conley
date: 2016-08-17 06:03:50.000000000

Patch Set 5: Code-Review-1

Build Unstable 

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

-------------------------------------
author: Ronan Romero
date: 2016-09-02 09:26:59.000000000

Patch Set 5:

The review process appears to be stalled and the "Conflicts With" list grows...

-------------------------------------
author: Alayna Houston
date: 2016-09-02 10:48:31.000000000

Patch Set 5:

> The review process appears to be stalled and the "Conflicts With"
 > list grows...

I know. I need to test this on GTK. GTK has a rather slow tree implementation; I want to be sure it performs there.

-------------------------------------
author: Alayna Houston
date: 2016-09-03 19:30:18.000000000

Patch Set 5:

(4 comments)

Performance looks OK also on GTK.

Line:1970, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java -> Nit: strange formatting. Please auto-format.

Line:1982, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java -> Nit: wrong indentation.

Line:2191, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java -> A suggestion: if the candidate is an expanded StagingFolderEntry, it should be selected only if there is no following sibling. Otherwise the following sibling is IMO the better choice, otherwise the viewer will jump.

Line:2352, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java -> Why re-implement AbstractTreeViewer.getVisibleExpandedElements()?

-------------------------------------
author: Gerrit Johnathan Pham
date: 2016-09-07 06:02:47.000000000

Change has been successfully merged into the git repository by Alayna Houston

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