Ant*_*nÓg 3 eclipse swt command
在Eclipse中,您可以使用菜单贡献来添加将调用命令的工具栏按钮和菜单.除了以编程方式调用命令onclick之外,有没有办法对普通的swt按钮执行此操作?
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IHandlerService handlerService = (IHandlerService) getSite()
.getService(IHandlerService.class);
try {
handlerService.executeCommand("my command id", null);
} catch (Exception ex) {
throw new RuntimeException("command with id \"my command id\" not found");
}
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1768 次 |
| 最近记录: |