Bug 435377 - Cheese in Git Staging view trees when view gets focus by a click on a selected file
Summary: Cheese in Git Staging view trees when view gets focus by a click on a selecte...
Status: CLOSED DUPLICATE of bug 458015
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-21 06:38 EDT by Markus Keller CLA
Modified: 2017-08-29 09:13 EDT (History)
2 users (show)

See Also:


Attachments
Screenshot (15.95 KB, image/png)
2014-05-21 06:38 EDT, Markus Keller CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2014-05-21 06:38:26 EDT
Created attachment 243334 [details]
Screenshot

4.4 RC1. Already happens since at least I20140218-0800 (before Luna M6). Doesn't happen in 4.3.2.

I see screen cheese in the Git Staging view trees when the view gets focus by a click on a selected file.

Steps:
- have a Git repo with unstaged files
- select one or more unstaged files
- click into another view
- click a selected file in the Git Staging view
=> The background of the whole tree is erased and only the selected files are repainted. The border, scrollbars, and other tree items stay blank until the mouse is moved over them.

We had similar issues in the platform (bug 433858), but those issues only appeared in M6 and M7.
Comment 1 Daniel Rolka CLA 2014-05-21 09:10:49 EDT
I've made the comparison between the Package Explorer and the Navigator and the explorer intensively uses the Tree.setRedraw calls. After applying the following change to the ResourceNavigator class, used by the Navigator, the cheese is gone:

  protected void initListeners(final TreeViewer viewer) {
        viewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
            	viewer.getControl().setRedraw(false);
                handleSelectionChanged(event);
                viewer.getControl().setRedraw(true);
            }
        });

Daniel
Comment 2 Daniel Rolka CLA 2014-05-21 09:13:49 EDT
The Git Staging view doesn't use the setRedraw method neither

Daniel
Comment 3 Dani Megert CLA 2014-05-21 09:25:57 EDT
(In reply to Daniel Rolka from comment #1)
> I've made the comparison between the Package Explorer and the Navigator and
> the explorer intensively uses the Tree.setRedraw calls. After applying the
> following change to the ResourceNavigator class, used by the Navigator, the
> cheese is gone:
> 
>   protected void initListeners(final TreeViewer viewer) {
>         viewer.addSelectionChangedListener(new ISelectionChangedListener() {
>             public void selectionChanged(SelectionChangedEvent event) {
>             	viewer.getControl().setRedraw(false);
>                 handleSelectionChanged(event);
>                 viewer.getControl().setRedraw(true);
>             }
>         });
> 
> Daniel

That would be wrong. setRedraw(true/fals) is expensive as it redraws the whole tree. This must only be done if bigger changes happen (to the UI), like setting the input, the comparator or when a lot of new elements are added/removed. Doing this when setting the selection is a no go.
Comment 4 Thomas Wolf CLA 2017-08-29 09:13:16 EDT
This is deep in SWT land (Windows only) and apparently caused (according to bug 435536 comment 9) by a deliberate hack on Windows.

It also appears that bug 433858 is not fixed; see bug 458015.

The issue still occur in the git staging view as described by Markus in Oxygen.

*** This bug has been marked as a duplicate of bug 458015 ***