Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Relationship between Action and ActionDelegate
Relationship between Action and ActionDelegate [message #464697] Tue, 13 March 2007 17:02 Go to next message
Eclipse UserFriend
Originally posted by: C.O'Mahony.pilz.ie

Hi

In an existing application I have an action that is declared in my
plugin.xml as an extension point in an actionSet

<action
class="mypackage.MyAction"
id="mypackage_MyAction"
menubarPath="file/generator"
style="push"/>

Currently this MyAction class extends WorkbenchWindowActionDelegate and
implements the run(IAction action) method.

Now what I want to do is to programatically enable/disable this action
based on the state of application.

From reading through this newsgroup it looks like one of my options is
to make this action retargetable in the plugin.xml, and then register it
as a Global action in ApplicationActionBarAdvisor by calling
getActionBarConfigurer().registerGlobalAction(IAction action)... Is this
correct? Or do I have another option?

However I'm wondering what the relationship is between the IAction (or
Action) I need to register as a global action and my current class that
is a WorkbenchWindowActionDelegate? Is there a way I can create the
IAction from within my WorkbenchWindowActionDelegate class and register
this as a global action? Or do i need to implement/extend a different
set of classes/interfaces?

Thanks for your help?
Re: Relationship between Action and ActionDelegate [message #465232 is a reply to message #464697] Mon, 26 March 2007 15:11 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

traditionally, you would use the selectionChanged(IAction, ISelection)
method to update IAction#setEnabled(*)

As for the relationship ... declarative actions are implement a
different interface (one of the IActionDelegate subclasses). The
workbench window creates special IActions to put in the menu and toolbar
managers. When they are executed, they load the corresponding
IActionDelegate and execute that.

This is model is changing in 3.3 with the introduction of menu
contributions.

Later,
PW


Previous Topic:where is org.eclipse.core.runtime.IExecutableExtension
Next Topic:IWorkbenchPage.isPartVisible() doesn't return true for a visible part
Goto Forum:
  


Current Time: Fri Sep 13 12:35:14 GMT 2024

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

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

Back to the top