@Override public void setContext(ActionContext context) { super.setContext(context); if (context != null) { ISelection selection = context.getSelection(); IStructuredSelection structuredSelection = selection instanceof IStructuredSelection ? (IStructuredSelection) selection : StructuredSelection.EMPTY; removeAction.setEnabled(removeAction.updateSelection(structuredSelection)); cutAction.setEnabled(cutAction.updateSelection(structuredSelection)); copyAction.setEnabled(copyAction.updateSelection(structuredSelection)); pasteAction.setEnabled(pasteAction.updateSelection(structuredSelection)); undoAction.update(); redoAction.update(); } }