Home » Eclipse Projects » Rich Client Platform (RCP) » Menu, commands, actions, and OSX
Menu, commands, actions, and OSX [message #484338] |
Mon, 07 September 2009 00:01 |
J. Michael Dean, M.D. Messages: 218 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 05:38 |
|
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 13:00 |
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 13:16 |
J. Michael Dean, M.D. Messages: 218 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 #495178 is a reply to message #484599] |
Wed, 04 November 2009 01:10 |
J. Michael Dean, M.D. Messages: 218 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
|
|
|
Goto Forum:
Current Time: Tue Sep 24 14:21:29 GMT 2024
Powered by FUDForum. Page generated in 0.05318 seconds
|