return viewer;
}
private void initializeActions() {
final ArrayList handlerActivations= new ArrayList(3);
final IHandlerService handlerService= (IHandlerService)PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
final Expression expression= new ActiveShellExpression(fPatternEditor.getControl().getShell());
getShell().addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
handlerService.deactivateHandlers(handlerActivations);
}
});
fPatternEditor.getTextWidget().addFocusListener(new FocusListener() {
public void focusLost(FocusEvent e) {
handlerService.deactivateHandlers(handlerActivations);
}
public void focusGained(FocusEvent e) {
IAction action= (IAction)fGlobalActions.get(ITextEditorActionConstants.REDO);
handlerActivations.add(handlerService.activateHandler(IWorkbenchCommandConstants.EDIT_REDO, new ActionHandler(action), expression));
action= (IAction)fGlobalActions.get(ITextEditorActionConstants.UNDO);
handlerActivations.add(handlerService.activateHandler(IWorkbenchCommandConstants.EDIT_UNDO, new ActionHandler(action), expression));
action= (IAction)fGlobalActions.get(ITextEditorActionConstants.CONTENT_ASSIST);
handlerActivations.add(handlerService.activateHandler(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new ActionHandler(action), expression));
}
});
TextViewerAction action= new TextViewerAction(fPatternEditor, ITextOperationTarget.UNDO);
action.setText(TemplatesMessages.EditTemplateDialog_undo);