protected void delete(String name) throws IOException { File file = getFile(name); if (deleteFile(file) != SUCCESS) { if (file.exists()) { throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotDelete", name, getDisplayName(), file.getAbsolutePath())); } else { /** When file externaly deleted and fo.delete () is called before periodical refresh */ FileObject thisFo = findResource(name); if (thisFo != null) { if (thisFo.getParent() != null) { thisFo.getParent().refresh(); } thisFo.refresh(); if (thisFo.isValid()) { throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotDelete", name, getDisplayName(), file.getAbsolutePath())); } } } } }
private static FileObject getFileObjectFromFile(File file) { File parent = file.getParentFile(); LocalFileSystem lfs = new LocalFileSystem(); try { lfs.setRootDirectory(parent); } catch(java.beans.PropertyVetoException pve) { // ?? ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, pve); return null; } catch(java.io.IOException ioe) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ioe); return null; } return lfs.findResource(file.getName()); }
protected void delete(String name) throws IOException { File file = getFile(name); if (deleteFile(file) != SUCCESS) { if (file.exists()) FSException.io("EXC_CannotDelete", name, getDisplayName(), file.getAbsolutePath()); // NOI18N else { /** When file externaly deleted and fo.delete () is called before periodical refresh */ FileObject thisFo = findResource(name); if (thisFo != null) { if (thisFo.getParent() != null) thisFo.getParent().refresh(); thisFo.refresh(); if (thisFo.isValid()) FSException.io("EXC_CannotDelete", name, getDisplayName(), file.getAbsolutePath()); // NOI18N } } } }
protected void delete(String name) throws IOException { File file = getFile(name); if (deleteFile(file) != SUCCESS) { if (file.exists()) FSException.io("EXC_CannotDelete", name, getDisplayName(), file.getAbsolutePath()); // NOI18N else { /** When file externaly deleted and fo.delete () is called before periodical refresh */ FileObject thisFo = findResource(name); if (thisFo != null) { if (thisFo.getParent() != null) thisFo.getParent().refresh(); thisFo.refresh(); if (thisFo.isValid()) FSException.io("EXC_CannotDelete", name, getDisplayName(), file.getAbsolutePath()); // NOI18N } } } }