Fix automatic switch to list mode in staging view
commitb7c01fa09eb56548aa1a61ae1994d83cfb5f8f49
authorThomas Wolf <thomas.wolf@paranor.ch>
Thu, 1 Sep 2016 15:08:04 +0000 (1 17:08 +0200)
committerThomas Wolf <thomas.wolf@paranor.ch>
Thu, 1 Sep 2016 15:08:04 +0000 (1 17:08 +0200)
treec9487301946d4d6d21bb8f04ca1fe2d0cdba1698
parente0375ecaa77f36222b2d7dc84e529f232e8a3eb4
Fix automatic switch to list mode in staging view

When the view automatically switched from list to compact tree mode
because there were too many nodes in the tree viewer and then some nodes
are removed such that it got below the limit, the switch back to list
mode occurred before the new input (with fewer nodes) had been set.

The switch back was also done by running the action, which refreshes
the viewer. As a result, the viewer then tried to display the old input
as a flat list, but that old input still had too many nodes.

Resolve by not running the action. Only update the presentation setting
and don't refresh; the subsequent setting of the input will cause a
refresh anyway, but then with the correct new input with fewer nodes.

This solves the case mentioned in [1]: a folder containing 50000 files,
visible (not expanded) in the staging view, then ignored: took several
minutes on GTK because the view then tried to display 50000+ files as a
flat list before setting the new input, which doesn't contain that huge
folder anymore.

Note that this change does not fix the other performance problems
mentioned in bug 500106.

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=500106#c7

Bug: 500106
Change-Id: I5ce21fa6675cab949a100ccd8fab0c05c7314328
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java