下面列出了org.eclipse.swt.widgets.MenuItem#getDisplay ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Clicks on the {@link MenuItem}.
*
* @param menuItem
* the {@link MenuItem} to click on
*/
private static void click(final MenuItem menuItem) {
final Event event = new Event();
event.time = (int) System.currentTimeMillis();
event.widget = menuItem;
event.display = menuItem.getDisplay();
event.type = SWT.Selection;
UIThreadRunnable.asyncExec(menuItem.getDisplay(), new VoidResult() {
@Override
public void run() {
if (SWTUtils.hasStyle(menuItem, SWT.CHECK) || SWTUtils.hasStyle(menuItem, SWT.RADIO)) {
menuItem.setSelection(!menuItem.getSelection());
}
menuItem.notifyListeners(SWT.Selection, event);
}
});
}
private static void click(final MenuItem menuItem) {
final Event event = new Event();
event.time = (int) System.currentTimeMillis();
event.widget = menuItem;
event.display = menuItem.getDisplay();
event.type = SWT.Selection;
UIThreadRunnable.asyncExec(
menuItem.getDisplay(),
new VoidResult() {
@Override
public void run() {
menuItem.notifyListeners(SWT.Selection, event);
}
});
}