Skip to main content



      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 12:15 Go to next message
Eclipse UserFriend
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 12:55 Go to previous messageGo to next message
Eclipse UserFriend
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 13:47 Go to previous messageGo to next message
Eclipse UserFriend
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] Mon, 08 February 2010 23:42 Go to previous messageGo to next message
Eclipse UserFriend
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 07:54 Go to previous message
Eclipse UserFriend
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: Sat Jul 12 16:48:35 EDT 2025

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

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

Back to the top