Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to register action in EditorActionBarContributor
How to register action in EditorActionBarContributor [message #447437] Wed, 05 April 2006 13:18 Go to next message
Eclipse UserFriend
Hi,

It's easy to add and register actions in the ApplicationActionBarAdvisor but I can't figure out how to do it in the editor context when an EditorActionBarContributor is used to contribute editor actions. There doesn't seem to be a register() method and I can't seem to find a way to get a suitable IKeyBindingService.

I need to register the action to activate the key binding.

Thanks!
Peter
Re: How to register action in EditorActionBarContributor [message #447438 is a reply to message #447437] Wed, 05 April 2006 13:24 Go to previous messageGo to next message
Eclipse UserFriend
You can get the IActionBars from within the EditorActionBarContributor.

There you can get and set global action handlers (which I assume is the
register you are looking for).

Later,
PW
Re: How to register action in EditorActionBarContributor [message #447730 is a reply to message #447438] Thu, 13 April 2006 12:50 Go to previous messageGo to next message
Eclipse UserFriend
I can't seem to get it to work. In my class which extends EditorActionBarContributor, I have:

private void makeActions() {
filterAction = new FilterColumnsAction(window);
getActionBars().setGlobalActionHandler(filterAction.getId(), filterAction);

getActionBars().updateActionBars();
}

but this fails and the editor doesn't start up. I just want to register the action, like in ApplicationActionBarAdvisor, so that the specified keybinding extension works for this action.

thanks,
Peter
Re: How to register action in EditorActionBarContributor [message #447732 is a reply to message #447730] Thu, 13 April 2006 13:18 Go to previous message
Eclipse UserFriend
Peter Suen wrote:
> I can't seem to get it to work. In my class which extends EditorActionBarContributor, I have:
>
> private void makeActions() {
> filterAction = new FilterColumnsAction(window);
> getActionBars().setGlobalActionHandler(filterAction.getId(), filterAction);
>
> getActionBars().updateActionBars();
> }
>
> but this fails and the editor doesn't start up. I just want to register the action, like in ApplicationActionBarAdvisor, so that the specified keybinding extension works for this action.

Your code looks decent. Does your filterAction.getId() return null?
Does your filterAction have an actionDefinitionID defined as well? Is
there a matching command somewhere?

If the editor doesn't start up, what error did it give? Also, you
should probably be doing your setGlobalActionHandler(*) in the
setActiveEditor(*) method. Get the subclasses of
EditorActionBarContributor (F4) and see how they set up actions.

Later,
PW
Previous Topic:problem with JOGL in RCP
Next Topic:Questions about progress service
Goto Forum:
  


Current Time: Sun Aug 31 05:18:29 EDT 2025

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

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

Back to the top