Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » how to enable a menuitem by default
how to enable a menuitem by default [message #505075] Sat, 26 December 2009 12:52 Go to next message
R.Afonso is currently offline R.AfonsoFriend
Messages: 10
Registered: December 2009
Junior Member
Hi,
I´m starting on Eclipse RCP and I try to create a simple menuitem to close the window:

<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu">
<menu
id="fileMenu"
label="File">
<command
commandId="firstapp.Exit"
label="Exit"
style="push"
tooltip="Exit the app">
</command>
</menu>
</menuContribution>
</extension>

The menuitem Exit appears in the "File" menu but it´s disabled. Anything missing?
Re: how to enable a menuitem by default [message #505095 is a reply to message #505075] Sat, 26 December 2009 18:59 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Hi,

how to add an Exit command (and lots of other stuff) is described here:
http://www.vogella.de/articles/EclipseCommands/article.html

In your case you most likely missing the handler.

Best regards, Lars

--
http://www.vogella.de/ - Eclipse plugin and Eclipse RCP Tutorials
http://www.twitter.com/vogella - vogella on Twitter

On 26.12.2009 04:52, raff wrote:
> Hi, I´m starting on Eclipse RCP and I try to create a simple menuitem to
> close the window:
>
> <extension
> point="org.eclipse.ui.menus">
> <menuContribution
> locationURI="menu:org.eclipse.ui.main.menu">
> <menu
> id="fileMenu"
> label="File">
> <command
> commandId="firstapp.Exit"
> label="Exit"
> style="push"
> tooltip="Exit the app">
> </command>
> </menu>
> </menuContribution>
> </extension>
>
> The menuitem Exit appears in the "File" menu but it´s disabled. Anything
> missing?
Re: how to enable a menuitem by default [message #505285 is a reply to message #505095] Tue, 29 December 2009 05:17 Go to previous messageGo to next message
R.Afonso is currently offline R.AfonsoFriend
Messages: 10
Registered: December 2009
Junior Member
Hi,
in fact I was following one of your tutorials Smile. Nice work!

I found the problem, the code automatically generated by Eclipse for the handler returns false in isEnabled() and isHandled() functions.

Thanks
Re: how to enable a menuitem by default [message #505474 is a reply to message #505285] Thu, 31 December 2009 00:38 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Hello,

good to hear that you solved the problem. In case my tutorial was
incorrect, please report it: http://groups.google.com/group/vogella

Best regards, Lars

--
http://www.vogella.de/ - Eclipse plugin and Eclipse RCP Tutorials
http://www.twitter.com/vogella - vogella on Twitter

On 28.12.2009 21:17, R.Afonso wrote:
> Hi,
> in fact I was following one of your tutorials :). Nice work!
>
> I found the problem, the code automatically generated by Eclipse for the
> handler returns false in isEnabled() and isHandled() functions.
>
> Thanks
Re: how to enable a menuitem by default [message #505939 is a reply to message #505285] Tue, 05 January 2010 15:28 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

R.Afonso wrote:
> Hi,
> in fact I was following one of your tutorials :). Nice work!
>
> I found the problem, the code automatically generated by Eclipse for the
> handler returns false in isEnabled() and isHandled() functions.

Please make sure you subclass AbstractHandler (instead of implementing
IHandler directly)

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


Previous Topic:How to close a view?
Next Topic:Website for book Eclipse Rich Client Platform: Designing, Coding, and Packaging Java Applications se
Goto Forum:
  


Current Time: Tue Mar 19 07:48:38 GMT 2024

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

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

Back to the top