# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /space/work/all3/openide/masterfs # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: src/org/netbeans/modules/masterfs/filebasedfs/naming/FolderName.java *** /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/FolderName.java Base (1.4) --- /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/FolderName.java Locally Deleted *************** *** 1,68 **** - /* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - - package org.netbeans.modules.masterfs.filebasedfs.naming; - - - import java.io.File; - import java.util.Map; - import java.util.WeakHashMap; - - /** - * @author Radek Matous - */ - public class FolderName extends FileName { - private static Map fileCache = new WeakHashMap(); - - - FolderName(final FileNaming parent, final File file) { - super(parent, file); - synchronized (FolderName.class) { - FolderName.fileCache.put(this, file); - } - } - - - public File getFile() { - File retValue; - synchronized (FolderName.class) { - retValue = (File) FolderName.fileCache.get(this); - - if (retValue == null) { - retValue = super.getFile(); - FolderName.fileCache.put(this, retValue); - } - } - - assert retValue != null; - return retValue; - } - - static void freeCaches() { - synchronized (FolderName.class) { - FolderName.fileCache = new WeakHashMap(); - } - - } - - public boolean isFile() { - return false; - } - - } --- 1,0 ---- Index: test/unit/src/org/netbeans/modules/masterfs/FileChangeManagerTest.java *** /space/work/all3/openide/masterfs/test/unit/src/org/netbeans/modules/masterfs/FileChangeManagerTest.java No Base Revision --- /space/work/all3/openide/masterfs/test/unit/src/org/netbeans/modules/masterfs/FileChangeManagerTest.java Locally New *************** *** 1,0 **** --- 1,157 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + package org.netbeans.modules.masterfs; + + import java.io.File; + import java.io.OutputStream; + import java.net.URI; + import junit.framework.Test; + import org.netbeans.junit.NbTestCase; + import org.netbeans.junit.NbTestSuite; + import org.openide.filesystems.FileChangeManager; + import org.openide.filesystems.FileModificationEvent; + import org.openide.filesystems.FileModificationListener; + import org.openide.filesystems.FileObject; + import org.openide.filesystems.FileUtil; + import static org.openide.filesystems.FileModificationEvent.Type; + + /** + * @author Radek Matous + */ + public class FileChangeManagerTest extends NbTestCase { + File wDir; + File testfile; + URI watchedURI; + FileModificationListenerImpl fml; + + public FileChangeManagerTest(String testName) { + super(testName); + } + + public void testEventDelivery() throws Exception { + watchedURI = testfile.toURI(); + fml = new FileModificationListenerImpl(watchedURI); + assertFalse(fml.called); + FileChangeManager.addFileModificationListener(watchedURI, true, fml); + realTests(); + } + + public void testEventDeliveryToParent() throws Exception { + watchedURI = wDir.toURI(); + fml = new FileModificationListenerImpl(watchedURI); + assertFalse(fml.called); + FileChangeManager.addFileModificationListener(watchedURI, true, fml); + realTests(); + } + + + private void realTests() throws Exception { + FileObject fo = FileUtil.createData(testfile); + fml.asserts(null,Type.CREATED); + + + OutputStream os = fo.getOutputStream(); + os.write("hellotest".getBytes()); + os.close(); + fml.asserts(testfile.toURI(),Type.MODIFIED); + + + fo.delete(); + fml.asserts(testfile.toURI(),Type.DELETED); + + //external changes + assertTrue(testfile.createNewFile()); + fo.getFileSystem().refresh(true); + fml.asserts(testfile.toURI(),Type.CREATED); + + File tmp = testfile; + while(!tmp.getParentFile().equals(wDir)) { + tmp.delete(); + tmp = tmp.getParentFile(); + } + fo.getFileSystem().refresh(true); + fml.asserts(null,Type.DELETED); + } + + + + + public static Test suite() { + NbTestSuite suite = new NbTestSuite(); + suite.addTestSuite(FileChangeManagerTest.class); + + return new MasterFileSystemTest(suite); + } + + @Override + protected void setUp() throws Exception { + clearWorkDir(); + super.setUp(); + wDir = getWorkDir(); + testfile = new File(wDir,"a/b/c/d/e/f.txt"); + assertFalse(testfile.exists()); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + FileChangeManager.removeFileModificationListener(watchedURI,fml); + } + + + + private static class FileModificationListenerImpl implements FileModificationListener { + boolean called; + URI parent; + URI uri; + Type type; + + FileModificationListenerImpl(URI parent) { + this.parent = parent; + } + + public void fileChanged(FileModificationEvent event) { + called = true; + uri = event.getFileResource(); + type = event.getType(); + } + + void asserts(URI uri, Type type) { + try { + assertTrue(called); + if (uri != null) { + assertEquals(this.uri, uri); + } + assertEquals(this.type, type); + File p = new File(parent); + File tmp = new File(this.uri); + + + while(tmp != null && !p.equals(tmp)) { + tmp = tmp.getParentFile(); + } + assertEquals(p, tmp); + } finally { + called = false; + } + + } + } + } Index: src/org/netbeans/modules/masterfs/filebasedfs/naming/FileModificationEventSourceImpl.java *** /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/FileModificationEventSourceImpl.java No Base Revision --- /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/FileModificationEventSourceImpl.java Locally New *************** *** 1,0 **** --- 1,47 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + package org.netbeans.modules.masterfs.filebasedfs.naming; + + import java.io.File; + import java.net.URI; + import java.util.*; + import org.openide.filesystems.FileModificationListener; + import org.openide.filesystems.spi.FileChangeSource; + import org.openide.filesystems.spi.FileModificationEventSource; + + /** + * @author Radek Matous + */ + public final class FileModificationEventSourceImpl implements FileModificationEventSource, FileChangeSource { + public FileChangeSource forScheme(String scheme) { + if (!"file".equals(scheme)) {//NOI18N + return null; + } + return this; + } + + public void addListener(URI uri, boolean recursive, FileModificationListener listener) { + NamingFactory.fromFile(new File(uri)).addListener(uri, recursive, listener); + } + + public void removeListener(URI uri, FileModificationListener listener) { + NamingFactory.fromFile(new File(uri)).removeListener(uri, listener); + } + } Index: src/org/netbeans/modules/masterfs/filebasedfs/naming/FileModificationListenerList.java *** /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/FileModificationListenerList.java No Base Revision --- /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/FileModificationListenerList.java Locally New *************** *** 1,0 **** --- 1,74 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + package org.netbeans.modules.masterfs.filebasedfs.naming; + + import java.util.ArrayList; + import java.util.Collections; + import java.util.List; + + /** + * A class that holds a list of listeners of some type. + * Replacement of EventListListener, that solves performance issue #20715 + * @author rm111737 + */ + public class FileModificationListenerList { + private final List listenerList; + private List copy = null; + + FileModificationListenerList() { + listenerList = new ArrayList(); + } + + /** + * Adds the listener . + **/ + public synchronized boolean add(Object listener) { + if (listener == null) { + throw new NullPointerException(); + } + + copy = null; + + return listenerList.add(listener); + } + + /** + * Removes the listener . + **/ + public synchronized boolean remove(Object listener) { + copy = null; + + return listenerList.remove(listener); + } + + /** + * Passes back the event listener list + */ + public synchronized List getAllListeners() { + if (copy == null) { + copy = new ArrayList(listenerList); + } + return copy; + } + + public synchronized boolean hasListeners() { + return !listenerList.isEmpty(); + } + } Index: src/META-INF/services/org.openide.filesystems.spi.FileModificationEventSource *** /space/work/all3/openide/masterfs/src/META-INF/services/org.openide.filesystems.spi.FileModificationEventSource No Base Revision --- /space/work/all3/openide/masterfs/src/META-INF/services/org.openide.filesystems.spi.FileModificationEventSource Locally New *************** *** 1,0 **** --- 1,1 ---- + org.netbeans.modules.masterfs.filebasedfs.naming.FileModificationEventSourceImpl Index: src/org/netbeans/modules/masterfs/filebasedfs/children/ChildrenSupport.java *** /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/children/ChildrenSupport.java Base (1.15) --- /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/children/ChildrenSupport.java Locally Modified (Based On 1.15) *************** *** 19,35 **** package org.netbeans.modules.masterfs.filebasedfs.children; import org.netbeans.modules.masterfs.filebasedfs.naming.FileName; import org.netbeans.modules.masterfs.filebasedfs.naming.FileNaming; import org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory; import org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo; - import java.io.File; import java.util.*; import org.netbeans.modules.masterfs.providers.ProvidedExtensions; /** --- 19,34 ---- package org.netbeans.modules.masterfs.filebasedfs.children; + import java.net.URI; import org.netbeans.modules.masterfs.filebasedfs.naming.FileName; import org.netbeans.modules.masterfs.filebasedfs.naming.FileNaming; import org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory; import org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo; import java.io.File; import java.util.*; + import org.netbeans.modules.masterfs.filebasedfs.naming.FileModificationListenerList; import org.netbeans.modules.masterfs.providers.ProvidedExtensions; + import org.openide.filesystems.FileModificationListener; /** * @author Radek Matous *************** *** 267,273 **** --- 269,293 ---- public boolean isDirectory() { return !isFile(); } + + public FileModificationListenerList getListenerList() { + throw new UnsupportedOperationException("Not supported yet."); } + + public void setListenerList(FileModificationListenerList list) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void addListener(URI uri, boolean recursive, + FileModificationListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void removeListener(URI uri, + FileModificationListener listener) { + throw new UnsupportedOperationException("Not supported yet."); + } + } FakeNaming fake = new FakeNaming(); final Set cache = (lookupExisting) ? getExisting(false) : getNotExisting(false); Index: src/org/netbeans/modules/masterfs/filebasedfs/naming/FileName.java *** /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/FileName.java Base (1.11) --- /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/FileName.java Locally Modified (Based On 1.11) *************** *** 22,46 **** import java.io.File; import java.io.IOException; import org.netbeans.modules.masterfs.providers.ProvidedExtensions; import org.openide.util.Exceptions; /** * @author Radek Matous */ ! public class FileName implements FileNaming { private String name; private final FileNaming parent; private Integer id; protected FileName(final FileNaming parent, final File file) { this.parent = parent; this.name = parseName(file); id = NamingFactory.createID(file); } private static String parseName(final File file) { --- 22,57 ---- import java.io.File; import java.io.IOException; + import java.net.URI; + import java.util.HashSet; + import java.util.Map; + import java.util.Set; + import java.util.WeakHashMap; + import org.openide.filesystems.FileModificationListener; import org.netbeans.modules.masterfs.providers.ProvidedExtensions; + import org.openide.filesystems.spi.FileChangeSource; import org.openide.util.Exceptions; /** * @author Radek Matous */ ! public class FileName implements FileNaming, FileChangeSource { ! private static Map fileCache = new WeakHashMap(); ! private String name; private final FileNaming parent; private Integer id; + private FileModificationListenerList list; + private static final Set hardReferenced = new HashSet(); protected FileName(final FileNaming parent, final File file) { this.parent = parent; this.name = parseName(file); id = NamingFactory.createID(file); + synchronized (FileName.class) { + FileName.fileCache.put(this, file); } + } private static String parseName(final File file) { return (file.getParentFile() == null) ? file.getPath() : file.getName(); *************** *** 67,73 **** } } } - FolderName.freeCaches(); return retVal; } --- 81,86 ---- *************** *** 81,93 **** public File getFile() { final FileNaming parent = this.getParent(); ! return (parent != null) ? new File(parent.getFile(), getName()) : new File(getName()); } public final String getName() { --- 94,114 ---- public File getFile() { + File retValue; + synchronized (FileName.class) { + retValue = (File) FileName.fileCache.get(this); + + if (retValue == null) { final FileNaming parent = this.getParent(); ! retValue = (parent != null) ? new File(parent.getFile(), getName()) : new File(getName()); ! ! FileName.fileCache.put(this, retValue); } + } + assert retValue != null; + return retValue; + } public final String getName() { return name; *************** *** 119,132 **** } public boolean isFile() { ! return true; } public boolean isDirectory() { ! return !isFile(); } } --- 143,182 ---- } public boolean isFile() { ! return getFile().isFile(); } public boolean isDirectory() { ! return getFile().isDirectory(); } + + public FileModificationListenerList getListenerList() { + return list; } + + public void setListenerList(FileModificationListenerList list) { + this.list = list; + } + + public void addListener(URI uri, boolean recursive, FileModificationListener listener) { + if (list == null) { + list = new FileModificationListenerList(); + } + list.add(listener); + hardReferenced.add(this); + } + + public void removeListener(URI uri, FileModificationListener listener) { + if (list != null) { + list.remove(listener); + if (!list.hasListeners()) { + list = null; + hardReferenced.remove(this); + } + } + } + } Index: src/org/netbeans/modules/masterfs/filebasedfs/naming/FileNaming.java *** /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/FileNaming.java Base (1.7) --- /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/FileNaming.java Locally Modified (Based On 1.7) *************** *** 22,32 **** import java.io.File; import org.netbeans.modules.masterfs.providers.ProvidedExtensions; /** * @author Radek Matous */ ! public interface FileNaming { String getName(); FileNaming getParent(); --- 22,34 ---- import java.io.File; import org.netbeans.modules.masterfs.providers.ProvidedExtensions; + import org.openide.filesystems.FileModificationListener; + import org.openide.filesystems.spi.FileChangeSource; /** * @author Radek Matous */ ! public interface FileNaming extends FileChangeSource{ String getName(); FileNaming getParent(); *************** *** 45,49 **** boolean rename(String name); boolean rename(String name, ProvidedExtensions.IOHandler handler); ! } --- 47,52 ---- boolean rename(String name); boolean rename(String name, ProvidedExtensions.IOHandler handler); ! FileModificationListenerList getListenerList(); ! void setListenerList(FileModificationListenerList list); } Index: src/org/netbeans/modules/masterfs/MasterFileObject.java *** /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/MasterFileObject.java Base (1.60) --- /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/MasterFileObject.java Locally Modified (Based On 1.60) *************** *** 26,32 **** import org.openide.filesystems.*; import org.openide.util.Utilities; import org.netbeans.modules.masterfs.filebasedfs.fileobjects.ReplaceForSerialization; - import javax.swing.event.EventListenerList; import java.io.IOException; import java.io.InputStream; --- 26,31 ---- *************** *** 34,44 **** import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; import org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj; import org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo; import org.netbeans.modules.masterfs.providers.ProvidedExtensions; import org.openide.util.Exceptions; ! /** * Implements FileObject, hosts delegate and mostly uses it whenever possible. * --- 33,48 ---- import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; + import org.openide.filesystems.FileModificationEvent; + import org.openide.filesystems.FileModificationListener; import org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj; + import org.netbeans.modules.masterfs.filebasedfs.naming.FileModificationListenerList; + import org.netbeans.modules.masterfs.filebasedfs.naming.FileNaming; + import org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory; import org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo; import org.netbeans.modules.masterfs.providers.ProvidedExtensions; import org.openide.util.Exceptions; ! import static org.openide.filesystems.FileModificationEvent.Type; /** * Implements FileObject, hosts delegate and mostly uses it whenever possible. * *************** *** 860,875 **** --- 864,910 ---- } // end of Replace private final class FileChangeListenerImpl implements FileChangeListener { + void fireResourceChangeEvent(FileEvent fe2Fire, Type type) { + File f = ((MasterFileObject)fe2Fire.getFile()).getResource().getFile(); + FileNaming fnn = NamingFactory.fromFile(f); + FileNaming fno = fnn; + if (type.equals(Type.RENAMED)) { + FileRenameEvent feRen = (FileRenameEvent)fe2Fire; + fno = NamingFactory.fromFile(new File(fnn.getFile(),FileInfo.composeName(feRen.getName(), feRen.getExt()))); + } + fireResourceChangeEvent(type, fnn, fnn, fno); + } + + void fireResourceChangeEvent(Type type, FileNaming source, FileNaming fnn, FileNaming fno) { + FileModificationListenerList ls = source.getListenerList(); + if (ls != null && ls.hasListeners()) { + FileModificationEvent rsce; + rsce = new FileModificationEvent(this,type, fnn.getFile().toURI(), fno.getFile().toURI()); + + for (Iterator it = ls.getAllListeners().iterator(); it.hasNext();) { + FileModificationListener rscl = (FileModificationListener)it.next(); + rscl.fileChanged(rsce); + } + } + source = source.getParent(); + if (source != null) { + fireResourceChangeEvent(type, source, fnn, fno); + } + } + + /** * Implements FileChangeListener.fileDataCreated(FileEvent fe) */ public void fileDataCreated(FileEvent fe) { MasterFileObject eventFile = eventFileToMasterFileObject(fe); FileEvent fe2Fire = new FileEvent(MasterFileObject.this, eventFile, fe.isExpected()); + FileObject eventFileDelegate = eventFile.getDelegate().get(); FileObject meDelegate = MasterFileObject.this.getDelegate().get(); if (eventFileDelegate == fe.getFile() && meDelegate == fe.getSource()) { + fireResourceChangeEvent(fe2Fire, Type.CREATED); fireFileDataCreatedEvent(getEnumOfListeners(), fe2Fire); } } *************** *** 884,889 **** --- 919,925 ---- FileObject meDelegate = MasterFileObject.this.getDelegate().get(); if (eventFileDelegate == fe.getFile() && meDelegate == fe.getSource()) { + fireResourceChangeEvent(fe2Fire, Type.CREATED); fireFileFolderCreatedEvent(getEnumOfListeners(), fe2Fire); } } *************** *** 897,902 **** --- 933,939 ---- FileObject eventFileDelegate = eventFile.getDelegate().get(); FileObject meDelegate = MasterFileObject.this.getDelegate().get(); if (eventFileDelegate == fe.getFile() && meDelegate == fe.getSource()) { + fireResourceChangeEvent(fe2Fire, Type.DELETED); fireFileDeletedEvent(getEnumOfListeners(), fe2Fire); } } *************** *** 911,916 **** --- 948,954 ---- FileObject meDelegate = MasterFileObject.this.getDelegate().get(); if (eventFileDelegate == fe.getFile() && meDelegate == fe.getSource()) { + fireResourceChangeEvent(fe2Fire, Type.MODIFIED); fireFileChangedEvent(getEnumOfListeners(), fe2Fire); } } *************** *** 928,933 **** --- 966,972 ---- FileObject meDelegate = MasterFileObject.this.getDelegate().get(); if (eventFileDelegate == fe.getFile() && meDelegate == fe.getSource()) { + fireResourceChangeEvent(fe2Fire, Type.RENAMED); fireFileRenamedEvent(getEnumOfListeners(), fe2Fire); } } Index: src/org/netbeans/modules/masterfs/filebasedfs/naming/NamingFactory.java *** /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/NamingFactory.java Base (1.12) --- /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/NamingFactory.java Locally Modified (Based On 1.12) *************** *** 20,34 **** package org.netbeans.modules.masterfs.filebasedfs.naming; import org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo; - import java.io.File; import java.lang.ref.Reference; import java.lang.ref.WeakReference; import java.util.*; import org.netbeans.modules.masterfs.providers.ProvidedExtensions; /** --- 20,31 ---- package org.netbeans.modules.masterfs.filebasedfs.naming; import org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo; import java.io.File; import java.lang.ref.Reference; import java.lang.ref.WeakReference; import java.util.*; import org.netbeans.modules.masterfs.providers.ProvidedExtensions; + import org.openide.filesystems.FileModificationListener; /** * @author Radek Matous *************** *** 73,82 **** public static synchronized FileNaming[] rename (FileNaming fNaming, String newName, ProvidedExtensions.IOHandler handler) { final ArrayList all = new ArrayList(); boolean retVal = false; remove(fNaming, null); retVal = fNaming.rename(newName, handler); all.add(fNaming); ! NamingFactory.registerInstanceOfFileNaming(fNaming.getParent(), fNaming.getFile(), fNaming); renameChildren(all); return (retVal) ? ((FileNaming[])all.toArray(new FileNaming[all.size()])) : null; } --- 73,84 ---- public static synchronized FileNaming[] rename (FileNaming fNaming, String newName, ProvidedExtensions.IOHandler handler) { final ArrayList all = new ArrayList(); boolean retVal = false; + FileModificationListenerList ls = fNaming.getListenerList(); remove(fNaming, null); retVal = fNaming.rename(newName, handler); all.add(fNaming); ! FileNaming fnn = NamingFactory.registerInstanceOfFileNaming(fNaming.getParent(), fNaming.getFile(), fNaming); ! fnn.setListenerList(ls); renameChildren(all); return (retVal) ? ((FileNaming[])all.toArray(new FileNaming[all.size()])) : null; } *************** *** 104,112 **** Integer id = (Integer)entry.getKey(); FileNaming fN = (FileNaming)entry.getValue(); all.add(fN); remove(fN, id); fN.getId(true); ! NamingFactory.registerInstanceOfFileNaming(fN.getParent(), fN.getFile(), fN); } } --- 106,116 ---- Integer id = (Integer)entry.getKey(); FileNaming fN = (FileNaming)entry.getValue(); all.add(fN); + FileModificationListenerList ls = fN.getListenerList(); remove(fN, id); fN.getId(true); ! FileNaming fnn = NamingFactory.registerInstanceOfFileNaming(fN.getParent(), fN.getFile(), fN); ! fnn.setListenerList(ls); } } *************** *** 188,194 **** retVal = new FileName(parentName, f); } else { if (f.isDirectory()) { ! retVal = new FolderName(parentName, f); } else { if (fInfo.isUNCFolder()) { retVal = new UNCName(parentName, f); --- 192,198 ---- retVal = new FileName(parentName, f); } else { if (f.isDirectory()) { ! retVal = new FileName(parentName, f); } else { if (fInfo.isUNCFolder()) { retVal = new UNCName(parentName, f); *************** *** 198,204 **** if (retVal == null /*&& new FileInfo(f).isUnixSpecialFile()*/) { // broken symlinks and other for me unknown files (sockets or whatever it is) ! retVal = new FileName(parentName, f) { public boolean isDirectory() { return false; } --- 202,209 ---- if (retVal == null /*&& new FileInfo(f).isUnixSpecialFile()*/) { // broken symlinks and other for me unknown files (sockets or whatever it is) ! retVal = new FileName(parentName, f); ! /*retVal = new FileName(parentName, f) { public boolean isDirectory() { return false; } *************** *** 206,212 **** public boolean isFile() { return false; } ! }; } --- 211,217 ---- public boolean isFile() { return false; } ! };*/ } Index: src/org/netbeans/modules/masterfs/filebasedfs/naming/UNCName.java *** /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/UNCName.java Base (1.3) --- /space/work/all3/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/naming/UNCName.java Locally Modified (Based On 1.3) *************** *** 27,33 **** /** * @author Radek Matous */ ! public final class UNCName extends FolderName { UNCName(final FileNaming parent, final File f) { super(parent, f); } --- 27,33 ---- /** * @author Radek Matous */ ! public final class UNCName extends FileName { UNCName(final FileNaming parent, final File f) { super(parent, f); }