Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to register an Action in a plugin that is not the main plugin
How to register an Action in a plugin that is not the main plugin [message #452943] Wed, 19 July 2006 10:41 Go to next message
Javier Rodriguez is currently offline Javier RodriguezFriend
Messages: 41
Registered: July 2009
Member
Hello,

I have a plugin that is not the one that handle the Application part. In
this plugin, I have created a Command as an extension point and also an
Action class.
Now, what I would like to do is to add a Menu item that is mapped to this
command. It seems that this can be done by using the register method from
the ApplicationWorkbenchAdvisor class but I have not a reference to this
instance in my plugin...
I am sure, I am doing something wrong... but I donŽt know what....

Thanks for your help
Re: How to register an Action in a plugin that is not the main plugin [message #452976 is a reply to message #452943] Wed, 19 July 2006 12:16 Go to previous messageGo to next message
Ilya Shinkarenko is currently offline Ilya ShinkarenkoFriend
Messages: 56
Registered: July 2009
Member
Xavier,

I guess you forgot to declare the schemeId for your key binding.
Since there can be more than one key binding schemes, you have to
declare it explicitly.

Here is a small example of declaration in plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>

<extension
point="org.eclipse.ui.actionSets">
<actionSet
label="Sample Action Set"
visible="true"
id="de.imedic.edu.rcp.actions.actionSet">
<menu
label="Sample &amp;Menu"
id="sampleMenu">
<separator
name="sampleGroup">
</separator>
</menu>
<action
id="de.imedic.edu.rcp.actions.SampleAction"
class="de.imedic.edu.rcp.actions.SampleAction"
definitionId="de.imedic.edu.rcp.actions.SampleCommand"
icon="icons/sample.gif"
label="&amp;Sample Action"
menubarPath="sampleMenu/sampleGroup"
toolbarPath="sampleGroup"
tooltip="Hello, Eclipse world">
</action>
</actionSet>
</extension>

<extension
point="org.eclipse.ui.bindings">
<key
commandId="de.imedic.edu.rcp.actions.SampleCommand"
contextId="org.eclipse.ui.contexts.window"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="Ctrl+I"/>
</extension>

<extension
point="org.eclipse.ui.commands">
<command
id="de.imedic.edu.rcp.actions.SampleCommand"
name="Sample Command"/>
</extension>

</plugin>

Xavier wrote:
> Hello,
>
> I have a plugin that is not the one that handle the Application part. In
> this plugin, I have created a Command as an extension point and also an
> Action class.
> Now, what I would like to do is to add a Menu item that is mapped to
> this command. It seems that this can be done by using the register
> method from the ApplicationWorkbenchAdvisor class but I have not a
> reference to this instance in my plugin...
> I am sure, I am doing something wrong... but I donŽt know what....
>
> Thanks for your help
>


Ilya Shinkarenko
--
www.imedic.de
www.rcp-training.com
Re: How to register an Action in a plugin that is not the main plugin [message #452983 is a reply to message #452943] Wed, 19 July 2006 12:43 Go to previous messageGo to next message
David Goetschmann is currently offline David GoetschmannFriend
Messages: 10
Registered: July 2009
Junior Member
Hi Xavier,
I'm very interested by your question because I have the same problem.

In my case, the plugins have to contribute to the main coolbar (add a
button to open the plugin perspective). I don't want to use the
"perspective switcher" which is a bit to complicated to understand by users.

I had this problem since yesterday ... so no answer yet :(

David

Xavier wrote:
> Hello,
>
> I have a plugin that is not the one that handle the Application part. In
> this plugin, I have created a Command as an extension point and also an
> Action class.
> Now, what I would like to do is to add a Menu item that is mapped to
> this command. It seems that this can be done by using the register
> method from the ApplicationWorkbenchAdvisor class but I have not a
> reference to this instance in my plugin...
> I am sure, I am doing something wrong... but I donŽt know what....
>
> Thanks for your help
>
Re: How to register an Action in a plugin that is not the main plugin [message #453020 is a reply to message #452983] Thu, 20 July 2006 07:59 Go to previous message
Javier Rodriguez is currently offline Javier RodriguezFriend
Messages: 41
Registered: July 2009
Member
Hi,

I have solved my problem my adding an "action" extension point to the list
of "actionSets" and creating a class that implements the
IWorkbenchActionDelegate method. The action extension point must point to
this class.

Regards,
Xavier
Previous Topic:Understanding Eclipse-ExtensibleAPI and Eclipse-PatchFragment
Next Topic:[Databinding] combine three listviewer and comboviewer
Goto Forum:
  


Current Time: Tue Oct 15 15:38:13 GMT 2024

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

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

Back to the top