/** Fires event */ protected final void fileAttributeChanged0(FileAttributeEvent fileattributeevent) { super.fireFileAttributeChangedEvent(listeners(), fileattributeevent); if (fileattributeevent.getFile().equals(this) && (parent != null)) { FileAttributeEvent ev = new FileAttributeEvent( parent, fileattributeevent.getFile(), fileattributeevent.getName(), fileattributeevent.getOldValue(), fileattributeevent.getNewValue(), fileattributeevent.isExpected() ); try { ev.inheritPostNotify(fileattributeevent); parent.fileAttributeChanged0(ev); } finally { ev.setPostNotify(null); } } }
/** Fires event */ protected final void fileAttributeChanged0 (FileAttributeEvent fileattributeevent) { super.fireFileAttributeChangedEvent(listeners (), fileattributeevent); if(fileattributeevent.getFile().equals(this) && parent != null) { FileAttributeEvent ev = new FileAttributeEvent( parent, fileattributeevent.getFile(), fileattributeevent.getName(), fileattributeevent.getOldValue(), fileattributeevent.getNewValue(), fileattributeevent.isExpected () ); parent.fileAttributeChanged0 (ev); } }
@Override public void fileAttributeChanged(FileAttributeEvent fe) { if ("displayName".equals(fe.getName())) { reloadGlobalTemplatesCombo(); } }
void setAttribute(String attrName, Object value, boolean fire) throws IOException { Object oldValue = null; //FileSystem fs = getAbstractFileSystem (); //if (fs.isReadOnly()) XMLFileSystemTestHid.java:934 // throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_FSisRO", fs.getDisplayName ()); // NOI18N if (fire) { oldValue = getAttribute(attrName); } getAbstractFileSystem().attr.writeAttribute(getPath(), attrName, value); if (fire && (oldValue != value) && hasAtLeastOneListeners()) { fileAttributeChanged0(new FileAttributeEvent(this, attrName, oldValue, value)); } }
public void fileAttributeChanged(FileAttributeEvent fe) { FileObject thisFo = this.get(); if (thisFo != null && FileUtil.isParentOf(thisFo, fe.getFile())) { fcl.fileAttributeChanged(fe); } }
/** Fires event */ protected final void fileAttributeChanged0 (FileAttributeEvent fileattributeevent) { super.fireFileAttributeChangedEvent(listeners (), fileattributeevent); if(fileattributeevent.getFile().equals(this) && parent != null) { FileAttributeEvent ev = new FileAttributeEvent( parent, fileattributeevent.getFile(), fileattributeevent.getName(), fileattributeevent.getOldValue(), fileattributeevent.getNewValue(), fileattributeevent.isExpected () ); parent.fileAttributeChanged0 (ev); } }
public void fileAttributeChanged(FileAttributeEvent fe) { if ("DataEditorSupport.read-only.refresh".equals(fe.getName())) { // NOI18N return; } someFileChange(); } public void fileRenamed(FileRenameEvent fe) {
/** 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(); } }
public void fileAttributeChanged(FileAttributeEvent fe) { changeResourcePath(fe.getFile()); reload(); }
/** 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())); }
if (!fe.getFile().equals(leader) && (fe.getName() != null) && (leader.getAttribute(fe.getName()) != null)) { return; !fe.getFile().equals(leader) && (fe.getNewValue() != null) && (fe.getName() != null) && !fe.getNewValue().equals(getAttribute(fe.getName())) ) { return; final FileAttributeEvent ev = new FileAttributeEvent(this, fe.getName(), fe.getOldValue(), fe.getNewValue()); try { ev.inheritPostNotify(fe); fileAttributeChanged0(ev); } finally { ev.setPostNotify(null);
/** Fired when a file attribute has been changed. * * @param fe the event describing context where action has taken place */ public void fileAttributeChanged(FileAttributeEvent fe) { final boolean LOG = err.isLoggable(ErrorManager.INFORMATIONAL); if (LOG) err.log("fileAttributeChanged: " + fe); // update list when attrs defining order were changed if (fe.getFile() == folder) { /** Means one of attributes were changed*/ if (fe.getName() == null) { changeComparator(); return; } if (DataFolder.EA_ORDER.equals(fe.getName()) || DataFolder.EA_SORT_MODE.equals(fe.getName()) || -1 != fe.getName().indexOf("/")) { changeComparator(); } } }
/** 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)); } } } } }
/** 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())); }
void notifyAttributeChanged(FileAttributeEvent fae) { if (! EA_ASSIGNED_LOADER.equals(fae.getName())) { // We are interested only in assigned loader return; } FileObject f = fae.getFile(); if (f != null) { String attrFromFO = (String)f.getAttribute(EA_ASSIGNED_LOADER); if (attrFromFO == null || (! attrFromFO.equals(getLoader().getClass().getName()))) { java.util.HashSet single = new java.util.HashSet(); single.add(f); if (!DataObjectPool.getPOOL().revalidate(single).isEmpty()) { ErrorManager.getDefault().log(ErrorManager.INFORMATIONAL, "It was not possible to invalidate data object: " + this); // NOI18N } else { // we need to refresh parent folder if it is there // this should be covered by DataLoaderPoolTest.testChangeIsAlsoReflectedInNodes FolderList.changedDataSystem (f.getParent()); } } } } }
fileAttributeChanged0(new FileAttributeEvent(this, attrName, oldValue, value));
void setAttribute (String attrName, Object value, boolean fire) throws IOException { Object oldValue = null; //FileSystem fs = getAbstractFileSystem (); //if (fs.isReadOnly()) // FSException.io("EXC_FSisRO", fs.getDisplayName ()); // NOI18N if (fire) oldValue = getAttribute (attrName); getAbstractFileSystem ().attr.writeAttribute (getPath (), attrName, value); if (fire && oldValue != value && hasAtLeastOneListeners () ) fileAttributeChanged0 (new FileAttributeEvent (this,attrName,oldValue,value)); }
void setAttribute (String attrName, Object value, boolean fire) throws IOException { Object oldValue = null; //FileSystem fs = getAbstractFileSystem (); //if (fs.isReadOnly()) // FSException.io("EXC_FSisRO", fs.getDisplayName ()); // NOI18N if (fire) oldValue = getAttribute (attrName); getAbstractFileSystem ().attr.writeAttribute (getPath (), attrName, value); if (fire && oldValue != value && hasAtLeastOneListeners () ) fileAttributeChanged0 (new FileAttributeEvent (this,attrName,oldValue,value)); }