我一直在尝试在 Eclipse 中以编程方式调用刷新 (F5) 并获得 NotHandledException, handler not found 错误。帮助将不胜感激。
在我的课上: NewPreferencePage extends PreferencePage implements IWorkbenchPreferencePage 我有以下代码:
@Override
public void dispose() {
super.dispose();
final String COMMAND_ID = "org.eclipse.ui.file.refresh";
IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
try {
handlerService.executeCommand(COMMAND_ID,null);
} catch (ExecutionException ex) {
ex.printStackTrace();
} catch (NotDefinedException ex) {
ex.printStackTrace();
} catch (NotEnabledException ex) {
ex.printStackTrace();
} catch (NotHandledException ex) {
ex.printStackTrace();
}
}