@Override public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException { if (fChanges == null || fChanges.size() < 1) { return RefactoringStatus.createErrorStatus(WizardMessages.JavadocTagRefactoring_0); } return RefactoringStatus.create(Status.OK_STATUS); }
/** * Returns a <code>RefactoringStatus</code> that identifies whether the * the name <code>newMethodName</code> is available to use as the name of * the new factory method within the factory-owner class (either a to-be- * created factory class or the constructor-owning class, depending on the * user options). * @param methodName */ private RefactoringStatus isUniqueMethodName(String methodName) { boolean conflict= hasMethod(fFactoryOwningClass, methodName); return conflict ? RefactoringStatus.createErrorStatus(RefactoringCoreMessages.IntroduceFactory_duplicateMethodName + methodName) : new RefactoringStatus(); }
public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException { try { RefactoringStatus status= validateInput(); if (accessesAnonymousFields()) status.merge(RefactoringStatus.createErrorStatus(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_anonymous_field_access)); return status; } finally { pm.done(); } }
@Override public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException { try { RefactoringStatus status= validateInput(); if (accessesAnonymousFields()) status.merge(RefactoringStatus.createErrorStatus(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_anonymous_field_access)); return status; } finally { pm.done(); } }
@Override public RefactoringStatus verifyDestination(IReorgDestination destination) throws JavaModelException { if (destination instanceof JavaElementDestination) { return verifyDestination(((JavaElementDestination)destination).getJavaElement()); } else if (destination instanceof ResourceDestination) { return verifyDestination(((ResourceDestination)destination).getResource()); } return RefactoringStatus.createErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_invalidDestinationKind); }
public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException, OperationCanceledException { if(fProject.isAccessible()) { return RefactoringStatus.create(Status.OK_STATUS); } return RefactoringStatus.createErrorStatus(MessageFormat.format(WizardMessages.ProjectUpdateChange_project_not_accessible, new String[] {fProject.getName()})); }
@Override public RefactoringStatus verifyDestination(IReorgDestination destination) throws JavaModelException { if (destination instanceof JavaElementDestination) { return verifyDestination(((JavaElementDestination)destination).getJavaElement()); } else if (destination instanceof ResourceDestination) { return verifyDestination(((ResourceDestination)destination).getResource()); } return RefactoringStatus.createErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_invalidDestinationKind); }
@Override public RefactoringStatus verifyDestination(IReorgDestination destination) throws JavaModelException { if (destination instanceof JavaElementDestination) { return verifyDestination(((JavaElementDestination)destination).getJavaElement()); } else if (destination instanceof ResourceDestination) { return verifyDestination(((ResourceDestination)destination).getResource()); } return RefactoringStatus.createErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_invalidDestinationKind); }
private RefactoringStatus checkEnclosedTypes() throws CoreException { IType enclosedType= findEnclosedType(fType, getNewElementName()); if (enclosedType == null) return null; String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_encloses, new String[]{JavaModelUtil.getFullyQualifiedName(fType), getNewElementName()}); return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(enclosedType)); }
private RefactoringStatus checkEnclosingTypes() { IType enclosingType= findEnclosingType(fType, getNewElementName()); if (enclosingType == null) return null; String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_enclosed, new String[]{JavaModelUtil.getFullyQualifiedName(fType), getNewElementName()}); return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(enclosingType)); }
private RefactoringStatus checkTypeNameInPackage() throws JavaModelException { IType type= Checks.findTypeInPackage(fType.getPackageFragment(), fType.getElementName()); if (type == null || !type.exists() || fType.equals(type)) { return null; } String message= Messages.format(RefactoringCoreMessages.MoveInnerToTopRefactoring_type_exists, new String[] { BasicElementLabels.getJavaElementName(fType.getElementName()), JavaElementLabels.getElementLabel(fType.getPackageFragment(), JavaElementLabels.ALL_DEFAULT)}); return RefactoringStatus.createErrorStatus(message); }
private RefactoringStatus checkTypeNameInPackage() throws JavaModelException { IType type= Checks.findTypeInPackage(fType.getPackageFragment(), fType.getElementName()); if (type == null || !type.exists() || fType.equals(type)) { return null; } String message= Messages.format(RefactoringCoreMessages.MoveInnerToTopRefactoring_type_exists, new String[] { BasicElementLabels.getJavaElementName(fType.getElementName()), JavaElementLabels.getElementLabel(fType.getPackageFragment(), JavaElementLabels.ALL_DEFAULT)}); return RefactoringStatus.createErrorStatus(message); }
private RefactoringStatus checkEnclosedTypes() throws CoreException { IType enclosedType = findEnclosedType(fType, getNewElementName()); if (enclosedType == null) { return null; } String msg = Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_encloses, new String[] { BasicElementLabels.getJavaElementName(fType.getFullyQualifiedName('.')), getNewElementLabel() }); return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(enclosedType)); }
private RefactoringStatus checkEnclosingTypes() { IType enclosingType = findEnclosingType(fType, getNewElementName()); if (enclosingType == null) { return null; } String msg = Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_enclosed, new String[] { BasicElementLabels.getJavaElementName(fType.getFullyQualifiedName('.')), getNewElementLabel() }); return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(enclosingType)); }
private RefactoringStatus checkEnclosedTypes() throws CoreException { IType enclosedType= findEnclosedType(fType, getNewElementName()); if (enclosedType == null) return null; String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_encloses, new String[] { BasicElementLabels.getJavaElementName(fType.getFullyQualifiedName('.')), getNewElementLabel()}); return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(enclosedType)); }
private RefactoringStatus checkEnclosedTypes() throws CoreException { IType enclosedType= findEnclosedType(fType, getNewElementName()); if (enclosedType == null) return null; String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_encloses, new String[] { BasicElementLabels.getJavaElementName(fType.getFullyQualifiedName('.')), getNewElementLabel()}); return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(enclosedType)); }
private RefactoringStatus checkTypeNameInPackage() throws JavaModelException { IType type= Checks.findTypeInPackage(fType.getPackageFragment(), fType.getElementName()); if (type == null || !type.exists()) return null; String message= Messages.format(RefactoringCoreMessages.MoveInnerToTopRefactoring_type_exists, new String[] { fType.getElementName(), fType.getPackageFragment().getElementName()}); return RefactoringStatus.createErrorStatus(message); }
private RefactoringStatus checkTypesInPackage() throws CoreException { IType type = Checks.findTypeInPackage(fType.getPackageFragment(), getNewElementName()); if (type == null || !type.exists()) { return null; } String msg = Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_exists, new String[] { getNewElementLabel(), JavaElementLabels.getElementLabel(fType.getPackageFragment(), JavaElementLabels.ALL_DEFAULT) }); return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(type)); }
private RefactoringStatus checkTypesImportedInCu() throws CoreException { IImportDeclaration imp= getImportedType(fType.getCompilationUnit(), getNewElementName()); if (imp == null) return null; String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_imported, new Object[]{getNewElementName(), fType.getCompilationUnit().getResource().getFullPath()}); IJavaElement grandParent= imp.getParent().getParent(); if (grandParent instanceof ICompilationUnit) return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(imp)); return null; }
private RefactoringStatus checkTypesImportedInCu() throws CoreException { IImportDeclaration imp = getImportedType(fType.getCompilationUnit(), getNewElementName()); if (imp == null) { return null; } String msg = Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_imported, new Object[] { getNewElementLabel(), BasicElementLabels.getPathLabel(fType.getCompilationUnit().getResource().getFullPath(), false) }); IJavaElement grandParent = imp.getParent().getParent(); if (grandParent instanceof ICompilationUnit) { return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(imp)); } return null; }