1 11 12 package org.eclipse.ui.ide.undo; 13 14 import org.eclipse.core.resources.IFile; 15 import org.eclipse.core.resources.IFolder; 16 import org.eclipse.core.resources.IProject; 17 import org.eclipse.core.resources.IResource; 18 import org.eclipse.core.runtime.CoreException; 19 import org.eclipse.core.runtime.IProgressMonitor; 20 import org.eclipse.ui.internal.ide.undo.FileDescription; 21 import org.eclipse.ui.internal.ide.undo.FolderDescription; 22 import org.eclipse.ui.internal.ide.undo.ProjectDescription; 23 24 33 public abstract class ResourceDescription { 34 35 43 public static ResourceDescription fromResource(IResource resource) { 44 if (resource.getType() == IResource.PROJECT) { 45 return new ProjectDescription((IProject) resource); 46 } else if (resource.getType() == IResource.FOLDER) { 47 return new FolderDescription((IFolder) resource); 48 } else if (resource.getType() == IResource.FILE) { 49 return new FileDescription((IFile) resource); 50 } else { 51 throw new IllegalArgumentException (); 52 } 53 } 54 55 63 public abstract IResource createResourceHandle(); 64 65 70 public abstract String getName(); 71 72 80 public abstract IResource createResource(IProgressMonitor monitor) throws CoreException; 81 82 92 public abstract void createExistentResourceFromHandle(IResource resource, 93 IProgressMonitor monitor) throws CoreException; 94 95 102 public abstract boolean isValid(); 103 104 114 public abstract void recordStateFromHistory(IResource resource, 115 IProgressMonitor monitor) throws CoreException; 116 117 130 public abstract boolean verifyExistence(boolean checkMembers); 131 } 132 | Popular Tags |