Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Using IHandlerService in modal dialog
Using IHandlerService in modal dialog [message #326343] Sun, 16 March 2008 18:08 Go to next message
Eclipse UserFriend
Originally posted by: newsgroups.atante.pl

Hi,
I've used the following code in tabbed editor ()

IWorkbenchPartSite site =
PlatformUI.getWorkbench().getActivePage().getActivePart().ge tSite();
IHandlerService handlerService = (IHandlerService)
site.getService(IHandlerService.class);

to register my actions via:
IHandlerActivation activation = handlerService.activateHandler(
myAction.getActionDefinitionId(),
new ActionHandler(myAction)
);
and it works.

Now I want to do the same but for currently opened modal dialog window.
Which object should I use to register? What object will give me getService()
method?
Or is there any other approach?

--
Piotr Górny, Atante
http://www.atante.pl
Re: Using IHandlerService in modal dialog [message #326603 is a reply to message #326343] Wed, 26 March 2008 09:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: newsgroups.atante.pl

Any suggestions would be appreciated :-)

--
Piotr Górny, Atante
http://www.atante.pl
Re: Using IHandlerService in modal dialog [message #326613 is a reply to message #326343] Wed, 26 March 2008 14:37 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Piotr Górny wrote:
>
> Now I want to do the same but for currently opened modal dialog window.
> Which object should I use to register? What object will give me
> getService() method?
> Or is there any other approach?

In 3.4 we were looking at support for creating your own site
(IServiceLocatorCreator) but it doesn't look like it's ready for prime time.

For a dialog, you would have to use:
PlatformUI.getWorkbench().getService(IHandlerService.class); This is
the global handler service.

You can activate your handler using this service, but you will have to
deactivate it yourself as your dialog closes.

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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Previous Topic:visibleWhen expression is not always evaluated when a custom source changes
Next Topic:save an IFigure to a gif
Goto Forum:
  


Current Time: Thu Jul 18 03:19:00 GMT 2024

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

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

Back to the top