Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Get corresponding view in AbstractHandler.execute()
Get corresponding view in AbstractHandler.execute() [message #552438] Thu, 12 August 2010 09:15 Go to next message
Oliver Pfau is currently offline Oliver PfauFriend
Messages: 2
Registered: July 2009
Junior Member
Hi,

I defined a class derived from AbstractHandler. This handler is added in a views toolbar. If I activate the toolbar entry, the execute method of the handler is invoked.
How do I get the view instance or id for which the handler is invoked? There can be multiple views in which the handler can be executed. I tried the HandlerUtil.getActivePart(), but the problem here is, that the view is getting active after handlers execute method is invoked. So if e. g. an editor has the focus and the user clicks directly the toolbar icon, the active part is not the view in which the handler icon was clicked, but the editor.
Has someone an idea?

Regards,
Oliver
Re: Get corresponding view in AbstractHandler.execute() [message #553168 is a reply to message #552438] Mon, 16 August 2010 15:18 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Your first instinct is correct. Clicking on the command in the view
toolbar and then HandlerUtil.getActivePart(*) should be that
corresponding view. The view activates before the handler#execute(*) is
called.

This is not in a detached window, is it? In any case, if it is not
working that way it is a bug. Please open a bug at
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=UI

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Get corresponding view in AbstractHandler.execute() [message #553312 is a reply to message #553168] Tue, 17 August 2010 07:02 Go to previous messageGo to next message
Oliver Pfau is currently offline Oliver PfauFriend
Messages: 2
Registered: July 2009
Junior Member
No it was no detached view.
I have opened a bug report.

Thanks.

Regards,
Oliver
Re: Get corresponding view in AbstractHandler.execute() [message #553431 is a reply to message #553312] Tue, 17 August 2010 13:30 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Oliver Pfau wrote:
> No it was no detached view.
> I have opened a bug report.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=322872

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:Product Export
Next Topic:Extension Point refuses to connect
Goto Forum:
  


Current Time: Thu Apr 25 16:55:12 GMT 2024

Powered by FUDForum. Page generated in 0.03175 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top