/* (non-Javadoc) * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext) */ public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context) throws CoreException, OperationCanceledException { pm.beginTask("", 1); // $NON-NLS-1$ try { RefactoringStatus result = new RefactoringStatus(); for (int i = 0; i < fResources.length; i++) { IResource resource = fResources[i]; if (!resource.isSynchronized(IResource.DEPTH_INFINITE)) { if (resource instanceof IFile) { result.addInfo( Messages.format( RefactoringCoreMessages.DeleteResourcesProcessor_warning_out_of_sync_file, BasicElementLabels.getPathLabel(resource.getFullPath(), false))); } else { result.addInfo( Messages.format( RefactoringCoreMessages.DeleteResourcesProcessor_warning_out_of_sync_container, BasicElementLabels.getPathLabel(resource.getFullPath(), false))); } } } checkDirtyResources(result); ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class); IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory(); for (int i = 0; i < fResources.length; i++) { if (fResources[i].isPhantom()) { result.addFatalError( Messages.format( RefactoringCoreMessages.DeleteResourcesProcessor_delete_error_phantom, BasicElementLabels.getPathLabel(fResources[i].getFullPath(), false))); } else if (fDeleteContents && Resources.isReadOnly(fResources[i])) { result.addFatalError( Messages.format( RefactoringCoreMessages.DeleteResourcesProcessor_delete_error_read_only, BasicElementLabels.getPathLabel(fResources[i].getFullPath(), false))); } else { deltaFactory.delete(fResources[i]); } } return result; } finally { pm.done(); } }
public void buildDelta(IResourceChangeDescriptionFactory builder) { builder.create(fResource); }
public void buildDelta(IResourceChangeDescriptionFactory builder) { builder.change((IFile) fResource); }
public static void buildCopyDelta( IResourceChangeDescriptionFactory builder, IResource resource, CopyArguments args) { IPath destination = ((IResource) args.getDestination()).getFullPath().append(resource.getName()); builder.copy(resource, destination); }
public static void buildMoveDelta( IResourceChangeDescriptionFactory builder, IResource resource, RenameArguments args) { IPath newPath = resource.getFullPath().removeLastSegments(1).append(args.getNewName()); builder.move(resource, newPath); }
public void buildDelta(IResourceChangeDescriptionFactory builder) { builder.copy(fResource, fDestination); }