use of org.eclipse.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class Checks method validateModifiesFiles.
//-------- validateEdit checks ----
public static RefactoringStatus validateModifiesFiles(IFile[] filesToModify, Object context) {
RefactoringStatus result = new RefactoringStatus();
IStatus status = Resources.checkInSync(filesToModify);
if (!status.isOK())
result.merge(RefactoringStatus.create(status));
status = Resources.makeCommittable(filesToModify, context);
if (!status.isOK()) {
result.merge(RefactoringStatus.create(status));
if (!result.hasFatalError()) {
result.addFatalError(RefactoringCoreMessages.Checks_validateEdit);
}
}
return result;
}
use of org.eclipse.ltk.core.refactoring.RefactoringStatus 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.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class JavaMoveProcessor method initialize.
private RefactoringStatus initialize(JavaRefactoringArguments arguments) {
setReorgQueries(new NullReorgQueries());
final RefactoringStatus status = new RefactoringStatus();
fMovePolicy = ReorgPolicyFactory.createMovePolicy(status, arguments);
if (fMovePolicy != null && !status.hasFatalError()) {
final CreateTargetExecutionLog log = ReorgPolicyFactory.loadCreateTargetExecutionLog(arguments);
if (log != null && !status.hasFatalError()) {
fMovePolicy.setDestinationCheck(false);
fCreateTargetQueries = new MonitoringCreateTargetQueries(new LoggedCreateTargetQueries(log), log);
}
status.merge(fMovePolicy.initialize(arguments));
}
return status;
}
use of org.eclipse.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class SelfEncapsulateFieldRefactoring method checkInitialConditions.
//----activation checking ----------------------------------------------------------
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
if (fVisibility < 0)
fVisibility = (fField.getFlags() & (Flags.AccPublic | Flags.AccProtected | Flags.AccPrivate));
RefactoringStatus result = new RefactoringStatus();
result.merge(Checks.checkAvailability(fField));
if (result.hasFatalError())
return result;
fRoot = new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL).parse(fField.getCompilationUnit(), true, pm);
ISourceRange sourceRange = fField.getNameRange();
ASTNode node = NodeFinder.perform(fRoot, sourceRange.getOffset(), sourceRange.getLength());
if (node == null) {
return mappingErrorFound(result, node);
}
fFieldDeclaration = (VariableDeclarationFragment) ASTNodes.getParent(node, VariableDeclarationFragment.class);
if (fFieldDeclaration == null) {
return mappingErrorFound(result, node);
}
if (fFieldDeclaration.resolveBinding() == null) {
if (!processCompilerError(result, node))
result.addFatalError(RefactoringCoreMessages.SelfEncapsulateField_type_not_resolveable);
return result;
}
computeUsedNames();
return result;
}
use of org.eclipse.ltk.core.refactoring.RefactoringStatus in project che by eclipse.
the class ChangeSignatureProcessor method checkNativeMethods.
private RefactoringStatus checkNativeMethods() throws JavaModelException {
RefactoringStatus result = new RefactoringStatus();
for (int i = 0; i < fRippleMethods.length; i++) {
if (JdtFlags.isNative(fRippleMethods[i])) {
String message = Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_native, new String[] { JavaElementUtil.createMethodSignature(fRippleMethods[i]), BasicElementLabels.getJavaElementName(fRippleMethods[i].getDeclaringType().getFullyQualifiedName('.')) });
result.addError(message, JavaStatusContext.create(fRippleMethods[i]));
}
}
return result;
}
Aggregations