Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to get action by its id?
How to get action by its id? [message #282766] Sat, 19 March 2005 10:21 Go to next message
Mykola Nikishov is currently offline Mykola Nikishov
Messages: 58
Registered: July 2009
Member
I have an RCP that defines extension point and plugin use this point as:

<extension point="core">
<party name="Some name">
<actions
add="add"
delete="delete"
edit="edit">
</actions>
</party>
</extension>
<extension point="org.eclipse.ui.actionSets">
<actionSet id="actionSet">
<action class="AddAction"
id="add"/>
<action class="DeleteAction"
id="delete"/>
<action class="EditAction"
id="edit"/>
</actionSet>
</extension>

Plugin defines classes which implements this actions. Now, in a
ViewPart I want add one of these actions to a context menu:

void fillContextMenu(IMenuManager manager) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
for (IConfigurationElement element : registry
.getConfigurationElementsFor("core.parties")) {
String partyName = element.getAttribute("name");
IConfigurationElement actionsElement = element
.getChildren("actions")[0];
String actionId = actionsElement.getAttribute("add");
IAction partyAction = ... ; // get action class referenced
// by actionId variable
manager.add(partyAction);
};
// Other plug-ins can contribute actions here
}

How to get action class referenced by its id?

--
MAN-UANIC
Eclipse.org downloads @ http://eclipse.osdn.org.ua/
Re: How to get action by its id? [message #282772 is a reply to message #282766] Sun, 20 March 2005 00:17 Go to previous message
Eclipse User
Originally posted by: bob.objfac.com

IConfigurationElement loadExtensionClass().

Bob

Mykola Nikishov wrote:
> I have an RCP that defines extension point and plugin use this point as:
>
> <extension point="core">
> <party name="Some name">
> <actions
> add="add"
> delete="delete"
> edit="edit">
> </actions>
> </party>
> </extension>
> <extension point="org.eclipse.ui.actionSets">
> <actionSet id="actionSet">
> <action class="AddAction"
> id="add"/>
> <action class="DeleteAction"
> id="delete"/>
> <action class="EditAction"
> id="edit"/>
> </actionSet>
> </extension>
>
> Plugin defines classes which implements this actions. Now, in a
> ViewPart I want add one of these actions to a context menu:
>
> void fillContextMenu(IMenuManager manager) {
> IExtensionRegistry registry = Platform.getExtensionRegistry();
> for (IConfigurationElement element : registry
> .getConfigurationElementsFor("core.parties")) {
> String partyName = element.getAttribute("name");
> IConfigurationElement actionsElement = element
> .getChildren("actions")[0];
> String actionId = actionsElement.getAttribute("add");
> IAction partyAction = ... ; // get action class referenced
> // by actionId variable
> manager.add(partyAction);
> };
> // Other plug-ins can contribute actions here
> }
>
> How to get action class referenced by its id?
>
Previous Topic:link a ContentOutline View and a model
Next Topic:Toolbar icons partially shown when toolbar is disabled
Goto Forum:
  


Current Time: Thu Sep 18 23:53:12 GMT 2014

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

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