@Override public RefactoringStatus checkActivation() throws JavaModelException { return new RefactoringStatus(); } @Override
public static RefactoringStatus checkPostConditions(IProgressMonitor monitor) { if (monitor != null) monitor.done(); fCurrentContext= null; return new RefactoringStatus(); }
@Override protected RefactoringStatus doCheckFinalConditions(IProgressMonitor pm, CheckConditionsContext context) throws CoreException { pm.beginTask("", 1); //$NON-NLS-1$ try{ return new RefactoringStatus(); } finally{ pm.done(); } }
@Override public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException { if (pm != null) { pm.beginTask("", 1); //$NON-NLS-1$ pm.worked(1); pm.done(); } return new RefactoringStatus(); }
private RefactoringStatus checkNonAbstractMembersInDestinationClasses(IMember[] membersToPushDown, IType[] destinationClassesForNonAbstract) throws JavaModelException { RefactoringStatus result= new RefactoringStatus(); List<IMember> list= new ArrayList<>(); // Arrays.asList does not support removing list.addAll(Arrays.asList(membersToPushDown)); list.removeAll(Arrays.asList(getAbstractMembers(membersToPushDown))); IMember[] nonAbstractMembersToPushDown= list.toArray(new IMember[list.size()]); for (int i= 0; i < destinationClassesForNonAbstract.length; i++) { result.merge(MemberCheckUtil.checkMembersInDestinationType(nonAbstractMembersToPushDown, destinationClassesForNonAbstract[i])); } return result; }
/** * Clears all results found so far, and sets resets the status to {@link RefactoringStatus#OK}. */ public final void clearResults() { getCollector().clearResults(); fStatus= new RefactoringStatus(); }
private RefactoringStatus checkAbstractMembersInDestinationClasses(IMember[] membersToPushDown, IType[] destinationClassesForAbstract) throws JavaModelException { RefactoringStatus result= new RefactoringStatus(); IMember[] abstractMembersToPushDown= getAbstractMembers(membersToPushDown); for (int index= 0; index < destinationClassesForAbstract.length; index++) { result.merge(MemberCheckUtil.checkMembersInDestinationType(abstractMembersToPushDown, destinationClassesForAbstract[index])); } return result; }
@Override public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException { try{ RefactoringStatus result= new RefactoringStatus(); result.merge(checkClashesWithExistingFields()); if (fInitializeIn == INITIALIZE_IN_CONSTRUCTOR) result.merge(checkClashesInConstructors()); return result; } finally { pm.done(); } }
@Override public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { if (fSubstitutions.length == 0) { String message= Messages.format(NLSMessages.NLSRefactoring_no_strings, BasicElementLabels.getFileName(fCu)); return RefactoringStatus.createFatalErrorStatus(message); } return new RefactoringStatus(); }
public RefactoringStatus perform(TextEditGroup textEditGroup) throws CoreException { RefactoringStatus result= new RefactoringStatus(); String[] blocks= fSourceProvider.getCodeBlocks(fContext, fImportRewrite); if(!fFieldInitializer) { initializeInsertionPoint(fSourceProvider.getNumberOfStatements() + fLocals.size()); } addNewLocals(textEditGroup); replaceCall(result, blocks, textEditGroup); return result; }
private RefactoringStatus analyzeCompilationUnits() throws CoreException { if (fOccurrences.length == 0) { return null; } RefactoringStatus result= new RefactoringStatus(); fOccurrences= Checks.excludeCompilationUnits(fOccurrences, result); if (result.hasFatalError()) { return result; } result.merge(Checks.checkCompileErrorsInAffectedFiles(fOccurrences)); return result; }
private RefactoringStatus analyzeAffectedCompilationUnits() throws CoreException{ RefactoringStatus result= new RefactoringStatus(); fReferences= Checks.excludeCompilationUnits(fReferences, result); if (result.hasFatalError()) { return result; } result.merge(Checks.checkCompileErrorsInAffectedFiles(fReferences)); return result; }
private RefactoringStatus checkIfAnythingToDo() throws JavaModelException { if (NLSSubstitution.countItems(fSubstitutions, NLSSubstitution.EXTERNALIZED) != 0 && willCreateAccessorClass()) return null; if (willModifyPropertyFile()) return null; if (willModifySource()) return null; RefactoringStatus result= new RefactoringStatus(); result.addFatalError(NLSMessages.NLSRefactoring_nothing_to_do); return result; }
private RefactoringStatus checkMatchingFragments() throws JavaModelException { RefactoringStatus result = new RefactoringStatus(); IASTFragment[] matchingFragments = getMatchingFragments(); for (int i = 0; i < matchingFragments.length; i++) { ASTNode node = matchingFragments[i].getAssociatedNode(); if (isLeftValue(node) && !isReferringToLocalVariableFromFor((Expression) node)) { String msg = RefactoringCoreMessages.ExtractTempRefactoring_assigned_to; result.addWarning(msg, JavaStatusContext.create(fCu, node)); } } return result; }
public static RefactoringStatus checkMembersInDestinationType(IMember[] members, IType destinationType) throws JavaModelException { RefactoringStatus result= new RefactoringStatus(); for (int i= 0; i < members.length; i++) { if (members[i].getElementType() == IJavaElement.METHOD) checkMethodInType(destinationType, result, (IMethod)members[i]); else if (members[i].getElementType() == IJavaElement.FIELD) checkFieldInType(destinationType, result, (IField)members[i]); else if (members[i].getElementType() == IJavaElement.TYPE) checkTypeInType(destinationType, result, (IType)members[i]); } return result; }
public RefactoringStatus checkActivationBasics(CompilationUnit rootNode) throws CoreException { RefactoringStatus result= new RefactoringStatus(); fRootNode= rootNode; fAnalyzer= new SurroundWithTryCatchAnalyzer(fCUnit, fSelection); fRootNode.accept(fAnalyzer); result.merge(fAnalyzer.getStatus()); ITypeBinding[] exceptions= fAnalyzer.getExceptions(); if (fIsMultiCatch && (exceptions == null || exceptions.length <= 1)) { result.merge(RefactoringStatus.createWarningStatus(RefactoringCoreMessages.SurroundWithTryCatchRefactoring_notMultipleexceptions)); } return result; }
private RefactoringStatus validatePage(boolean text) { RefactoringStatus result= new RefactoringStatus(); if (text) { result.merge(validateMethodName()); result.merge(validateParameters()); } else { result.merge(validateParameters()); result.merge(validateMethodName()); } return result; }
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 RefactoringStatus checkTypesInCompilationUnit() { RefactoringStatus result= new RefactoringStatus(); if (! Checks.isTopLevel(fType)){ //the other case checked in checkTypesInPackage IType siblingType= fType.getDeclaringType().getType(getNewElementName()); if (siblingType.exists()){ String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_member_type_exists, new String[] { getNewElementLabel(), BasicElementLabels.getJavaElementName(fType.getDeclaringType().getFullyQualifiedName('.'))}); result.addError(msg, JavaStatusContext.create(siblingType)); } } return result; }
private RefactoringStatus checkClass() { RefactoringStatus status= new RefactoringStatus(); IType type= fDescriptor.getType(); if (!fDescriptor.isCreateTopLevel()) { if (type.getType(fDescriptor.getClassName()).exists()) { status.addError(Messages.format(RefactoringCoreMessages.ExtractClassRefactoring_errror_nested_name_clash, new Object[] { BasicElementLabels.getJavaElementName(fDescriptor.getClassName()), BasicElementLabels.getJavaElementName(type.getElementName()) })); } } else { status.merge(checkPackageClass()); } return status; }