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/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
StringBuffer insertString= new StringBuffer();
			if (methodDecl.thrownExceptions().isEmpty()) {
				insertString.append(" throws "); 
			} else {
				insertString.append(", "); 
			}
			insertString.append(Signature.getSimpleName(uncaughtName));
			
			String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addthrows.description"); 
			InsertCorrectionProposal proposal= new InsertCorrectionProposal(label, cu, pos, insertString.toString(), 0);
			CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
			ImportEdit edit= new ImportEdit(cu, settings);
			edit.addImport(uncaughtName);
			proposal.getCompilationUnitChange().addTextEdit("import", edit); 
		
			proposals.add(proposal);
		}
	}
	
	public static void addMethodWithConstrNameProposals(ProblemPosition problemPos, ArrayList proposals) throws CoreException {
		ICompilationUnit cu= problemPos.getCompilationUnit();
		CompilationUnit astRoot= AST.parseCompilationUnit(cu, false);
		ASTNode selectedNode= ASTResolving.findSelectedNode(astRoot, problemPos.getOffset(), problemPos.getLength());
		if (selectedNode instanceof SimpleName && selectedNode.getParent() instanceof MethodDeclaration) {
			MethodDeclaration declaration= (MethodDeclaration) selectedNode.getParent();
			int start= declaration.getReturnType().getStartPosition();
			int end= declaration.getName().getStartPosition();
			String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.constrnamemethod.description"); 
			ReplaceCorrectionProposal proposal= new ReplaceCorrectionProposal(label, cu, start, end - start, "", 0);  
			proposals.add(proposal);