use of org.eclipse.jdt.internal.corext.refactoring.base.JavaStringStatusContext in project che by eclipse.
the class ChangeSignatureProcessor method checkCompilationofDeclaringCu.
private RefactoringStatus checkCompilationofDeclaringCu() throws CoreException {
ICompilationUnit cu = getCu();
TextChange change = fChangeManager.get(cu);
String newCuSource = change.getPreviewContent(new NullProgressMonitor());
CompilationUnit newCUNode = new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL).parse(newCuSource, cu, true, false, null);
IProblem[] problems = RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, fBaseCuRewrite.getRoot());
RefactoringStatus result = new RefactoringStatus();
for (int i = 0; i < problems.length; i++) {
IProblem problem = problems[i];
if (shouldReport(problem, newCUNode))
result.addEntry(new RefactoringStatusEntry((problem.isError() ? RefactoringStatus.ERROR : RefactoringStatus.WARNING), problem.getMessage(), new JavaStringStatusContext(newCuSource, SourceRangeFactory.create(problem))));
}
return result;
}
use of org.eclipse.jdt.internal.corext.refactoring.base.JavaStringStatusContext in project che by eclipse.
the class ExtractTempRefactoring method checkNewSource.
private void checkNewSource(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, fCompilationUnitNode);
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))));
}
}
use of org.eclipse.jdt.internal.corext.refactoring.base.JavaStringStatusContext in project che by eclipse.
the class ExtractConstantRefactoring method checkSource.
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))));
}
}
use of org.eclipse.jdt.internal.corext.refactoring.base.JavaStringStatusContext in project che by eclipse.
the class RefactoringAnalyzeUtil method reportProblemNodes.
public static RefactoringStatus reportProblemNodes(String modifiedWorkingCopySource, SimpleName[] problemNodes) {
RefactoringStatus result = new RefactoringStatus();
for (int i = 0; i < problemNodes.length; i++) {
RefactoringStatusContext context = new JavaStringStatusContext(modifiedWorkingCopySource, SourceRangeFactory.create(problemNodes[i]));
result.addError(Messages.format(RefactoringCoreMessages.RefactoringAnalyzeUtil_name_collision, BasicElementLabels.getJavaElementName(problemNodes[i].getIdentifier())), context);
}
return result;
}
use of org.eclipse.jdt.internal.corext.refactoring.base.JavaStringStatusContext in project che by eclipse.
the class RenameAnalyzeUtil method analyzeCompileErrors.
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;
}
Aggregations