Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322872 - [Contributions] AbstractHandler.execute() invoked before focus is set to view
Summary: [Contributions] AbstractHandler.execute() invoked before focus is set to view
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact: Prakash Rangaraj CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-17 03:00 EDT by Oliver Pfau CLA
Modified: 2010-09-29 07:00 EDT (History)
3 users (show)

See Also:


Attachments
Sample Plugin to reproduce the problem (7.04 KB, application/zip)
2010-09-29 06:59 EDT, Prakash Rangaraj CLA
no flags Details

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