Source:
<code>public boolean deleteFile(final IResourceTree tree, final IFile file, final int updateFlags, final IProgressMonitor monitor) { if (file.isLinked()) return false; final boolean force = (updateFlags & IResource.FORCE) == IResource.FORCE; if (!force && !tree.isSynchronized(file, IResource.DEPTH_ZERO)) return false; final RepositoryMapping map = RepositoryMapping.getMapping(file); if (map == null) return false; String repoRelativePath = map.getRepoRelativePath(file); IndexDiffCache indexDiffCache = Activator.getDefault() .getIndexDiffCache(); IndexDiffCacheEntry indexDiffCacheEntry = indexDiffCache .getIndexDiffCacheEntry(map.getRepository()); IndexDiffData indexDiff = indexDiffCacheEntry.getIndexDiff(); if (indexDiff != null) { if (indexDiff.getUntracked().contains(repoRelativePath)) return false; if (indexDiff.getIgnoredNotInIndex().contains(repoRelativePath)) return false; } if (!file.exists()) return false; if (file.isDerived()) return false; DirCache dirc = null; try { dirc = map.getRepository().lockDirCache(); final int first = dirc.findEntry(repoRelativePath); if (first < 0) { dirc.unlock(); return false; } final DirCacheBuilder edit = dirc.builder(); if (first > 0) edit.keep(0, first); final int next = dirc.nextEntry(first); if (next < dirc.getEntryCount()) edit.keep(next, dirc.getEntryCount() - next); if (!edit.commit()) tree.failed(new Status(IStatus.ERROR, Activator.getPluginId(), 0, CoreText.MoveDeleteHook_operationError, null)); tree.standardDeleteFile(file, updateFlags, monitor); } catch <START> (LockFailedException e) <END> { return false; } catch (IOException e) { tree.failed(new Status(IStatus.ERROR, Activator.getPluginId(), 0, CoreText.MoveDeleteHook_operationError, e)); } finally { if (dirc != null) dirc.unlock(); } return true; }</code><technical_language>log this. else user figure out problem is? benign, LockFailedException means is a stale lock</technical_language>

Target:
public boolean deleteFile(final IResourceTree tree, final IFile file, final int updateFlags, final IProgressMonitor monitor) { if (file.isLinked()) return false; final boolean force = (updateFlags & IResource.FORCE) == IResource.FORCE; if (!force && !tree.isSynchronized(file, IResource.DEPTH_ZERO)) return false; final RepositoryMapping map = RepositoryMapping.getMapping(file); if (map == null) return false; String repoRelativePath = map.getRepoRelativePath(file); IndexDiffCache indexDiffCache = Activator.getDefault() .getIndexDiffCache(); IndexDiffCacheEntry indexDiffCacheEntry = indexDiffCache .getIndexDiffCacheEntry(map.getRepository()); IndexDiffData indexDiff = indexDiffCacheEntry.getIndexDiff(); if (indexDiff != null) { if (indexDiff.getUntracked().contains(repoRelativePath)) return false; if (indexDiff.getIgnoredNotInIndex().contains(repoRelativePath)) return false; } if (!file.exists()) return false; if (file.isDerived()) return false; DirCache dirc = null; try { dirc = map.getRepository().lockDirCache(); final int first = dirc.findEntry(repoRelativePath); if (first < 0) { dirc.unlock(); return false; } final DirCacheBuilder edit = dirc.builder(); if (first > 0) edit.keep(0, first); final int next = dirc.nextEntry(first); if (next < dirc.getEntryCount()) edit.keep(next, dirc.getEntryCount() - next); if (!edit.commit()) tree.failed(new Status(IStatus.ERROR, Activator.getPluginId(), 0, CoreText.MoveDeleteHook_operationError, null)); tree.standardDeleteFile(file, updateFlags, monitor); } catch (LockFailedException e) { Activator .getDefault() .getLog() .log(new Status(IStatus.WARNING, Activator.getPluginId(), CoreText.MoveDeleteHook_cannotAutoStageDeletion)); return FINISH_FOR_ME; } catch (IOException e) { tree.failed(new Status(IStatus.ERROR, Activator.getPluginId(), 0, CoreText.MoveDeleteHook_operationError, e)); } finally { if (dirc != null) dirc.unlock(); } return true; }