This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 127121
Collapse All | Expand All

(-)a/api.java/src/org/netbeans/api/java/classpath/ClassPath.java (-53 / +6 lines)
Lines 929-946 public final class ClassPath { Link Here
929
        }
929
        }
930
930
931
        public void addRoot (URL url) {
931
        public void addRoot (URL url) {
932
            if (!isInitialized()) {                
932
            if (!isInitialized()) {             
933
                FileSystem[] fss = getFileSystems ();
933
                FileUtil.getFileBasedFileSystems().addFileChangeListener(this);
934
                if (fss != null && fss.length > 0) {
934
                setInitialized(true);                    
935
                    for (FileSystem fs : fss) {
936
                        if (fs != null) {
937
                            fs.addFileChangeListener (this);
938
                        }                                        
939
                    }
940
                    setInitialized(true);                    
941
                } else {                                                
942
                    LOG.warning("Cannot find file system, not able to listen on changes.");
943
                }
944
            }
935
            }
945
            if ("jar".equals(url.getProtocol())) { //NOI18N
936
            if ("jar".equals(url.getProtocol())) { //NOI18N
946
                url = FileUtil.getArchiveFile(url);
937
                url = FileUtil.getArchiveFile(url);
Lines 965-976 public final class ClassPath { Link Here
965
956
966
        public void removeAllRoots () {
957
        public void removeAllRoots () {
967
            this.roots.clear();
958
            this.roots.clear();
968
            FileSystem[] fss = getFileSystems ();
959
            FileUtil.getFileBasedFileSystems().removeFileChangeListener(this);
969
            for (FileSystem fs : fss) {
970
                if (fs != null) {
971
                    fs.removeFileChangeListener (this);
972
                }                
973
            }            
974
            initialized = false; //Already synchronized
960
            initialized = false; //Already synchronized
975
        }
961
        }
976
962
Lines 1013-1023 public final class ClassPath { Link Here
1013
999
1014
        public void run() {
1000
        public void run() {
1015
            if (isInitialized()) {
1001
            if (isInitialized()) {
1016
                for (FileSystem fs : getFileSystems()) {
1002
                FileUtil.getFileBasedFileSystems().removeFileChangeListener(this);
1017
                    if (fs != null) {
1018
                        fs.removeFileChangeListener (this);
1019
                    }                    
1020
                }                
1021
            }
1003
            }
1022
        }
1004
        }
1023
1005
Lines 1078-1113 public final class ClassPath { Link Here
1078
        //http:/java.netbeans.org/source/browse/java/javacore/src/org/netbeans/modules/javacore/Util.java    
1060
        //http:/java.netbeans.org/source/browse/java/javacore/src/org/netbeans/modules/javacore/Util.java    
1079
        //http://core.netbeans.org/source/browse/core/ui/src/org/netbeans/core/ui/MenuWarmUpTask.java
1061
        //http://core.netbeans.org/source/browse/core/ui/src/org/netbeans/core/ui/MenuWarmUpTask.java
1080
        //http://core.netbeans.org/source/browse/core/src/org/netbeans/core/actions/RefreshAllFilesystemsAction.java
1062
        //http://core.netbeans.org/source/browse/core/src/org/netbeans/core/actions/RefreshAllFilesystemsAction.java
1081
        //http://java.netbeans.org/source/browse/java/api/src/org/netbeans/api/java/classpath/ClassPath.java
1063
        //http://java.netbeans.org/source/browse/java/api/src/org/netbeans/api/java/classpath/ClassPath.java                
1082
        
1083
        private static FileSystem[] fileSystems;
1084
        
1085
        private static FileSystem[] getFileSystems() {
1086
            if (fileSystems != null) {
1087
                return fileSystems;
1088
            }
1089
            File[] roots = File.listRoots();
1090
            Set<FileSystem> allRoots = new LinkedHashSet<FileSystem>();
1091
            assert roots != null && roots.length > 0 : "Could not list file roots"; // NOI18N
1092
            
1093
            for (File root : roots) {
1094
                FileObject random = FileUtil.toFileObject(root);
1095
                if (random == null) continue;
1096
                
1097
                FileSystem fs;
1098
                try {
1099
                    fs = random.getFileSystem();
1100
                    allRoots.add(fs);                    
1101
                } catch (FileStateInvalidException e) {
1102
                    throw new AssertionError(e);
1103
                }
1104
            }
1105
            FileSystem[] retVal = new FileSystem [allRoots.size()];
1106
            allRoots.toArray(retVal);
1107
            assert retVal.length > 0 : "Could not get any filesystem"; // NOI18N
1108
            
1109
            return fileSystems = retVal;
1110
        }
1111
    }
1064
    }
1112
1065
1113
}
1066
}
(-)a/java.source/src/org/netbeans/modules/java/source/usages/RepositoryUpdater.java (-32 / +2 lines)
Lines 593-633 public class RepositoryUpdater implement Link Here
593
    
593
    
594
    
594
    
595
    private void registerFileSystemListener  () {
595
    private void registerFileSystemListener  () {
596
        final File[] roots = File.listRoots();
596
        FileUtil.getFileBasedFileSystems().addFileChangeListener(this);
597
        final Set<FileSystem> fss = new HashSet<FileSystem> ();
598
        for (File root : roots) {
599
            final FileObject fo = FileUtil.toFileObject (root);
600
            if (fo != null) {                
601
                try {
602
                    final FileSystem fs = fo.getFileSystem();
603
                    if (!fss.contains(fs)) {
604
                        fs.addFileChangeListener (this);
605
                        fss.add(fs);
606
                    }
607
                } catch (FileStateInvalidException e) {
608
                    Exceptions.printStackTrace(e);
609
                }
610
            }
611
        }
612
    }
597
    }
613
    
598
    
614
    private void unregisterFileSystemListener () {
599
    private void unregisterFileSystemListener () {
615
        final File[] roots = File.listRoots();
600
        FileUtil.getFileBasedFileSystems().removeFileChangeListener(this);
616
        final Set<FileSystem> fss = new HashSet<FileSystem> ();
617
        for (File root : roots) {
618
            final FileObject fo = FileUtil.toFileObject (root);
619
            if (fo != null) {                
620
                try {
621
                    final FileSystem fs = fo.getFileSystem();
622
                    if (!fss.contains(fs)) {
623
                        fs.removeFileChangeListener (this);
624
                        fss.add(fs);
625
                    }
626
                } catch (FileStateInvalidException e) {
627
                    Exceptions.printStackTrace(e);
628
                }
629
            }
630
        }
631
    }
601
    }
632
    
602
    
633
    private URL getOwningSourceRoot (final FileObject fo) {
603
    private URL getOwningSourceRoot (final FileObject fo) {
(-)a/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/FileBasedFileSystem.java (-17 / +44 lines)
Lines 60-82 import org.netbeans.modules.masterfs.fil Link Here
60
import org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo;
60
import org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo;
61
import org.netbeans.modules.masterfs.providers.AnnotationProvider;
61
import org.netbeans.modules.masterfs.providers.AnnotationProvider;
62
import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
62
import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
63
import org.openide.filesystems.FileChangeListener;
63
import org.openide.filesystems.FileObject;
64
import org.openide.filesystems.FileObject;
64
import org.openide.filesystems.FileSystem;
65
import org.openide.filesystems.FileSystem;
66
import org.openide.filesystems.FileBasedFileSystemsSPI;
65
import org.openide.filesystems.FileUtil;
67
import org.openide.filesystems.FileUtil;
66
import org.openide.util.Exceptions;
68
import org.openide.util.Exceptions;
69
import org.openide.util.Lookup;
67
import org.openide.util.actions.SystemAction;
70
import org.openide.util.actions.SystemAction;
68
71
69
/**
72
/**
70
 * @author Radek Matous
73
 * @author Radek Matous
71
 */
74
 */
72
public final class FileBasedFileSystem extends FileSystem {
75
public final class FileBasedFileSystem extends FileSystem {
73
    private static Map allInstances = new HashMap();
76
    private static Map<File, FileBasedFileSystem> fileToFileSystems = new HashMap<File, FileBasedFileSystem>();
74
77
75
    private transient final FileObjectFactory factory;
78
    private transient final FileObjectFactory factory;
76
    transient private final StatusImpl status = new StatusImpl();
79
    transient private final StatusImpl status = new StatusImpl();
77
    public static boolean WARNINGS = true;
80
    public static boolean WARNINGS = true;
78
    private ThreadLocal<Boolean> refreshIsOn = new ThreadLocal<Boolean>();
81
    private ThreadLocal<Boolean> refreshIsOn = new ThreadLocal<Boolean>();
79
82
    private static Repository repo;
83
    
80
    public boolean isWarningEnabled() {
84
    public boolean isWarningEnabled() {
81
        Boolean isRefreshOn = refreshIsOn.get();
85
        Boolean isRefreshOn = refreshIsOn.get();
82
        return WARNINGS && (isRefreshOn == null || !isRefreshOn.booleanValue());
86
        return WARNINGS && (isRefreshOn == null || !isRefreshOn.booleanValue());
Lines 84-90 public final class FileBasedFileSystem e Link Here
84
88
85
    //only for tests purposes
89
    //only for tests purposes
86
    public static void reinitForTests() {
90
    public static void reinitForTests() {
87
        FileBasedFileSystem.allInstances = new HashMap();
91
        FileBasedFileSystem.fileToFileSystems = new HashMap();
88
    }
92
    }
89
93
90
    public static FileBasedFileSystem getInstance(final File file) {
94
    public static FileBasedFileSystem getInstance(final File file) {
Lines 96-116 public final class FileBasedFileSystem e Link Here
96
        final FileInfo rootInfo = new FileInfo(file).getRoot();
100
        final FileInfo rootInfo = new FileInfo(file).getRoot();
97
        final File rootFile = rootInfo.getFile();
101
        final File rootFile = rootInfo.getFile();
98
102
99
        synchronized (FileBasedFileSystem.allInstances) {
103
        synchronized (FileBasedFileSystem.fileToFileSystems) {
100
            retVal = (FileBasedFileSystem) FileBasedFileSystem.allInstances.get(rootFile);
104
            retVal = fileToFileSystems.get(rootFile);
101
        }
105
        }
102
        if (retVal == null && addMising) {
106
        if (retVal == null && addMising) {
103
            if (rootInfo.isConvertibleToFileObject()) {           
107
            if (rootInfo.isConvertibleToFileObject()) {
104
                synchronized (FileBasedFileSystem.allInstances) {
108
                boolean changed =false;
105
                    retVal = (FileBasedFileSystem) FileBasedFileSystem.allInstances.get(rootFile);
109
                synchronized (fileToFileSystems) {
110
                    retVal = FileBasedFileSystem.fileToFileSystems.get(rootFile);
106
                    if (retVal == null) {
111
                    if (retVal == null) {
107
                        retVal = new FileBasedFileSystem(rootFile);
112
                        retVal = new FileBasedFileSystem(rootFile);
108
                        FileBasedFileSystem.allInstances.put(rootFile, retVal);
113
                        fileToFileSystems.put(rootFile, retVal);
114
                        changed = true;
109
                    }
115
                    }
116
                }
117
                if (changed) {
118
                    getRepository().fireChange();
110
                }
119
                }
111
            }
120
            }
112
        }
121
        }
113
        return retVal;
122
        return retVal;
123
    }
124
    
125
    private static Repository getRepository() {
126
        synchronized(FileBasedFileSystem.class) {
127
            if (repo != null) {
128
                return repo;
129
            }
130
        }
131
        Repository tmp = (Repository)Lookup.getDefault().lookup(FileBasedFileSystemsSPI.class);
132
        synchronized(FileBasedFileSystem.class) {
133
            repo = Repository.getDefault();
134
        }          
135
        assert repo != null;
136
        return repo;
114
    }
137
    }
115
    
138
    
116
    public static final FileObject getFileObject(final File file) {
139
    public static final FileObject getFileObject(final File file) {
Lines 119-137 public final class FileBasedFileSystem e Link Here
119
    }
142
    }
120
    
143
    
121
144
122
    static Collection getInstances() {
145
    static Collection<FileBasedFileSystem> getInstances() {
123
        synchronized (FileBasedFileSystem.allInstances) {
146
        synchronized (FileBasedFileSystem.fileToFileSystems) {
124
            return new ArrayList(allInstances.values());
147
            return new ArrayList(fileToFileSystems.values());
125
        }
148
        }
126
    }
149
    }
127
150
    
151
    public static Map<File, ? extends FileBasedFileSystem> getFileSystems() {
152
        return new HashMap<File, FileBasedFileSystem>(fileToFileSystems);
153
    }
154
    
128
    public Status getStatus() {
155
    public Status getStatus() {
129
        return status;
156
        return status;
130
    }
157
    }
131
            
158
            
132
    static int getSize () {
159
    static int getSize () {
133
        synchronized (FileBasedFileSystem.allInstances) {
160
        synchronized (FileBasedFileSystem.fileToFileSystems) {
134
            return allInstances.size();
161
            return fileToFileSystems.size();
135
        }        
162
        }        
136
    }
163
    }
137
    
164
    
Lines 214-220 public final class FileBasedFileSystem e Link Here
214
        Statistics.REFRESH_FILE.reset();
241
        Statistics.REFRESH_FILE.reset();
215
    }
242
    }
216
    
243
    
217
    public final void refreshFor(final File file) {
244
    public final void refreshFor(final File... files) {
218
        Statistics.StopWatch stopWatch = Statistics.getStopWatch(Statistics.REFRESH_FS);
245
        Statistics.StopWatch stopWatch = Statistics.getStopWatch(Statistics.REFRESH_FS);
219
        stopWatch.start();
246
        stopWatch.start();
220
        try {
247
        try {
Lines 222-228 public final class FileBasedFileSystem e Link Here
222
                refreshIsOn.set(true);            
249
                refreshIsOn.set(true);            
223
                this.runAtomicAction(new FileSystem.AtomicAction() {
250
                this.runAtomicAction(new FileSystem.AtomicAction() {
224
                    public void run() throws IOException {
251
                    public void run() throws IOException {
225
                        getFactory().refreshFor(file);
252
                        getFactory().refreshFor(files);
226
                    }            
253
                    }            
227
                });
254
                });
228
            } finally {
255
            } finally {
(-)a/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/FileObjectFactory.java (-5 / +9 lines)
Lines 379-387 public final class FileObjectFactory { Link Here
379
        refresh(all2Refresh, expected);
379
        refresh(all2Refresh, expected);
380
    }
380
    }
381
381
382
    public void refreshFor(File f) {
382
    public void refreshFor(File... files) {
383
        Set all2Refresh = collectForRefresh();
383
        Set all2Refresh = collectForRefresh();
384
        refresh(all2Refresh, f);        
384
        refresh(all2Refresh, files);        
385
    }    
385
    }    
386
        
386
        
387
    private Set collectForRefresh() {
387
    private Set collectForRefresh() {
Lines 410-421 public final class FileObjectFactory { Link Here
410
        return all2Refresh;
410
        return all2Refresh;
411
    }
411
    }
412
    
412
    
413
    private void refresh(final Set all2Refresh, File file) {
413
    private void refresh(final Set all2Refresh, File... files) {
414
        for (Iterator iterator = all2Refresh.iterator(); iterator.hasNext();) {
414
        for (Iterator iterator = all2Refresh.iterator(); iterator.hasNext();) {
415
            final BaseFileObj fo = (BaseFileObj) iterator.next();
415
            final BaseFileObj fo = (BaseFileObj) iterator.next();
416
            if (isParentOf(file, fo.getFileName().getFile())) {
416
            for (File file : files) {
417
                fo.refresh(true);
417
                if (isParentOf(file, fo.getFileName().getFile())) {
418
                    fo.refresh(true);
419
                    break;
420
                }                
418
            }
421
            }
422
419
        }
423
        }
420
    }    
424
    }    
421
       
425
       
(-)a/masterfs/test/unit/src/org/netbeans/modules/masterfs/filebasedfs/BaseFileObjectTestHid.java (-2 / +2 lines)
Lines 674-681 public class BaseFileObjectTestHid exten Link Here
674
        IgnoreDirFileSystem ifs = new IgnoreDirFileSystem();
674
        IgnoreDirFileSystem ifs = new IgnoreDirFileSystem();
675
        ifs.setRootDirectory(f);
675
        ifs.setRootDirectory(f);
676
        
676
        
677
        Repository.getDefault().addFileSystem(ifs);
677
        org.openide.filesystems.Repository.getDefault().addFileSystem(ifs);
678
        Repository.getDefault().addFileSystem(testedFS);
678
        org.openide.filesystems.Repository.getDefault().addFileSystem(testedFS);
679
        
679
        
680
        FileObject[] fos = FileUtil.fromFile(f);
680
        FileObject[] fos = FileUtil.fromFile(f);
681
        assertTrue(fos.length > 0);
681
        assertTrue(fos.length > 0);
(-)a/masterfs/test/unit/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/FileObjectFactoryTest.java (+1 lines)
Lines 137-142 public class FileObjectFactoryTest exten Link Here
137
            FileUtil.refreshFor(workDir);   
137
            FileUtil.refreshFor(workDir);   
138
            fdc.assertFolderCreated(1);
138
            fdc.assertFolderCreated(1);
139
            assertNotNull(foWorkDir.getFileObject(external.getName()));                                    
139
            assertNotNull(foWorkDir.getFileObject(external.getName()));                                    
140
            FileUtil.refreshFor(workDir.getParentFile(),workDir, workDir.getParentFile());   
140
            
141
            
141
        } finally {
142
        } finally {
142
            fdc.cleanUp();            
143
            fdc.cleanUp();            
(-)a/openide.filesystems/src/org/openide/filesystems/FileUtil.java (-42 / +39 lines)
Lines 77-82 import org.openide.filesystems.FileSyste Link Here
77
import org.openide.filesystems.FileSystem.AtomicAction;
77
import org.openide.filesystems.FileSystem.AtomicAction;
78
import org.openide.util.Exceptions;
78
import org.openide.util.Exceptions;
79
import org.openide.util.Lookup;
79
import org.openide.util.Lookup;
80
import org.openide.util.Lookup.Item;
80
import org.openide.util.NbBundle;
81
import org.openide.util.NbBundle;
81
import org.openide.util.Utilities;
82
import org.openide.util.Utilities;
82
import org.openide.util.WeakListeners;
83
import org.openide.util.WeakListeners;
Lines 121-127 public final class FileUtil extends Obje Link Here
121
122
122
    /** Cache for {@link #isArchiveFile(FileObject)}. */
123
    /** Cache for {@link #isArchiveFile(FileObject)}. */
123
    private static final Map<FileObject, Boolean> archiveFileCache = new WeakHashMap<FileObject,Boolean>();
124
    private static final Map<FileObject, Boolean> archiveFileCache = new WeakHashMap<FileObject,Boolean>();
124
    private static FileSystem diskFileSystem;
125
    private static FileBasedFileSystemsSPI filesystems;
126
    private static FileBasedFileSystems fsSupport;
125
127
126
    private FileUtil() {
128
    private FileUtil() {
127
    }
129
    }
Lines 133-156 public final class FileUtil extends Obje Link Here
133
     * @since 7.6
135
     * @since 7.6
134
     */
136
     */
135
    public static void refreshFor(File... files) {
137
    public static void refreshFor(File... files) {
136
        FileSystem fs = getDiskFileSystem();
138
        FileBasedFileSystemsSPI fbs = getFileBasedFileSystemsSPI();
137
        if (fs == null) {
139
        fbs.refreshFor(files);
138
            for (File file : files) {
140
    }         
139
                FileObject fo = toFileObject(file);
141
        
140
                fs = getDiskFileSystem();
142
    /**
141
                if (fs != null) {
143
     * 
142
                    break;
144
     * @return
143
                }
145
     */
146
    static FileBasedFileSystemsSPI getFileBasedFileSystemsSPI() {
147
        synchronized (FileUtil.class) {
148
            if (filesystems != null) {
149
                return filesystems;
144
            }
150
            }
145
        }
151
        }
146
        if (fs != null) {
152
        FileBasedFileSystemsSPI tmp = null;
147
            try {
153
        Lookup.Result<FileBasedFileSystemsSPI> res = Lookup.getDefault().lookup(new Lookup.Template(FileBasedFileSystemsSPI.class));
148
                fs.getRoot().setAttribute("request_for_refreshing_files_be_aware_this_is_not_public_api", files);
154
        Iterator<? extends Item<FileBasedFileSystemsSPI>> it = res.allItems().iterator();
149
            } catch (IOException ex) {
155
        for (; it.hasNext();) {
150
                Exceptions.printStackTrace(ex);
156
            Lookup.Item<FileBasedFileSystemsSPI> item = it.next();
157
            if (item != null && item.getId().contains("org.netbeans.modules.masterfs.filebasedfs")) {//NOI18N
158
                tmp = item.getInstance();
159
                break;
151
            }
160
            }
152
        } 
161
        }
153
    }         
162
        synchronized (FileUtil.class) {
163
            if (filesystems == null) {
164
                filesystems =  tmp;
165
            }
166
            return filesystems;
167
        }
168
    }    
169
    
170
    public static FileBasedFileSystems getFileBasedFileSystems() {
171
        if (fsSupport == null) {
172
            fsSupport = new FileBasedFileSystems();
173
        }
174
        return fsSupport;
175
    }
176
    
154
    
177
    
155
    /**
178
    /**
156
     * Executes atomic action. For more info see {@link FileSystem#runAtomicAction}. 
179
     * Executes atomic action. For more info see {@link FileSystem#runAtomicAction}. 
Lines 630-646 public final class FileUtil extends Obje Link Here
630
            /*probably temporary piece of code to catch the cause of #46630*/
653
            /*probably temporary piece of code to catch the cause of #46630*/
631
        } catch (MalformedURLException e) {
654
        } catch (MalformedURLException e) {
632
            retVal = null;
655
            retVal = null;
633
        }
634
635
        if (retVal != null) {
636
            if (getDiskFileSystem() == null) {
637
                try {
638
                    FileSystem fs = retVal.getFileSystem();
639
                    setDiskFileSystem(fs);
640
                } catch (FileStateInvalidException ex) {
641
                    Exceptions.printStackTrace(ex);
642
                }
643
            }
644
        }
656
        }
645
        return retVal;
657
        return retVal;
646
    }
658
    }
Lines 1873-1892 public final class FileUtil extends Obje Link Here
1873
        public File createFileObject(String path) {
1885
        public File createFileObject(String path) {
1874
            return wrapFileNoCanonicalize(delegate.createFileObject(path));
1886
            return wrapFileNoCanonicalize(delegate.createFileObject(path));
1875
        }
1887
        }
1876
    }
1877
    
1878
    private static FileSystem getDiskFileSystem() {
1879
        synchronized (FileUtil.class) {
1880
            return diskFileSystem;
1881
        }
1882
    }
1883
1884
    private static void setDiskFileSystem(FileSystem fs) {
1885
        Object o = fs.getRoot().getAttribute("SupportsRefreshForNoPublicAPI");
1886
        if (o instanceof Boolean && ((Boolean) o).booleanValue()) {
1887
            synchronized (FileUtil.class) {
1888
                diskFileSystem = fs;
1889
            }
1890
        }
1891
    }    
1888
    }    
1892
}
1889
}
(-)a/versioning/src/org/netbeans/modules/versioning/FilesystemInterceptor.java (-31 / +2 lines)
Lines 67-110 class FilesystemInterceptor extends Prov Link Here
67
    void init(VersioningManager versioningManager) {
67
    void init(VersioningManager versioningManager) {
68
        assert master == null;
68
        assert master == null;
69
        master = versioningManager;
69
        master = versioningManager;
70
        Set filesystems = getRootFilesystems();
70
        FileUtil.getFileBasedFileSystems().addFileChangeListener(this);
71
        for (Iterator i = filesystems.iterator(); i.hasNext();) {
72
            FileSystem fileSystem = (FileSystem) i.next();
73
            fileSystem.addFileChangeListener(this);
74
        }
75
    }
71
    }
76
72
77
    /**
73
    /**
78
     * Unregisters listeners from all disk filesystems.
74
     * Unregisters listeners from all disk filesystems.
79
     */ 
75
     */ 
80
    void shutdown() {
76
    void shutdown() {
81
        Set filesystems = getRootFilesystems();
77
        FileUtil.getFileBasedFileSystems().removeFileChangeListener(this);
82
        for (Iterator i = filesystems.iterator(); i.hasNext();) {
83
            FileSystem fileSystem = (FileSystem) i.next();
84
            fileSystem.removeFileChangeListener(this);
85
        }
86
    }
78
    }
87
88
    /**
89
     * Retrieves all filesystems.
90
     * 
91
     * @return Set<FileSystem> set of filesystems
92
     */ 
93
    private Set<FileSystem> getRootFilesystems() {
94
        Set<FileSystem> filesystems = new HashSet<FileSystem>();
95
        File [] roots = File.listRoots();
96
        for (int i = 0; i < roots.length; i++) {
97
            File root = roots[i];
98
            FileObject fo = FileUtil.toFileObject(FileUtil.normalizeFile(root));
99
            if (fo == null) continue;
100
            try {
101
                filesystems.add(fo.getFileSystem());
102
            } catch (FileStateInvalidException e) {
103
                // ignore invalid filesystems
104
            }
105
        }
106
        return filesystems;
107
    }    
108
79
109
    // ==================================================================================================
80
    // ==================================================================================================
110
    // CHANGE
81
    // CHANGE
(-)a/versioning/src/org/netbeans/modules/versioning/VersioningAnnotationProvider.java (-13 / +1 lines)
Lines 282-300 public class VersioningAnnotationProvide Link Here
282
            clearMap(filesToRefresh);
282
            clearMap(filesToRefresh);
283
            clearMap(parentsToRefresh);            
283
            clearMap(parentsToRefresh);            
284
            
284
            
285
            Set<FileSystem> filesystems = new HashSet<FileSystem>(1);
285
            Collection<FileSystem> filesystems = FileUtil.getFileBasedFileSystems().getFileSystems();
286
            File[] allRoots = File.listRoots();
287
            for (int i = 0; i < allRoots.length; i++) {
288
                File root = allRoots[i];
289
                FileObject fo = FileUtil.toFileObject(root);
290
                if (fo != null) {
291
                    try {
292
                        filesystems.add(fo.getFileSystem());
293
                    } catch (FileStateInvalidException e) {
294
                        // ignore invalid filesystems
295
                    }
296
                }
297
            }
298
            for (Iterator<FileSystem> i = filesystems.iterator(); i.hasNext();) {
286
            for (Iterator<FileSystem> i = filesystems.iterator(); i.hasNext();) {
299
                FileSystem fileSystem = i.next();
287
                FileSystem fileSystem = i.next();
300
                fireFileStatusChanged(new FileStatusEvent(fileSystem, true, true));                
288
                fireFileStatusChanged(new FileStatusEvent(fileSystem, true, true));                

Return to bug 127121