public boolean deleteFolder(IResourceTree tree, IFolder folder, int updateFlags, IProgressMonitor monitor) { if (SVNWorkspaceRoot.isLinkedResource(folder)) return false; ISVNLocalFolder resource = new LocalFolder(folder); try { if (!resource.isManaged()) { return false; } monitor.beginTask(null, 1000); deleteResource(resource); tree.deletedFolder(folder); } catch (SVNException e) { tree.failed(e.getStatus()); } finally { monitor.done(); } return true; }
public boolean deleteFile(IResourceTree tree, IFile file, int updateFlags, IProgressMonitor monitor) { if (SVNWorkspaceRoot.isLinkedResource(file)) return false; ISVNLocalFile resource = new LocalFile(file); try { if (!resource.isManaged()) { return false; } if (getDeferFileDelete(file)) return false; monitor.beginTask(null, 1000); deletedFiles.add(file); deleteResource(resource); tree.deletedFile(file); } catch (SVNException e) { tree.failed(e.getStatus()); } finally { monitor.done(); } return true; }
public boolean deleteProject(IResourceTree tree, IProject project, int updateFlags, IProgressMonitor monitor) { ISVNLocalFolder resource = new LocalFolder(project); try { // If contents are not being deleted, let Eclipse handle. if ((updateFlags & IResource.NEVER_DELETE_PROJECT_CONTENT) == IResource.NEVER_DELETE_PROJECT_CONTENT) { return false; } // If not managed, let Eclipse handle. if (!resource.isManaged()) return false; File projectDirectory = new File(project.getLocationURI()); // If meta directory does not exist, let Eclipse handle. File metaFolder = new File(projectDirectory, ".svn"); //$NON-NLS-1$ if (!metaFolder.exists()) { return false; } // If database file does not exist, let Eclipse handle. File databaseFile = new File(metaFolder, "wc.db"); //$NON-NLS-1$ if (!databaseFile.exists()) { return false; } // If we can delete database file, let Eclipse handle project deletion. if (databaseFile.delete()) { return false; } // Show message dialog in UI thread and cancel deletion. SVNProviderPlugin.handleMessage(Policy.bind("SVNMoveDeleteHook.4"), Policy.bind("SVNMoveDeleteHook.5") + project.getName() + Policy.bind("SVNMoveDeleteHook.6"), IMessageHandler.ERROR); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return true; } catch (Exception e) { // Let Eclipse try to handle it. return false; } }
@Override public boolean deleteFile( final IResourceTree tree, final IFile file, final int updateFlags, final IProgressMonitor progressMonitor) { log.trace("deleteFile: " + file.getFullPath()); //$NON-NLS-1$ progressMonitor.beginTask( MessageFormat.format(Messages.getString("TFSMoveDeleteHook.DeletingPathFormat"), file.getFullPath()), //$NON-NLS-1$ 30); try { /* Do the common pre-deletion resource inspection */ final ResourceInspectionResult inspectionResult = inspectResource( tree, file, true, true, DELETE_DENIED_CHANGE_TYPES, updateFlags, false, new SubProgressMonitor(progressMonitor, 5)); /* * Defer to the platform, returning false meaning we do not do any * work. */ if (inspectionResult.getStatus().equals(ResourceInspectionStatus.DEFER)) { return false; } if (repositoryProvider.getRepositoryStatus() == ProjectRepositoryStatus.CONNECTING) { throw new RuntimeException( Messages.getString("TFSMoveDeleteHook.ConnectionInProgressWaitBeforeDeleting")); //$NON-NLS-1$ } log.info(MessageFormat.format("Deletion detected for file {0}", file)); //$NON-NLS-1$ final TFSRepository repository = inspectionResult.getRepository(); final PendingChange[] pendingChanges = inspectionResult.getPendingChanges(); final IStatus deleteStatus = deleteFile(file, repository, pendingChanges, new SubProgressMonitor(progressMonitor, 10)); if (!deleteStatus.isOK()) { throw new RuntimeException(deleteStatus.getMessage()); } tree.standardDeleteFile(file, updateFlags, new SubProgressMonitor(progressMonitor, 5)); return true; } finally { progressMonitor.done(); } }
@Override public boolean moveProject( final IResourceTree tree, final IProject source, final IProjectDescription target, final int updateFlags, final IProgressMonitor progressMonitor) { log.trace(MessageFormat.format("moveProject: {0}", source.getFullPath())); //$NON-NLS-1$ progressMonitor.beginTask( MessageFormat.format(Messages.getString("TFSMoveDeleteHook.MovingProjectFormat"), source.getFullPath()), //$NON-NLS-1$ 10); log.info(MessageFormat.format("Rename detected from project {0} to {1}", source, target)); //$NON-NLS-1$ try { /* * Renaming the project only. Does not move folders, only sets the * new name in the .project file. */ if (target.getName() != source.getName()) { target.setLocation(source.getLocation()); tree.standardMoveProject(source, target, updateFlags, new SubProgressMonitor(progressMonitor, 10)); return true; } else { /* * User is attempting to relocate the project. This gets hairy * and would involve changing WF mappings in order to pend a * rename. */ tree.failed( new Status( IStatus.ERROR, TFSEclipseClientPlugin.PLUGIN_ID, 0, MessageFormat.format( Messages.getString("TFSMoveDeleteHook.MovingProjectNotSupportedInProductFormat"), //$NON-NLS-1$ ProductInformation.getCurrent().toString()), null)); return true; } } finally { progressMonitor.done(); } }
public boolean moveProject(IResourceTree tree, IProject source, IProjectDescription description, int updateFlags, IProgressMonitor monitor) { return false; }