/** Update all existing subobjects. */ void updateAll() { FileSystem mfs = getMultiFileSystem(); try { mfs.beginAtomicAction(); // enumeration of all existing objects Enumeration<AbstractFolder> en = existingSubFiles(true); while (en.hasMoreElements()) { MultiFileObject mfo = (MultiFileObject) en.nextElement(); if (mfo.isFolder() && !mfo.isInitialized()) { continue; } mfo.freeAttribCache(); mfo.superRefresh(true); } } finally { mfs.finishAtomicAction(); } }
/** This method was added to achieve firing events that attributes * were changed after setDelegates. Events are not fired reliable but this solution was * choosed because of performance reasons. Attributes name is set to null - what means * that one of attributes was probably changed. */ void updateAllAfterSetDelegates(FileSystem[] oldFileSystems) { try { getMultiFileSystem().beginAtomicAction(); FileSystem[] fileSystems = getMultiFileSystem().getDelegates(); Enumeration<AbstractFolder> en = existingSubFiles(true); while (en.hasMoreElements()) { MultiFileObject mfo = (MultiFileObject) en.nextElement(); if (mfo.isFolder() && !mfo.isInitialized()) { continue; } if (mfo.hasListeners()) { String path = mfo.getPath(); FileObject oldLeader = findLeader(oldFileSystems, path); FileObject newLeader = findLeader(fileSystems, path); if ((oldLeader != null) && (newLeader != null) && !oldLeader.equals(newLeader)) { mfo.fileAttributeChanged0(new FileAttributeEvent(mfo, null, null, null)); } } mfo.freeAttribCache(); mfo.refresh(true); } } finally { getMultiFileSystem().finishAtomicAction(); } }