private synchronized VirtualFilePointerImpl getOrCreate( VirtualFile file, @NotNull String url, Disposable parentDisposable, @Nullable VirtualFilePointerListener listener, String path) { TreeMap<String, VirtualFilePointerImpl> urlToPointer = myUrlToPointerMaps.get(listener); if (urlToPointer == null) { urlToPointer = new TreeMap<String, VirtualFilePointerImpl>(COMPARATOR); myUrlToPointerMaps.put(listener, urlToPointer); } VirtualFilePointerImpl pointer = urlToPointer.get(path); if (pointer == null) { pointer = new VirtualFilePointerImpl(file, url, myVirtualFileManager, listener, parentDisposable); urlToPointer.put(path, pointer); } return pointer; }
private void addPointersUnder( String path, boolean allowSameFSOptimization, List<VirtualFilePointer> pointers) { final boolean urlFromJarFS = allowSameFSOptimization && path.indexOf(JarFileSystem.JAR_SEPARATOR) > 0; for (TreeMap<String, VirtualFilePointerImpl> urlToPointer : myUrlToPointerMaps.values()) { for (String pointerUrl : urlToPointer.keySet()) { final boolean pointerFromJarFS = allowSameFSOptimization && pointerUrl.indexOf(JarFileSystem.JAR_SEPARATOR) > 0; if (urlFromJarFS != pointerFromJarFS) { continue; // optimization: consider pointers from the same FS as the url specified } if (startsWith(path, pointerUrl)) { VirtualFilePointer pointer = urlToPointer.get(pointerUrl); if (pointer != null) { pointers.add(pointer); } } } } }