@Override public Object getAttribute(String attrName) { // Performance optimization (avoid calling getPath() too many times): final String path = getPath(); if (path.isEmpty() && attrName.indexOf('\\') >= 0) { return null; } return getAttribute(attrName, path); }
oldValue = getAttribute(attrName); if (oldValue == value) { return;
private Object getAttribute(FileObject fo, String attrName, String path) { Object o; FileObject previousFO = attrAskedFileObject.get(); if (previousFO == null || !sameFullName(previousFO, this)) { attrAskedFileObject.set(this); } try { if (fo instanceof MultiFileObject) { o = ((MultiFileObject) fo).getAttribute(attrName, path); } else if (fo instanceof AbstractFileObject) { o = ((AbstractFileObject) fo).getAttribute(attrName, path); } else { o = fo.getAttribute(attrName); } } finally { attrAskedFileObject.set(previousFO); } return o; }
if (!foFs.isReadOnly() || getMultiFileSystem().canHaveRootAttributeOnReadOnlyFS(prefixattr)) { localFo = foFs.getRoot(); oPerf = getAttribute(localFo, prefixattr, ""); // NOI18N oPerf = getAttribute(localFo, attrName, localFo.getPath()); Object o = getAttribute(fo, attrName, fo.getPath()); // Performance tricks: fo = systems[i].getRoot(); Object o = getAttribute(fo, prefixattr, ""); // NOI18N
!fe.getNewValue().equals(getAttribute(fe.getName())) ) { return;
private Object getAttribute (FileObject fo, String attrName, String path ) { Object o; FileObject topFO = (FileObject) attrAskedFileObject.get(); if (topFO == null) { attrAskedFileObject.set(this); } try { if (fo instanceof MultiFileObject) { o = ((MultiFileObject) fo).getAttribute (attrName, path); } else if (fo instanceof AbstractFileObject) { o = ((AbstractFileObject) fo).getAttribute (attrName, path); } else { o = fo.getAttribute (attrName); } } finally { if (topFO == null) { attrAskedFileObject.set(null); } } if (o != null) { lastAttrCacheFile = fo; lastAttrCacheName = attrName; } return o; }
private Object getAttribute (FileObject fo, String attrName, String path ) { Object o; FileObject topFO = (FileObject) attrAskedFileObject.get(); if (topFO == null) { attrAskedFileObject.set(this); } try { if (fo instanceof MultiFileObject) { o = ((MultiFileObject) fo).getAttribute (attrName, path); } else if (fo instanceof AbstractFileObject) { o = ((AbstractFileObject) fo).getAttribute (attrName, path); } else { o = fo.getAttribute (attrName); } } finally { if (topFO == null) { attrAskedFileObject.set(null); } } if (o != null) { lastAttrCacheFile = fo; lastAttrCacheName = attrName; } return o; }
if ( !(foFs instanceof XMLFileSystem)) { localFo = foFs.getRoot (); oPerf = getAttribute (localFo,prefixattr, ""); // NOI18N if (oPerf != null) return devoidify ( oPerf); oPerf = getAttribute (localFo,attrName, localFo.getPath()); if (oPerf != null) return devoidify ( oPerf); Object o = getAttribute (fo,attrName, fo.getPath());// Performance tricks: if (o != null) return devoidify (o); Object o = getAttribute (fo,prefixattr, ""); // NOI18N if (o != null) return devoidify (o);
if ( !(foFs instanceof XMLFileSystem)) { localFo = foFs.getRoot (); oPerf = getAttribute (localFo,prefixattr, ""); // NOI18N if (oPerf != null) return devoidify ( oPerf); oPerf = getAttribute (localFo,attrName, localFo.getPath()); if (oPerf != null) return devoidify ( oPerf); Object o = getAttribute (fo,attrName, fo.getPath());// Performance tricks: if (o != null) return devoidify (o); Object o = getAttribute (fo,prefixattr, ""); // NOI18N if (o != null) return devoidify (o);
/** Fired when a file attribute is changed. * @param fe the event describing context where action has taken place, * the name of attribute and the old and new values. */ public void fileAttributeChanged(FileAttributeEvent fe) { // [PENDING] this is not at all sufficient to notify every change in attributes. // One, parent dirs of front filesystems can now hold attributes for missing // files. Two, non-leader files can have attributes too which are merged in. // In principle all files/folders whose path is a prefix of this path on all // contained filesystems should be listened to for attribute change events. if (!hasAtLeastOneListeners () || leader == null) return; /** If change is not fired from leader then leader may mask this attribute * and then event should not be fired */ if (!fe.getFile().equals(leader) && fe.getName() != null && leader.getAttribute (fe.getName()) != null) return; /** If change is not fired from leader then another delegate may mask this attribute * and then event should not be fired. */ if (!fe.getFile().equals(leader) && fe.getNewValue() != null && fe.getName() != null && !fe.getNewValue().equals (getAttribute (fe.getName()))) return; fileAttributeChanged0 (new FileAttributeEvent ( this, fe.getName(), fe.getOldValue(), fe.getNewValue())); }
/** Fired when a file attribute is changed. * @param fe the event describing context where action has taken place, * the name of attribute and the old and new values. */ public void fileAttributeChanged(FileAttributeEvent fe) { // [PENDING] this is not at all sufficient to notify every change in attributes. // One, parent dirs of front filesystems can now hold attributes for missing // files. Two, non-leader files can have attributes too which are merged in. // In principle all files/folders whose path is a prefix of this path on all // contained filesystems should be listened to for attribute change events. if (!hasAtLeastOneListeners () || leader == null) return; /** If change is not fired from leader then leader may mask this attribute * and then event should not be fired */ if (!fe.getFile().equals(leader) && fe.getName() != null && leader.getAttribute (fe.getName()) != null) return; /** If change is not fired from leader then another delegate may mask this attribute * and then event should not be fired. */ if (!fe.getFile().equals(leader) && fe.getNewValue() != null && fe.getName() != null && !fe.getNewValue().equals (getAttribute (fe.getName()))) return; fileAttributeChanged0 (new FileAttributeEvent ( this, fe.getName(), fe.getOldValue(), fe.getNewValue())); }
oldValue = getAttribute (attrName);
oldValue = getAttribute (attrName);