@Override public int hashCode() { final FileObject thisFo = this.get(); int hash = 3; hash = 37 * hash + (this.fcl != null ? this.fcl.hashCode() : 0); hash = 13 * hash + (thisFo != null ? thisFo.hashCode() : 0); return hash; } }
/** Removes listener previously added by {@link #addRecursiveListener(org.openide.filesystems.FileChangeListener)} * * @param fcl the listener to remove * @since 7.28 */ public void removeRecursiveListener(FileChangeListener fcl) { if (!isFolder()) { removeFileChangeListener(fcl); return; } try { getFileSystem().removeFileChangeListener(new RecursiveListener(this, fcl, false)); } catch (FileStateInvalidException ex) { ExternalUtil.LOG.log(Level.FINE, "Cannot remove listener from " + this, ex); } }
public RecursiveListener(FileObject source, FileChangeListener fcl, boolean keep) { super(source); this.fcl = fcl; this.kept = keep ? new HashSet<FileObject>() : null; addAll(source); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final RecursiveListener other = (RecursiveListener) obj; if (this.fcl != other.fcl && (this.fcl == null || !this.fcl.equals(other.fcl))) { return false; } final FileObject otherFo = other.get(); final FileObject thisFo = this.get(); if (thisFo != otherFo && (thisFo == null || !thisFo.equals(otherFo))) { return false; } return true; }
getFileSystem().addFileChangeListener(new RecursiveListener(this, fcl, allowsExternalChanges)); } catch (FileStateInvalidException ex) { ExternalUtil.LOG.log(Level.FINE, "Cannot remove listener from " + this, ex);
public void fileDeleted(FileEvent fe) { FileObject thisFo = this.get(); final FileObject file = fe.getFile(); if (thisFo != null && FileUtil.isParentOf(thisFo, file)) { fcl.fileDeleted(fe); if (kept != null) { kept.remove(file); } } }
public void fileDataCreated(FileEvent fe) { FileObject thisFo = this.get(); final FileObject file = fe.getFile(); if (thisFo != null && FileUtil.isParentOf(thisFo, file)) { fcl.fileDataCreated(fe); if (kept != null) { kept.add(file); } } }
public void fileChanged(FileEvent fe) { FileObject thisFo = this.get(); if (thisFo != null && FileUtil.isParentOf(thisFo, fe.getFile())) { fcl.fileChanged(fe); } }
public void fileRenamed(FileRenameEvent fe) { FileObject thisFo = this.get(); if (thisFo != null && FileUtil.isParentOf(thisFo, fe.getFile())) { fcl.fileRenamed(fe); } }
public void fileAttributeChanged(FileAttributeEvent fe) { FileObject thisFo = this.get(); if (thisFo != null && FileUtil.isParentOf(thisFo, fe.getFile())) { fcl.fileAttributeChanged(fe); } }