Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Menu, commands, actions, and OSX
Menu, commands, actions, and OSX [message #484338] Sun, 06 September 2009 20:01 Go to next message
J. Michael Dean, M.D. is currently offline J. Michael Dean, M.D.
Messages: 216
Registered: July 2009
Senior Member
I have always used the ApplicationActionBarAdvisor to create my menus with
actions, first creating the actions in makeActions and then filling up the
menu in fillMenuBar. On OSX, the RCP has an additional menu to the left of
anything created by this method, in keeping with that platform's standard
(which is to have the Apple menu first, and a menu named the same as the
application second, and then all the menus that are created by fillMenuBar.)

I am now trying to go to commands and handlers, as numerous people advocate,
and I must admit that I like it very much. Simpler than actions, I think.
However, when I add minimal menu contributions, etc., my application still
has an "About the application" and "Preferences ..." in the second window
that is named "My Application". These selections do not do anything, even
though I have an "about" and "preferences" selection in other parts of the
menu system, which are handled with commands and handlers.

How do I access this menu that is created behind the scenes? Or am I
misguided to try to switch to commands and handlers? (It worked before, but
I was trying to see how this would work.)

- Mike
Re: Menu, commands, actions, and OSX [message #484522 is a reply to message #484338] Tue, 08 September 2009 01:38 Go to previous messageGo to next message
Lars Vogel is currently offline Lars Vogel
Messages: 1048
Registered: July 2009
Senior Member

Hi,

to use some commands, e.g. reset perspective you need to activate them
via the ActionFactory. Please see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=283234

Best regards, Lars

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

J Michael Dean wrote:
> I have always used the ApplicationActionBarAdvisor to create my menus with
> actions, first creating the actions in makeActions and then filling up the
> menu in fillMenuBar. On OSX, the RCP has an additional menu to the left of
> anything created by this method, in keeping with that platform's standard
> (which is to have the Apple menu first, and a menu named the same as the
> application second, and then all the menus that are created by fillMenuBar.)
>
> I am now trying to go to commands and handlers, as numerous people advocate,
> and I must admit that I like it very much. Simpler than actions, I think.
> However, when I add minimal menu contributions, etc., my application still
> has an "About the application" and "Preferences ..." in the second window
> that is named "My Application". These selections do not do anything, even
> though I have an "about" and "preferences" selection in other parts of the
> menu system, which are handled with commands and handlers.
>
> How do I access this menu that is created behind the scenes? Or am I
> misguided to try to switch to commands and handlers? (It worked before, but
> I was trying to see how this would work.)
>
> - Mike
>
Re: Menu, commands, actions, and OSX [message #484599 is a reply to message #484522] Tue, 08 September 2009 09:00 Go to previous messageGo to next message
Marcus Ilgner is currently offline Marcus Ilgner
Messages: 15
Registered: July 2009
Junior Member
On 08.09.09 07:38, Lars Vogel wrote:
> Hi,
>
> to use some commands, e.g. reset perspective you need to activate them
> via the ActionFactory. Please see
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=283234
>
> Best regards, Lars
>

Also, in case you're building your menus declaratively, you may want to
include some conditional code in your plugin.xml like so:

[inside a <menuContribution> element]

<command commandId="org.eclipse.ui.file.exit">
<visibleWhen>
<not>
<systemTest property="os.name" value="Mac OS X">
</systemTest>
</not>
</visibleWhen>
</command>

Best regards
Marcus
Re: Menu, commands, actions, and OSX [message #484602 is a reply to message #484599] Tue, 08 September 2009 09:16 Go to previous messageGo to next message
J. Michael Dean, M.D. is currently offline J. Michael Dean, M.D.
Messages: 216
Registered: July 2009
Senior Member
I don't actually want to alter the way the OS X application is built because
it is expected to have this menu on Macintosh. What I don't understand is
why these two actions are not fired when the menu items are selected. I
have declared the "about" and "perspectives" in plugin.xml and they function
correctly from other menus, but they are automatically placed in this extra
menu when the OSX version is created, and they are not functional.

I have also registered the about action in ApplicationActionBarAdvisor and
this did not have an impact on the behavior.

- Mike


On 9/8/09 7:00 AM, in article h85ki5$dqa$1@build.eclipse.org, "Marcus
Ilgner" <marcus.ilgner@gerig.de> wrote:

> On 08.09.09 07:38, Lars Vogel wrote:
>> Hi,
>>
>> to use some commands, e.g. reset perspective you need to activate them
>> via the ActionFactory. Please see
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=283234
>>
>> Best regards, Lars
>>
>
> Also, in case you're building your menus declaratively, you may want to
> include some conditional code in your plugin.xml like so:
>
> [inside a <menuContribution> element]
>
> <command commandId="org.eclipse.ui.file.exit">
> <visibleWhen>
> <not>
> <systemTest property="os.name" value="Mac OS X">
> </systemTest>
> </not>
> </visibleWhen>
> </command>
>
> Best regards
> Marcus
Re: Menu, commands, actions, and OSX [message #484689 is a reply to message #484602] Tue, 08 September 2009 14:20 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

This is likely because on Mac OSX the carbon or cocoa fragment hooks into the correct Mac menu and then hunts down and executes an IAction directly (yikes) instead of trying the command.

It would be nice to fix that in 3.6
PW


Re: Menu, commands, actions, and OSX [message #495178 is a reply to message #484599] Tue, 03 November 2009 20:10 Go to previous message
J. Michael Dean, M.D. is currently offline J. Michael Dean, M.D.
Messages: 216
Registered: July 2009
Senior Member
Thanks - I have moved everything in the menus to plugin.xml. Your command
about putting in a conditional is interesting, but your example would
eliminate the command that actually works (so the problem is that About and
Preferences in the application menu do not work in Mac OSX in Galileo when I
have switched to commands. The same commands do work when they are in other
menus, which are from menuContributions.)

My problem is figuring out where the Mac application menu comes from and
whether it can be altered in some fashion.

- Mike


On 9/8/09 7:00 AM, in article h85ki5$dqa$1@build.eclipse.org, "Marcus
Ilgner" <marcus.ilgner@gerig.de> wrote:

> On 08.09.09 07:38, Lars Vogel wrote:
>> Hi,
>>
>> to use some commands, e.g. reset perspective you need to activate them
>> via the ActionFactory. Please see
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=283234
>>
>> Best regards, Lars
>>
>
> Also, in case you're building your menus declaratively, you may want to
> include some conditional code in your plugin.xml like so:
>
> [inside a <menuContribution> element]
>
> <command commandId="org.eclipse.ui.file.exit">
> <visibleWhen>
> <not>
> <systemTest property="os.name" value="Mac OS X">
> </systemTest>
> </not>
> </visibleWhen>
> </command>
>
> Best regards
> Marcus
Previous Topic:Building Eclipse RCP applications using Buckminster and Hudson
Next Topic:Confusing PreferenceStore
Goto Forum:
  


Current Time: Thu Apr 17 21:01:14 EDT 2014

Powered by FUDForum. Page generated in 0.01778 seconds