Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SWT Text widget: how to insert own MenuItems into the default context menu?

The default context menu for the org.eclipse.swt.widgets.Text class is quite a rich thing, packed with features that the user has come to depend on ...

Default text context menu, Mac edition

However, as soon as I assign my own context menu with Control.setMenu() all that richness goes away. Is there a means of inserting my own MenuItem object into this system-created menu .. can I have my cake and eat it?

Your clues are always most welcome.

M.

like image 460
Martin Cowie Avatar asked Nov 04 '22 16:11

Martin Cowie


1 Answers

You cannot access the native menu from SWT. It is there, if there are no other menus set for the control. As you noticed, as soon as you set your own menu for the control, this new menu will completely replace the native menu.

As far as I can see, the behavior is common to all platforms.

like image 155
Tonny Madsen Avatar answered Nov 18 '22 21:11

Tonny Madsen