Bug 9228 Surround with try-catch works only if the selected code throws a exception
As there are runtime exceptions, wich can be interesting to catch by clients, it would be nice to allow the surround feature on any code snippet. Standard exception could be Throwable.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/SurroundWithTryCatchAction.java
ISourceRange range= context.getSourceRange();
					fEditor.setHighlightRange(range.getOffset(), range.getLength(), true);
				}
				return;
			}
			PerformChangeOperation op= new PerformChangeOperation(refactoring.createChange(new NullProgressMonitor()));
			op.setChangeContext(new ChangeContext(new AbortChangeExceptionHandler()));
			new BusyIndicatorRunnableContext().run(false, false, op);
		} catch (CoreException e) {
			ExceptionHandler.handle(e, TITLE, RefactoringMessages.getString("SurroundWithTryCatchAction.exception")); 
		} catch (InvocationTargetException e) {
			ExceptionHandler.handle(e, TITLE, RefactoringMessages.getString("SurroundWithTryCatchAction.exception")); 
		} catch (InterruptedException e) {
			
		}
	}
	protected void selectionChanged(ITextSelection selection) {
		setEnabled(selection.getLength() > 0);
	}
	
	private final ICompilationUnit getCompilationUnit() {
		Object editorInput= SelectionConverter.getInput(fEditor);
		if (editorInput instanceof ICompilationUnit)
			return (ICompilationUnit)editorInput;
		else
			return null;
	}
	
}