Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 322872

Summary: [Contributions] AbstractHandler.execute() invoked before focus is set to view
Product: [Eclipse Project] Platform Reporter: Oliver Pfau <oliver.pfau>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: RESOLVED WORKSFORME QA Contact: Prakash Rangaraj <prakash>
Severity: normal    
Priority: P3 CC: daniel.kruegler, pwebster, remy.suen
Version: 3.5.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Sample Plugin to reproduce the problem none

Description Oliver Pfau CLA 2010-08-17 03:00:16 EDT
I defined a class derived from AbstractHandler. This handler is added in the toolbar of view A. If I activate the handler by toolbar icon, the execute method of the handler is invoked.
Problem:
If the focus is on view B and the handler of view A is invoked by clicking the toolbar icon,  frist the execute method of the handler is invoked and afterwards the focus is set to view A. So HandlerUtil.getActivePart() delivers the wrong view for me. If the focus is on view A and the handler action is clicked in view A, it works. But not with the focus on the other view first. 
The views were not detached. Maybe the problem also exists for editors.
Comment 1 Prakash Rangaraj CLA 2010-09-29 06:59:28 EDT
Created attachment 179826 [details]
Sample Plugin to reproduce the problem
Comment 2 Prakash Rangaraj CLA 2010-09-29 07:00:58 EDT
Oliver,
   This works correctly for me. I've added the command to the toolbar of Package Explorer. No matter which view is currently in focus, when I click the icon, it always prints "Package Explorer"

  If there are any specific steps to reproduce this bug, please reopen with the details.