Search in sources :

Example 1 with DeleteResourcesProcessor

use of org.eclipse.ltk.internal.core.refactoring.resource.DeleteResourcesProcessor in project che by eclipse.

the class DeleteResourcesDescriptor method createRefactoring.

/* (non-Javadoc)
	 * @see org.eclipse.ltk.core.refactoring.RefactoringDescriptor#createRefactoring(org.eclipse.ltk.core.refactoring.RefactoringStatus)
	 */
public Refactoring createRefactoring(RefactoringStatus status) throws CoreException {
    IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
    IResource[] resources = new IResource[fResourcePaths.length];
    for (int i = 0; i < fResourcePaths.length; i++) {
        IResource resource = wsRoot.findMember(fResourcePaths[i]);
        if (resource == null || !resource.exists()) {
            status.addFatalError(Messages.format(RefactoringCoreMessages.DeleteResourcesDescriptor_error_delete_not_exists, BasicElementLabels.getPathLabel(fResourcePaths[i], false)));
            return null;
        }
        resources[i] = resource;
    }
    DeleteResourcesProcessor processor = new DeleteResourcesProcessor(resources, fDeleteContents);
    return new DeleteRefactoring(processor);
}
Also used : DeleteResourcesProcessor(org.eclipse.ltk.internal.core.refactoring.resource.DeleteResourcesProcessor) IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot) DeleteRefactoring(org.eclipse.ltk.core.refactoring.participants.DeleteRefactoring) IResource(org.eclipse.core.resources.IResource)

Aggregations

IResource (org.eclipse.core.resources.IResource)1 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)1 DeleteRefactoring (org.eclipse.ltk.core.refactoring.participants.DeleteRefactoring)1 DeleteResourcesProcessor (org.eclipse.ltk.internal.core.refactoring.resource.DeleteResourcesProcessor)1