Bug 549654

Summary: @Focus called a varying amount of times
Product: [Eclipse Project] Platform Reporter: Michael Haywood <m.haywood>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: shashwat.work
Version: 4.10   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:

Description Michael Haywood CLA 2019-07-30 06:40:22 EDT
I have two parts that are inside a Part Stack.

Part1 - Top of the stack
Part2 - Bottom of the stack
I've added this code to both of the Parts.

@Focus
private void onFocus() {
    System.out.println("On focus called: " + this);
}

I've noticed some strange behavior with this.


Listening to focus on both parts

Click Part2 tab - onFocus called once for Part2
Click Part1 tab - onFocus called once for Part1
Click Part2 tab twice - onFocus called twice for Part2
Click Part1 tab once - onFocus called twice for Part1

It seems to be that clicking twice on a tab makes other parts get focused twice.


Listening to focus on the bottom part only

Click Part2 tab - onFocus called three times for Part2
Click Part1 tab - Nothing (As expected as no onFocus method added)
Click Part2 tab - onFocus called three times for Part2

With each of these cases they can vary sometimes. I've had it that onFocus isn't called, is called once, twice or three times. I've been trying to find a pattern in this. There is definitely a difference between listening to focus on one part in a stack then two from what I've seen.

Let me know if more information is required.

Here's the `stackoverflow` question. 
https://stackoverflow.com/questions/57091518/focus-called-multiple-times-eclipse-e4

What could be causing this?