if (surroundingTry != null && ASTNodes.isParent(surroundingTry.getBody(), selectedNode)) {
if (surroundingTry != null && ASTNodes.isParent(selectedNode, surroundingTry.getBody())) {
	public static void addUncaughtExceptionProposals(ICorrectionContext context, List proposals) throws CoreException {		ICompilationUnit cu= context.getCompilationUnit();		CompilationUnit astRoot= context.getASTRoot();		ASTNode selectedNode= context.getCoveredNode();		if (selectedNode == null) {			return;		}		while (selectedNode != null && !(selectedNode instanceof Statement)) {			selectedNode= selectedNode.getParent();		}		if (selectedNode == null) {			return;		}					CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();		SurroundWithTryCatchRefactoring refactoring= new SurroundWithTryCatchRefactoring(cu, selectedNode.getStartPosition(), selectedNode.getLength(), settings, null);		refactoring.setSaveChanges(false);		if (refactoring.checkActivationBasics(astRoot, null).isOK()) {			String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.surroundwith.description"); //$NON-NLS-1$			Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION);			CUCorrectionProposal proposal= new CUCorrectionProposal(label, (CompilationUnitChange) refactoring.createChange(null), 4, image);			proposals.add(proposal);		}				BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode);		if (decl == null) {			return;		}		ITypeBinding[] uncaughtExceptions= ExceptionAnalyzer.perform(decl, Selection.createFromStartLength(selectedNode.getStartPosition(), selectedNode.getLength()));		if (uncaughtExceptions.length == 0) {			return;		}				TryStatement surroundingTry= ASTResolving.findParentTryStatement(selectedNode);		if (surroundingTry != null && ASTNodes.isParent(surroundingTry.getBody(), selectedNode)) {			ASTRewrite rewrite= new ASTRewrite(surroundingTry);			String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addadditionalcatch.description"); //$NON-NLS-1$			Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION);			ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 5, image);						AST ast= astRoot.getAST();			List catchClauses= surroundingTry.catchClauses();			for (int i= 0; i < uncaughtExceptions.length; i++) {				String imp= proposal.addImport(uncaughtExceptions[i]);				Name name= ASTNodeFactory.newName(ast, imp);				SingleVariableDeclaration var= ast.newSingleVariableDeclaration();				var.setName(ast.newSimpleName("e")); //$NON-NLS-1$				var.setType(ast.newSimpleType(name));				CatchClause newClause= ast.newCatchClause();				newClause.setException(var);				rewrite.markAsInserted(newClause);				catchClauses.add(newClause);			}			proposal.ensureNoModifications();			proposals.add(proposal);						}				if (decl instanceof MethodDeclaration) {			ASTRewrite rewrite= new ASTRewrite(astRoot);			String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addthrows.description"); //$NON-NLS-1$			Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION);			ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 6, image);						AST ast= astRoot.getAST();			MethodDeclaration methodDecl= (MethodDeclaration) decl;			List exceptions= methodDecl.thrownExceptions();			for (int i= 0; i < uncaughtExceptions.length; i++) {				String imp= proposal.addImport(uncaughtExceptions[i]);				Name name= ASTNodeFactory.newName(ast, imp);				rewrite.markAsInserted(name);				exceptions.add(name);			}			for (int i= 0; i < exceptions.size(); i++) {				Name elem= (Name) exceptions.get(i);				if (canRemove(elem.resolveTypeBinding(), uncaughtExceptions)) {					rewrite.markAsRemoved(elem);				}			}			proposal.ensureNoModifications();			proposals.add(proposal);		}	}