为什么我的 Eclipse RCP mainMenu 命令在 Mac 上不可单击?
在我们的 Eclipse RCP 项目中,我们希望使用主菜单顶层的命令。因此,如果您单击屏幕中的“Übersicht”,则应调用 OverviewCommand 处理程序: https://i .sstatic.net/jrtlq.png
这是我们的plugin.xml:
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu">
<command
commandId="at.ticketline.command.OverviewCommand"
label="Übersicht"
style="push">
</command>
<command
commandId="at.ticketline.command.TicketCommand"
label="Ticket">
</command>
<command
commandId="at.ticketline.command.KundeCommand"
label="Kunde">
</command>
<command
commandId="at.ticketline.command.SucheCommand"
label="Suche">
</command>
<command
commandId="at.ticketline.command.ArtikelCommand"
label="Artikel">
</command>
</menuContribution>
</extension>
在Windows 上它可以工作,但在Mac 上不行。你能想象为什么吗?当我将命令放入“菜单”标签中时它也可以工作,但是它们不会位于第一级,而这不是我们想要的。
感谢您的每一个提示!
In our Eclipse RCP project, we want to use commands in the top level of our main menu. So the OverviewCommand handler should be called, if you click on "Übersicht" like in the screen: https://i.sstatic.net/jrtlq.png
That's our plugin.xml:
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu">
<command
commandId="at.ticketline.command.OverviewCommand"
label="Übersicht"
style="push">
</command>
<command
commandId="at.ticketline.command.TicketCommand"
label="Ticket">
</command>
<command
commandId="at.ticketline.command.KundeCommand"
label="Kunde">
</command>
<command
commandId="at.ticketline.command.SucheCommand"
label="Suche">
</command>
<command
commandId="at.ticketline.command.ArtikelCommand"
label="Artikel">
</command>
</menuContribution>
</extension>
On Windows it works, but not on mac. Could you imagine why? It also works when I put the commands into a "menu" tag, but then they would not be on the first level, and that's not what we want.
Thank you for every hint!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无法将 SWT MenuItems 可靠地放置在主菜单栏中,而这正是您尝试使用该 menuContribution 执行的操作。 Windows 支持它。显然麦克没有。 Eclipse 及其用户指南绝对不推荐它。
您想要的行为更适合主工具栏。使用
toolbar:org.eclipse.ui.main.toolbar
创建一个工具栏,然后将命令放入其中。如果没有图标,则应该获取文本。You cannot put SWT MenuItems reliably in the main menu bar, which is what you are trying to do with that menuContribution. Windows supports it. Apparently Mac doesn't. Eclipse and its user guidelines definitely don't recommend it.
The behaviour your want is more appropriate for the main toolbar. Use
toolbar:org.eclipse.ui.main.toolbar
, create a toolbar, and then place your commands inside. If you don't have icons, you should get text.将命令放入菜单中是否有效?
Does it work when you put the commands inside a menu?