ImportEdit edit= new ImportEdit(cu, JavaPreferencesSettings.getCodeGenerationSettings()); edit.addImport(uncaughtName); proposal.getCompilationUnitChange().addTextEdit("import", edit);
addImportToProposal(cu, uncaughtName, proposal);
	public static void addUncaughtExceptionProposals(ProblemPosition problemPos, ArrayList proposals) throws CoreException {		ICompilationUnit cu= problemPos.getCompilationUnit();		CompilationUnit astRoot= AST.parseCompilationUnit(cu, true);		ASTNode selectedNode= ASTResolving.findSelectedNode(astRoot, problemPos.getOffset(), problemPos.getLength());		if (selectedNode == null) {			return;		}		while (selectedNode != null && !(selectedNode instanceof Statement)) {			selectedNode= selectedNode.getParent();		}		if (selectedNode != null) {			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$				CUCorrectionProposal proposal= new CUCorrectionProposal(label, (CompilationUnitChange) refactoring.createChange(null), 0);				proposal.setImage(JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION));				proposals.add(proposal);			}		}				BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(selectedNode);		if (decl instanceof MethodDeclaration) {						String uncaughtName= problemPos.getArguments()[0];						MethodDeclaration methodDecl= (MethodDeclaration) decl;			List exceptions= methodDecl.thrownExceptions();			SimpleName addedException= astRoot.getAST().newSimpleName(Signature.getSimpleName(uncaughtName));			exceptions.add(addedException);			ASTRewriteAnalyzer.markAsInserted(addedException);						String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.addthrows.description"); //$NON-NLS-1$			Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION);			ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, astRoot, 0, image);			ImportEdit edit= new ImportEdit(cu, JavaPreferencesSettings.getCodeGenerationSettings());			edit.addImport(uncaughtName);			proposal.getCompilationUnitChange().addTextEdit("import", edit); //$NON-NLS-1$					proposals.add(proposal);		}	}