Search in sources :

Example 6 with DeleteResourceChange

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

the class UndoDeleteResourceChange method perform.

public Change perform(IProgressMonitor pm) throws CoreException {
    if (fResourceState.verifyExistence(true)) {
        String message = Messages.format(RefactoringCoreMessages.UndoDeleteResourceChange_already_exists, BasicElementLabels.getResourceName(fResourceState.getName()));
        throw new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), message));
    }
    IResource created = fResourceState.createResource(pm);
    created.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(pm, 1));
    DeleteResourceChange change = new DeleteResourceChange(created.getFullPath(), true, false);
    change.setValidationMethod(ResourceChange.VALIDATE_NOT_READ_ONLY | ResourceChange.VALIDATE_NOT_DIRTY);
    return change;
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus) CoreException(org.eclipse.core.runtime.CoreException) DeleteResourceChange(org.eclipse.ltk.core.refactoring.resource.DeleteResourceChange) IResource(org.eclipse.core.resources.IResource) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor)

Aggregations

DeleteResourceChange (org.eclipse.ltk.core.refactoring.resource.DeleteResourceChange)6 SubProgressMonitor (org.eclipse.core.runtime.SubProgressMonitor)3 IFile (org.eclipse.core.resources.IFile)2 IResource (org.eclipse.core.resources.IResource)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 SubMonitor (org.eclipse.core.runtime.SubMonitor)1 IPackageFragmentRoot (org.eclipse.jdt.core.IPackageFragmentRoot)1 JavaModelException (org.eclipse.jdt.core.JavaModelException)1 CompositeChange (org.eclipse.ltk.core.refactoring.CompositeChange)1 NullChange (org.eclipse.ltk.core.refactoring.NullChange)1 RefactoringChangeDescriptor (org.eclipse.ltk.core.refactoring.RefactoringChangeDescriptor)1 RefactoringStatus (org.eclipse.ltk.core.refactoring.RefactoringStatus)1