protected void createFolder(String name) throws java.io.IOException { File f = getFile(name); if (name.equals("")) { // NOI18N throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotCreateF", f.getName(), getDisplayName(), f.getAbsolutePath())); } if (f.exists()) { throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_FolderAlreadyExist", f.getName(), getDisplayName(), f.getAbsolutePath())); } boolean b = createRecursiveFolder(f); if (!b) { throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotCreateF", f.getName(), getDisplayName(), f.getAbsolutePath())); } }
protected void createData(String name) throws IOException { File f = getFile(name); boolean isError = true; IOException creationException = null; String annotationMsg = null; try { isError = f.createNewFile() ? false : true; isError = isError ? true : (!f.exists()); if (isError) { annotationMsg = NbBundle.getMessage(LocalFileSystem.class, "EXC_DataAlreadyExist", f.getName(), getDisplayName(), f.getAbsolutePath()); creationException = new SyncFailedException(annotationMsg); } } catch (IOException iex) { isError = true; creationException = iex; annotationMsg = iex.getLocalizedMessage(); } if (isError) { LOG.log(Level.INFO, "Trying to create new file {0}.", f.getPath()); ExternalUtil.annotate(creationException, annotationMsg); throw creationException; } }
/** Set the root directory of the filesystem. * @param r file to set root to * @exception PropertyVetoException if the value if vetoed by someone else (usually * by the {@link org.openide.filesystems.Repository Repository}) * @exception IOException if the root does not exists or some other error occured */ public synchronized void setRootDirectory(File r) throws PropertyVetoException, IOException { if (!r.exists() || r.isFile()) { throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_RootNotExist", r.getAbsolutePath())); } String oldDisplayName = getDisplayName(); _setSystemName(computeSystemName(r)); rootFile = r; firePropertyChange(PROP_ROOT, null, refreshRoot()); firePropertyChange(PROP_DISPLAY_NAME, oldDisplayName, getDisplayName()); }
final String msg = NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotRename", oldName, getDisplayName(), newName, existsNF, rename); if (retry > 10) { throw new FSException(msg);
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())); } } } } }
protected void createFolder (String name) throws java.io.IOException { File f = getFile (name); if (name.equals ("")) { // NOI18N FSException.io ("EXC_CannotCreateF", new Object[] { f.getName (), getDisplayName (), f.getAbsolutePath ()}); // NOI18N } if (f.exists()) { FSException.io ("EXC_FolderAlreadyExist", new Object[] { f.getName (), getDisplayName (), f.getAbsolutePath ()}); // NOI18N } boolean b = createRecursiveFolder(f); if (!b) { FSException.io ("EXC_CannotCreateF", new Object[] { f.getName (), getDisplayName (), f.getAbsolutePath ()}); // NOI18N } }
protected void createFolder (String name) throws java.io.IOException { File f = getFile (name); if (name.equals ("")) { // NOI18N FSException.io ("EXC_CannotCreateF", new Object[] { f.getName (), getDisplayName (), f.getAbsolutePath ()}); // NOI18N } if (f.exists()) { FSException.io ("EXC_FolderAlreadyExist", new Object[] { f.getName (), getDisplayName (), f.getAbsolutePath ()}); // NOI18N } boolean b = createRecursiveFolder(f); if (!b) { FSException.io ("EXC_CannotCreateF", new Object[] { f.getName (), getDisplayName (), f.getAbsolutePath ()}); // NOI18N } }
protected void lock (String name) throws IOException { File file = getFile (name); if ((!file.canWrite () && file.exists ()) || isReadOnly()) { FSException.io ("EXC_CannotLock", name, getDisplayName (), file.getAbsolutePath ()); // NOI18N } }
protected void lock (String name) throws IOException { File file = getFile (name); if ((!file.canWrite () && file.exists ()) || isReadOnly()) { FSException.io ("EXC_CannotLock", name, getDisplayName (), file.getAbsolutePath ()); // NOI18N } }
protected void rename(String oldName, String newName) throws IOException { File of = getFile (oldName); File nf = getFile (newName); // #7086 - (nf.exists() && !nf.equals(of)) instead of nf.exists() - fix for Win32 if ((nf.exists() && !nf.equals(of)) || !of.renameTo (nf)) { FSException.io ("EXC_CannotRename", oldName, getDisplayName (), newName); // NOI18N } }
protected void rename(String oldName, String newName) throws IOException { File of = getFile (oldName); File nf = getFile (newName); // #7086 - (nf.exists() && !nf.equals(of)) instead of nf.exists() - fix for Win32 if ((nf.exists() && !nf.equals(of)) || !of.renameTo (nf)) { FSException.io ("EXC_CannotRename", oldName, getDisplayName (), newName); // NOI18N } }
protected void createData (String name) throws IOException { File f = getFile (name); boolean isError = true; IOException creationException = null; String annotationMsg = null; try { isError = f.createNewFile () ? false : true; isError = isError ? true : !f.exists(); if (isError) { Object[] msgParams; msgParams = new Object[] { f.getName(), getDisplayName(), f.getAbsolutePath()}; annotationMsg = NbBundle.getMessage(LocalFileSystem.class,"EXC_DataAlreadyExist", msgParams);//NOI18N creationException = new SyncFailedException(annotationMsg); } } catch (IOException iex) { isError = true; creationException = iex; annotationMsg = iex.getLocalizedMessage(); } if (isError) { ExternalUtil.annotate (creationException, annotationMsg); throw creationException; } }
protected void createData (String name) throws IOException { File f = getFile (name); boolean isError = true; IOException creationException = null; String annotationMsg = null; try { isError = f.createNewFile () ? false : true; isError = isError ? true : !f.exists(); if (isError) { Object[] msgParams; msgParams = new Object[] { f.getName(), getDisplayName(), f.getAbsolutePath()}; annotationMsg = NbBundle.getMessage(LocalFileSystem.class,"EXC_DataAlreadyExist", msgParams);//NOI18N creationException = new SyncFailedException(annotationMsg); } } catch (IOException iex) { isError = true; creationException = iex; annotationMsg = iex.getLocalizedMessage(); } if (isError) { ExternalUtil.annotate (creationException, annotationMsg); throw creationException; } }
/** Set the root directory of the filesystem. * @param r file to set root to * @exception PropertyVetoException if the value if vetoed by someone else (usually * by the {@link org.openide.filesystems.Repository Repository}) * @exception IOException if the root does not exists or some other error occured */ public synchronized void setRootDirectory (File r) throws PropertyVetoException, IOException { if (!r.exists() || r.isFile ()) { FSException.io ("EXC_RootNotExist", r.getAbsolutePath ()); // NOI18N } String oldDisplayName = getDisplayName (); setSystemName(computeSystemName (r)); rootFile = r; firePropertyChange(PROP_ROOT, null, refreshRoot ()); firePropertyChange (PROP_DISPLAY_NAME, oldDisplayName, getDisplayName ()); }
/** Set the root directory of the filesystem. * @param r file to set root to * @exception PropertyVetoException if the value if vetoed by someone else (usually * by the {@link org.openide.filesystems.Repository Repository}) * @exception IOException if the root does not exists or some other error occured */ public synchronized void setRootDirectory (File r) throws PropertyVetoException, IOException { if (!r.exists() || r.isFile ()) { FSException.io ("EXC_RootNotExist", r.getAbsolutePath ()); // NOI18N } String oldDisplayName = getDisplayName (); setSystemName(computeSystemName (r)); rootFile = r; firePropertyChange(PROP_ROOT, null, refreshRoot ()); firePropertyChange (PROP_DISPLAY_NAME, oldDisplayName, getDisplayName ()); }
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 } } } }