1 11 package org.eclipse.team.internal.core; 12 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.IProjectDescription; 18 import org.eclipse.core.resources.IResource; 19 import org.eclipse.core.resources.team.IMoveDeleteHook; 20 import org.eclipse.core.resources.team.IResourceTree; 21 import org.eclipse.core.runtime.IProgressMonitor; 22 import org.eclipse.team.core.RepositoryProvider; 23 24 public class MoveDeleteManager implements IMoveDeleteHook { 25 26 private static final IMoveDeleteHook DEFAULT_HOOK = new DefaultMoveDeleteHook(); 27 28 private IMoveDeleteHook getHookFor(IResource resource) { 29 IProject project = resource.getProject(); 30 RepositoryProvider provider = RepositoryProvider.getProvider(project); 31 if(provider==null) { 32 return DEFAULT_HOOK; 33 } 34 IMoveDeleteHook hook = provider.getMoveDeleteHook(); 35 if (hook == null) { 36 return DEFAULT_HOOK; 37 } 38 return hook; 39 } 40 41 44 public boolean deleteFile( 45 IResourceTree tree, 46 IFile file, 47 int updateFlags, 48 IProgressMonitor monitor) { 49 50 return getHookFor(file).deleteFile(tree, file, updateFlags, monitor); 51 } 52 53 56 public boolean deleteFolder( 57 IResourceTree tree, 58 IFolder folder, 59 int updateFlags, 60 IProgressMonitor monitor) { 61 62 return getHookFor(folder).deleteFolder(tree, folder, updateFlags, monitor); 63 } 64 65 68 public boolean deleteProject( 69 IResourceTree tree, 70 IProject project, 71 int updateFlags, 72 IProgressMonitor monitor) { 73 74 return getHookFor(project).deleteProject(tree, project, updateFlags, monitor); 75 } 76 77 80 public boolean moveFile( 81 IResourceTree tree, 82 IFile source, 83 IFile destination, 84 int updateFlags, 85 IProgressMonitor monitor) { 86 87 return getHookFor(source).moveFile(tree, source, destination, updateFlags, monitor); 88 } 89 90 93 public boolean moveFolder( 94 IResourceTree tree, 95 IFolder source, 96 IFolder destination, 97 int updateFlags, 98 IProgressMonitor monitor) { 99 100 return getHookFor(source).moveFolder(tree, source, destination, updateFlags, monitor); 101 } 102 103 106 public boolean moveProject( 107 IResourceTree tree, 108 IProject source, 109 IProjectDescription description, 110 int updateFlags, 111 IProgressMonitor monitor) { 112 113 return getHookFor(source).moveProject(tree, source, description, updateFlags, monitor); 114 } 115 116 } 117 | Popular Tags |