Wednesday, June 16, 2010

Calling commands from a button

You can call a command, e.g. in this example "add.command" from a button via the following coding.

   
button.addSelectionListener(new SelectionAdapter() {

@Override
public void widgetSelected(SelectionEvent e) {
IHandlerService handlerService = (IHandlerService) getSite()
.getService(IHandlerService.class);
try {
handlerService.executeCommand("add.command", null);
} catch (Exception ex) {
throw new RuntimeException("add.command not found");
}

}
});

No comments:

Post a Comment

How to Block Spam Calls and Messages on Android

Spam calls and messages have gotten bad enough that most people now hesitate before answering any unknown number. The good news is Android h...