/** * 处理Ctrl+z ctrl+y 撤销重做事件 * @param event * @author lldy 2013-6-20 */ private void handleCtrlZYEvent(Event event){ if((event.keyCode & SWT.KEYCODE_BIT) == 0 && event.character != 0){ boolean ctrlDown = (event.stateMask & SWT.CTRL) != 0; boolean altDown = (event.stateMask & SWT.ALT) != 0; if (ctrlDown && !altDown){ switch(event.keyCode){ case 'z'://撤销 if(editor.getUndoManager().canUndo()){ undoAction.run(); } break; case 'y'://重做 if(editor.getUndoManager().canRedo()){ redoAction.run(); } break; default:break; } } } }