Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Eclipse actionSet actions enable/disable (actionSet actions enable/disable on view selection change)
Eclipse actionSet actions enable/disable [message #513066] Mon, 08 February 2010 17:15 Go to next message
No real name is currently offline No real nameFriend
Messages: 3
Registered: February 2010
Junior Member
I have successfully added actions to the global toolbar via extension point "actionSet". I have added selection listener to the action. Enabling/Disabling of an action depends on what resource is selected and is handled in the selectionChanged method.

The enablement of these actions work fine from Package Explorer but it doesn't work when something in view (IViewPart) is selected. It does not fire action's selectionChanged event. I can't figure it out

How to get reference of actions in an actionSet (defined in plugin.xml) programmatically?

How can we associate actionSet with the View so it does fire action's selection changed event on view selection change?

Any help is highly appreciated.

Thanks!
Re: Eclipse actionSet actions enable/disable [message #513072 is a reply to message #513066] Mon, 08 February 2010 17:55 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

csdeepu@gmail.com wrote:
>
> How to get reference of actions in an actionSet (defined in plugin.xml)
> programmatically?

You can't.

> How can we associate actionSet with the View so it does fire action's
> selection changed event on view selection change?

How did you register your view's selection provider?

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: Eclipse actionSet actions enable/disable [message #513083 is a reply to message #513072] Mon, 08 February 2010 18:47 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 3
Registered: February 2010
Junior Member
This is how I add selection listener to the view.

view.addSelectionChangedListener(new ISelectionChangedListener() {

@Override
public void selectionChanged(SelectionChangedEvent arg0) {
}
});

It does get fired when selection changes in the view but I don't have action's reference here so can't do anything.

My problem is that action's selection listener is not getting fired automatically on view's selection change. It works in package explorer though.

Thanks!
Re: Eclipse actionSet actions enable/disable [message #513149 is a reply to message #513083] Tue, 09 February 2010 04:42 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
On 09/02/10 12:17 AM, csdeepu@gmail.com wrote:
> It does get fired when selection changes in the view but I don't have
> action's reference here so can't do anything.
> My problem is that action's selection listener is not getting fired
> automatically on view's selection change. It works in package explorer
> though.

In your view, have you set the selection provider?
getSite().setSelectionProvider(yourViewerHere)

--
- Prakash
Platform UI Team, IBM

Blog <http://blog.eclipse-tips.com>
Twitter <http://www.twitter.com/Eclipse_Tips>
Re: Eclipse actionSet actions enable/disable [message #513229 is a reply to message #513149] Tue, 09 February 2010 12:54 Go to previous message
No real name is currently offline No real nameFriend
Messages: 3
Registered: February 2010
Junior Member
Prakash,

Thank you so much. That was the catch. I was not setting selection provider. It all working fine now.

Many Thanks!
Previous Topic:how to know which eclipse version i am using
Next Topic:Jobs are freezing my whole app
Goto Forum:
  


Current Time: Tue Mar 19 03:31:43 GMT 2024

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

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

Back to the top