Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » retrieve MenuItem by ID
retrieve MenuItem by ID [message #456360] Wed, 01 June 2005 11:35 Go to next message
Eclipse UserFriend
Originally posted by: boschi.integrainformatica.it

Hi everyone,
I'm developing an Eclipse plugin.
I need to enable/disable a menu item programmatically.

The question is: how can I access the MenuItem object?
for instance: from its IWorkbenchWindowActionDelegate.

The only things I know are the MenuItem id and menubarPath (as specified
in the plugin.xml file).

Thank you, I didn't find answer searching help or snippets

Bye
Luciano
Re: retrieve MenuItem by ID [message #456375 is a reply to message #456360] Wed, 01 June 2005 17:53 Go to previous messageGo to next message
Philippe Ombredanne is currently offline Philippe OmbredanneFriend
Messages: 386
Registered: July 2009
Senior Member
"Luciano Boschi" <boschi@integrainformatica.it> wrote in message
news:d7k6t4$bm$1@news.eclipse.org...
> Hi everyone,
> I'm developing an Eclipse plugin.
> I need to enable/disable a menu item programmatically.
>
> The question is: how can I access the MenuItem object?
> for instance: from its IWorkbenchWindowActionDelegate.
>
> The only things I know are the MenuItem id and menubarPath (as specified
> in the plugin.xml file).
Has the menu been contributed by YOUR plugin? or another one?
Re: retrieve MenuItem by ID [message #456451 is a reply to message #456375] Sat, 04 June 2005 07:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: boschi.integrainformatica.it

Philippe Ombredanne ha scritto:
> "Luciano Boschi" <boschi@integrainformatica.it> wrote in message
> news:d7k6t4$bm$1@news.eclipse.org...
>
>>Hi everyone,
>>I'm developing an Eclipse plugin.
>>I need to enable/disable a menu item programmatically.
>>
>>The question is: how can I access the MenuItem object?
>>for instance: from its IWorkbenchWindowActionDelegate.
>>
>>The only things I know are the MenuItem id and menubarPath (as specified
>>in the plugin.xml file).
>
> Has the menu been contributed by YOUR plugin? or another one?
>
>

It's contributed by my plugin.

I've edited plugin.xml via the PDE interface. Here is something of what
I have got:
-----------------
<extension
point="org.eclipse.ui.actionSets">
<actionSet
label="Gruppo di azioni"
description="Menu delle funzionalità di &quot;Lexlooter&quot;"
visible="false"
id="it.unifi.ing.lexlooter.actionSet">
<menu
label="&amp;Lexlooter"
id="LexlooterMenu">
<separator name="saveGroup"/>
<separator
name="openGroup">
</separator>
<separator name="toolGroup"/>
<separator name="configGroup"/>
</menu>
<action
label="&amp;Salva..."
icon="icons/etool16/save.gif"
class="it.unifi.ing.lexlooter.actions.SaveResult"
tooltip="Salva tutti i modelli e i testi consolidati in
un unico archivio"
style="push"
state="true"
menubarPath="LexlooterMenu/saveGroup"
id="it.unifi.ing.lexlooter.actions.SaveResult"/>
.....
-----------------

then I have a SaveResult.java file that begins with something like:

-----------------
package it.unifi.ing.lexlooter.actions;
public class SaveResult implements IWorkbenchWindowActionDelegate
.....
-----------------

I know that the methods IWorkbenchWindowActionDelegate.run and
..selectionChanged have an IAction reference passed to them, but I would
like to access that IAction also from other methods.

Or have I to use another approach?

Thanks
Re: retrieve MenuItem by ID [message #456584 is a reply to message #456451] Sat, 04 June 2005 19:42 Go to previous messageGo to next message
Philippe Ombredanne is currently offline Philippe OmbredanneFriend
Messages: 386
Registered: July 2009
Senior Member
"Luciano Boschi" <boschi@integrainformatica.it> wrote in message
news:d7rmso$2l8$1@news.eclipse.org...

> It's contributed by my plugin.
See how it is done in org.eclipse.jdt.ui
Re: retrieve MenuItem by ID [message #456588 is a reply to message #456451] Sat, 04 June 2005 23:05 Go to previous message
Philippe Ombredanne is currently offline Philippe OmbredanneFriend
Messages: 386
Registered: July 2009
Senior Member
"Luciano Boschi" <boschi@integrainformatica.it> wrote in message
news:d7rmso$2l8$1@news.eclipse.org...

> It's contributed by my plugin.
See how it is done in org.eclipse.jdt.ui
Previous Topic:Use VE Palette widget in a Standalone SWT App
Next Topic:How to make excutable jar?
Goto Forum:
  


Current Time: Fri Sep 20 19:06:14 GMT 2024

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

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

Back to the top