/** Refresh the content of file. Ignores changes to the files provided, * instead returns its file object. * @param added do not notify addition of this file * @param removed do not notify removing of this file * @param fire true if we should fire changes * @param expected true if the change has been expected by the user * @param list contains list of children */ protected void refresh(String added, String removed, boolean fire, boolean expected, String[] list) { if (isFolder()) { refreshFolder(added, removed, fire, expected, list); } }
public void refresh(boolean expected) { if (!isInitialized() && isFolder()) { return; } refresh(null, null, true, expected); }
private void doLoop(int ms) { AbstractFileSystem system = this.system.get(); if (system == null) { // end for ever the fs does not exist no more return; } if ((en == null) || !en.hasMoreElements()) { // start again from root en = NbCollections.checkedEnumerationByFilter(existingFolders(system), AbstractFolder.class, true); } for (int i = 0; (i < REFRESH_COUNT) && en.hasMoreElements(); i++) { AbstractFolder fo = en.nextElement(); if ((fo != null) && (!fo.isFolder() || fo.isInitialized())) { fo.refresh(); } if (refreshTime <= 0) { // after each refresh check the current value of refreshTime // again and if it goes to zero exit as fast a you can return; } } // clear the queue if (!en.hasMoreElements()) { en = null; } }
/** refreshes children recursively.*/ private void refreshExistingFileObjects() { Cache cache = getCache(); String[] empty = new String[0]; Enumeration<? extends FileObject> en = existingFileObjects(getRoot()); while (en.hasMoreElements()) { AbstractFolder fo = (AbstractFolder) en.nextElement(); assert fo != null; if (fo.isFolder() && !fo.isInitialized()) { continue; } String[] children = cache.getChildrenOf(fo.getPath()); if (children == null) { children = empty; } fo.refresh(null, null, true, true, children); } }
final public void delete(FileLock lock) throws IOException { if (isFolder()) { FileObject[] fos = this.getChildren(); for (int i = 0; i < fos.length; i++) { FileObject fo = fos[i]; FileLock foLock = fo.lock(); try { fo.delete(foLock); } catch (IOException iex) { String message = NbBundle.getMessage(AbstractFolder.class, "EXC_CannotDelete", // XXX use FileUtil.getFileDisplayName instead? getPath(), fo.getFileSystem().getDisplayName() ); ExternalUtil.annotate(iex, message); //NOI18N throw iex; } finally { foLock.releaseLock(); } } } handleDelete(lock); }
/** refreshes children recursively.*/ private void refreshChildren(AbstractFolder fo, ResourceElem resElem) { if (fo.isRoot()) { initializeReference(rootRef = new FileObjRef<AbstractFolder>(fo), resElem); } java.util.List<String> nameList = resElem.getChildren(); String[] names = new String[nameList.size()]; ResourceElem[] children = new ResourceElem[names.length]; nameList.toArray(names); for (int i = 0; i < names.length; i++) children[i] = resElem.getChild(names[i]); fo.refresh(null, null, true, true, names); for (int i = 0; i < children.length; i++) { AbstractFolder fo2 = (AbstractFolder) fo.getFileObject(names[i]); FileObjRef currentRef = (FileObjRef) findReference(fo2.getPath()); int diff = initializeReference(currentRef, children[i]); fo2.lastModified(); if (fo2.isFolder()) { refreshChildren(fo2, children[i]); } else { if ((diff & 0x01) != 0) { fo2.fileChanged0(new FileEvent(fo2)); } else { if ((diff & 0x02) != 0) { fo2.fileAttributeChanged0(new FileAttributeEvent(fo2, null, null, null)); } } } } }
/** Refresh the content of file. Ignores changes to the files provided, * instead returns its file object. * @param added do not notify addition of this file * @param removed do not notify removing of this file * @param fire true if we should fire changes * @param expected true if the change has been expected by the user * @param list contains list of children */ protected void refresh ( String added, String removed, boolean fire, boolean expected, String[] list ) { if (isFolder ()) { refreshFolder (added, removed, fire, expected, list); } }
/** Refresh the content of file. Ignores changes to the files provided, * instead returns its file object. * @param added do not notify addition of this file * @param removed do not notify removing of this file * @param fire true if we should fire changes * @param expected true if the change has been expected by the user * @param list contains list of children */ protected void refresh ( String added, String removed, boolean fire, boolean expected, String[] list ) { if (isFolder ()) { refreshFolder (added, removed, fire, expected, list); } }
public void refresh(boolean expected) { if (!isInitialized () && isFolder ()) return; refresh (null, null, true, expected); }
public void refresh(boolean expected) { if (!isInitialized () && isFolder ()) return; refresh (null, null, true, expected); }
private void doLoop (int ms) { AbstractFileSystem system = (AbstractFileSystem)this.system.get (); if (system == null) { // end for ever the fs does not exist no more return; } if (en == null || !en.hasMoreElements ()) { // start again from root en = existingFolders (system); } for (int i = 0; i < REFRESH_COUNT && en.hasMoreElements (); i++) { AbstractFolder fo = (AbstractFolder)en.nextElement (); if (fo != null && (!fo.isFolder() || fo.isInitialized ())) { fo.refresh (); } if (refreshTime <= 0) { // after each refresh check the current value of refreshTime // again and if it goes to zero exit as fast a you can return; } } // clear the queue if (!en.hasMoreElements ()) { en = null; } }
private void doLoop (int ms) { AbstractFileSystem system = (AbstractFileSystem)this.system.get (); if (system == null) { // end for ever the fs does not exist no more return; } if (en == null || !en.hasMoreElements ()) { // start again from root en = existingFolders (system); } for (int i = 0; i < REFRESH_COUNT && en.hasMoreElements (); i++) { AbstractFolder fo = (AbstractFolder)en.nextElement (); if (fo != null && (!fo.isFolder() || fo.isInitialized ())) { fo.refresh (); } if (refreshTime <= 0) { // after each refresh check the current value of refreshTime // again and if it goes to zero exit as fast a you can return; } } // clear the queue if (!en.hasMoreElements ()) { en = null; } }
/** refreshes children recursively.*/ private void refreshExistingFileObjects () { Cache cache = getCache(); String[] empty = new String[0]; Enumeration en = existingFileObjects (getRoot ()); while (en.hasMoreElements()) { AbstractFolder fo = (AbstractFolder)en.nextElement(); assert fo != null; if (fo.isFolder() && !fo.isInitialized()) continue; String[] children = cache.getChildrenOf(fo.getPath()); if (children == null) children = empty; fo.refresh(null,null,true,true,children); } }
/** refreshes children recursively.*/ private void refreshExistingFileObjects () { Cache cache = getCache(); String[] empty = new String[0]; Enumeration en = existingFileObjects (getRoot ()); while (en.hasMoreElements()) { AbstractFolder fo = (AbstractFolder)en.nextElement(); assert fo != null; if (fo.isFolder() && !fo.isInitialized()) continue; String[] children = cache.getChildrenOf(fo.getPath()); if (children == null) children = empty; fo.refresh(null,null,true,true,children); } }
final public void delete(FileLock lock) throws IOException { if (isFolder ()) { FileObject[] fos = this.getChildren(); for (int i = 0; i < fos.length; i++) { FileObject fo = fos[i]; FileLock foLock = fo.lock(); try { fo.delete(foLock); } catch (IOException iex) { String message = NbBundle.getMessage(getClass(), "EXC_CannotDelete", //NOI18N // XXX use FileUtil.getFileDisplayName instead? getPath(), fo.getFileSystem().getDisplayName()); ExternalUtil.annotate(iex, message);//NOI18N throw iex; } finally { foLock.releaseLock(); } } } handleDelete (lock); }
final public void delete(FileLock lock) throws IOException { if (isFolder ()) { FileObject[] fos = this.getChildren(); for (int i = 0; i < fos.length; i++) { FileObject fo = fos[i]; FileLock foLock = fo.lock(); try { fo.delete(foLock); } catch (IOException iex) { String message = NbBundle.getMessage(getClass(), "EXC_CannotDelete", //NOI18N // XXX use FileUtil.getFileDisplayName instead? getPath(), fo.getFileSystem().getDisplayName()); ExternalUtil.annotate(iex, message);//NOI18N throw iex; } finally { foLock.releaseLock(); } } } handleDelete (lock); }
/** refreshes children recursively.*/ private void refreshChildren (AbstractFolder fo, ResourceElem resElem) { if (fo.isRoot()) initializeReference (rootRef = new FileObjRef (fo), resElem); java.util.List nameList = resElem.getChildren (); String[] names = new String[nameList.size ()]; ResourceElem[] children = new ResourceElem[names.length]; nameList.toArray(names); for (int i = 0; i < names.length; i++) children[i] = resElem.getChild (names[i]); fo.refresh(null, null, true, true, names); for (int i = 0; i < children.length; i++) { AbstractFolder fo2 = (AbstractFolder)fo.getFileObject (names[i]); FileObjRef currentRef = (FileObjRef )findReference (fo2.getPath ()); initializeReference (currentRef, children[i]); fo2.lastModified(); if (fo2.isFolder()) refreshChildren (fo2,children[i]); } }
/** refreshes children recursively.*/ private void refreshChildren (AbstractFolder fo, ResourceElem resElem) { if (fo.isRoot()) initializeReference (rootRef = new FileObjRef (fo), resElem); java.util.List nameList = resElem.getChildren (); String[] names = new String[nameList.size ()]; ResourceElem[] children = new ResourceElem[names.length]; nameList.toArray(names); for (int i = 0; i < names.length; i++) children[i] = resElem.getChild (names[i]); fo.refresh(null, null, true, true, names); for (int i = 0; i < children.length; i++) { AbstractFolder fo2 = (AbstractFolder)fo.getFileObject (names[i]); FileObjRef currentRef = (FileObjRef )findReference (fo2.getPath ()); initializeReference (currentRef, children[i]); fo2.lastModified(); if (fo2.isFolder()) refreshChildren (fo2,children[i]); } }