java - Simulate click on menu item in SWT -


i want simulate click on menu item found no method. i'm thinking of doclick() of jmenu.

at moment stupid solution looks this:

private void performclick(menuitem source, event event) {   source.notifylisteners(swt.selection, event); } 

but maybe there's better way fire event?

a menuitem in swt can controlled method

addselectionlistener(selectionlistener listener)

the selectionlistener provides method

public void widgetselected(selectionevent arg0) {}

where can include desired functionality.

for documentation class menu item see:

http://help.eclipse.org/luna/index.jsp?topic=%2forg.eclipse.platform.doc.isv%2freference%2fapi%2forg%2feclipse%2fswt%2fwidgets%2fmenuitem.html


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -