Bug 95830 [quick fix] Wrong linked proposals in 'add throws' quick fix
When the user selects the "Add throws declaration" quick fix to add the exceptions thrown by a method, and the number of exceptions thrown is greater than one, then the drop down box presented with the first exception added (re-added in the case that the exception was already in the list) is that of the next exception in the list. Eg: For method that throws "SQLException, InvalidCashMarginTradesFile" The calling method has the following added to it's throws clause as such: +------------+ throws IOException, |SQLException|, InvalidCashMarginTradesFile +------------+--------------+ |InvalidCashMarginTradesFile| |Exception | |Throwable | +---------------------------+ Should I select the first option, the next element is not processed (no drop-down) and I am left with the following: throws IOException, InvalidCashMarginTradesFile, InvalidCashMarginTradesFile If I were adding 3 exceptions, then the first one would have the drop down of the second, as described, the second exception would have the drop-down of the third and the last one would be ignored. My version of Eclipse has been upgraded from 3.0.0 to 3.0.1 and then to 3.0.2 via the update mechanism.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
}
		SurroundWithTryCatchRefactoring refactoring= SurroundWithTryCatchRefactoring.create(cu, offset, length, null);
		if (refactoring == null)
			return;
		refactoring.setLeaveDirty(true);
		if (refactoring.checkActivationBasics(astRoot).isOK()) {
			String label= CorrectionMessages.LocalCorrectionsSubProcessor_surroundwith_description;
			Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION);
			CUCorrectionProposal proposal= new CUCorrectionProposal(label, cu, (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(offset, length));
		if (uncaughtExceptions.length == 0) {
			return;
		}
		TryStatement surroundingTry= ASTResolving.findParentTryStatement(selectedNode);
		if (surroundingTry != null && ASTNodes.isParent(selectedNode, surroundingTry.getBody())) {
			ASTRewrite rewrite= ASTRewrite.create(surroundingTry.getAST());
			ImportRewrite imports= new ImportRewrite(cu);
			String label= CorrectionMessages.LocalCorrectionsSubProcessor_addadditionalcatch_description;
			Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION);
			LinkedCorrectionProposal proposal= new LinkedCorrectionProposal(label, cu, rewrite, 5, image);
			proposal.setImportRewrite(imports);
			AST ast= astRoot.getAST();
			ListRewrite clausesRewrite= rewrite.getListRewrite(surroundingTry, TryStatement.CATCH_CLAUSES_PROPERTY);
			for (int i= 0; i < uncaughtExceptions.length; i++) {