Bug 549654 - @Focus called a varying amount of times
Summary: @Focus called a varying amount of times
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.10   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-30 06:40 EDT by Michael Haywood CLA
Modified: 2019-09-19 08:23 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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?