private static RefactoringStatus analyzeCompileErrors( String newCuSource, CompilationUnit newCUNode, CompilationUnit oldCUNode) { RefactoringStatus result = new RefactoringStatus(); IProblem[] newProblems = RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, oldCUNode); for (int i = 0; i < newProblems.length; i++) { IProblem problem = newProblems[i]; if (problem.isError()) result.addEntry( new RefactoringStatusEntry( (problem.isError() ? RefactoringStatus.ERROR : RefactoringStatus.WARNING), problem.getMessage(), new JavaStringStatusContext(newCuSource, SourceRangeFactory.create(problem)))); } return result; }
private void checkSource(SubProgressMonitor monitor, RefactoringStatus result) throws CoreException { String newCuSource = fChange.getPreviewContent(new NullProgressMonitor()); CompilationUnit newCUNode = new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL) .parse(newCuSource, fCu, true, true, monitor); IProblem[] newProblems = RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, fCuRewrite.getRoot()); for (int i = 0; i < newProblems.length; i++) { IProblem problem = newProblems[i]; if (problem.isError()) result.addEntry( new RefactoringStatusEntry( (problem.isError() ? RefactoringStatus.ERROR : RefactoringStatus.WARNING), problem.getMessage(), new JavaStringStatusContext(newCuSource, SourceRangeFactory.create(problem)))); } }