@NotNull @Override public VirtualFilePointer[] getExcludeRootsForModule(@NotNull final ModuleRootModel rootModel) { ArrayList<VirtualFilePointer> result = new ArrayList<VirtualFilePointer>(); final CompilerModuleExtension extension = rootModel.getModuleExtension(CompilerModuleExtension.class); if (extension == null) { return VirtualFilePointer.EMPTY_ARRAY; } if (extension.isCompilerOutputPathInherited()) { ContainerUtil.addIfNotNull(result, CompilerProjectExtension.getInstance(myProject).getCompilerOutputPointer()); } else { if (!extension.isExcludeOutput()) return VirtualFilePointer.EMPTY_ARRAY; ContainerUtil.addIfNotNull(result, extension.getCompilerOutputPointer()); ContainerUtil.addIfNotNull(result, extension.getCompilerOutputForTestsPointer()); } return result.isEmpty() ? VirtualFilePointer.EMPTY_ARRAY : result.toArray(new VirtualFilePointer[result.size()]); }
@NotNull @Override public VirtualFile[] getFiles(@NotNull OrderRootType rootType) { final VirtualFilePointerContainer container = myRoots.get(rootType); if (container == null) return VirtualFile.EMPTY_ARRAY; final List<VirtualFile> expanded = new ArrayList<VirtualFile>(); for (JpsLibraryRoot root : myJpsLibrary.getRoots(getJpsRootType(rootType))) { final VirtualFilePointer pointer = container.findByUrl(root.getUrl()); if (pointer == null) continue; VirtualFile file = pointer.getFile(); if (file == null) continue; if (file.isDirectory() && root.getInclusionOptions() != JpsLibraryRoot.InclusionOptions.ROOT_ITSELF) { LibraryImpl.collectJarFiles(file, expanded, root.getInclusionOptions() == JpsLibraryRoot.InclusionOptions.ARCHIVES_UNDER_ROOT_RECURSIVELY); continue; } expanded.add(file); } return VfsUtilCore.toVirtualFileArray(expanded); }
@Override public List<String> getInvalidRootUrls(OrderRootType type) { final VirtualFilePointerContainer container = myRoots.get(type); if (container == null) return Collections.emptyList(); final List<VirtualFilePointer> pointers = container.getList(); List<String> invalidPaths = null; for (VirtualFilePointer pointer : pointers) { if (!pointer.isValid()) { if (invalidPaths == null) { invalidPaths = new SmartList<String>(); } invalidPaths.add(pointer.getUrl()); } } return invalidPaths == null ? Collections.<String>emptyList() : invalidPaths; }
public PsiFile[] getAssociationsFor(PsiFile file, FileType... fileTypes) { final VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) return PsiFile.EMPTY_ARRAY; for (VirtualFilePointer pointer : myAssociations.keySet()) { if (pointer.isValid() && pointer.getUrl().equals(virtualFile.getUrl())) { final VirtualFilePointerContainer container = myAssociations.get(pointer); if (container != null) { final VirtualFile[] files = container.getFiles(); final Set<PsiFile> list = new HashSet<PsiFile>(); final PsiManager psiManager = PsiManager.getInstance(myProject); for (VirtualFile assoc : files) { final PsiFile psiFile = psiManager.findFile(assoc); if (psiFile != null && (fileTypes.length == 0 || matchesFileType(psiFile, fileTypes))) { list.add(psiFile); } } return PsiUtilCore.toPsiFileArray(list); } else { return PsiFile.EMPTY_ARRAY; } } } return PsiFile.EMPTY_ARRAY; }
@Override public List<String> getInvalidRootUrls(OrderRootType type) { if (myDisposed) return Collections.emptyList(); final List<VirtualFilePointer> pointers = myRoots.get(type).getList(); List<String> invalidPaths = null; for (VirtualFilePointer pointer : pointers) { if (!pointer.isValid()) { if (invalidPaths == null) { invalidPaths = new SmartList<String>(); } invalidPaths.add(pointer.getUrl()); } } return invalidPaths == null ? Collections.<String>emptyList() : invalidPaths; }
@Override public boolean removeRoot(@NotNull String url, @NotNull OrderRootType rootType) { checkDisposed(); LOG.assertTrue(isWritable()); final VirtualFilePointerContainer container = myRoots.get(rootType); final VirtualFilePointer byUrl = container.findByUrl(url); if (byUrl != null) { container.remove(byUrl); if (myExcludedRoots != null) { for (String excludedRoot : myExcludedRoots.getUrls()) { if (!isUnderRoots(excludedRoot)) { VirtualFilePointer pointer = myExcludedRoots.findByUrl(excludedRoot); if (pointer != null) { myExcludedRoots.remove(pointer); } } } } myJarDirectories.remove(rootType, url); return true; } return false; }
public void testCreate() throws Exception { final File tempDirectory = createTempDirectory(); final File fileToCreate = new File(tempDirectory, "toCreate.txt"); final LoggingListener fileToCreateListener = new LoggingListener(); final VirtualFilePointer fileToCreatePointer = createPointerByFile(fileToCreate, fileToCreateListener); assertFalse(fileToCreatePointer.isValid()); fileToCreate.createNewFile(); ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { VirtualFileManager.getInstance().syncRefresh(); final VirtualFile virtualFile = getVirtualFile(tempDirectory); virtualFile.refresh(false, true); } }); assertTrue(fileToCreatePointer.isValid()); assertEquals("[before:false, after:true]", fileToCreateListener.getLog().toString()); try { String expectedUrl = VirtualFileManager .constructUrl(LocalFileSystem.PROTOCOL, fileToCreate.getCanonicalPath().replace(File.separatorChar, '/')); assertEquals(expectedUrl.toUpperCase(), fileToCreatePointer.getUrl().toUpperCase()); } catch (IOException e) { fail(); } }
private void checkFileName(String prefix, String suffix) throws IOException { final File tempDirectory = createTempDirectory(); final VirtualFile temp = getVirtualFile(tempDirectory); String name = "toCreate.txt"; final VirtualFilePointer fileToCreatePointer = createPointerByFile(new File(tempDirectory.getPath() + prefix + name +suffix), null); assertFalse(fileToCreatePointer.isValid()); assertNull(fileToCreatePointer.getFile()); VirtualFile child = createChildData(temp, name); assertTrue(fileToCreatePointer.isValid()); assertEquals(child, fileToCreatePointer.getFile()); delete(child); assertFalse(fileToCreatePointer.isValid()); assertNull(fileToCreatePointer.getFile()); }
public void testTwoPointersBecomeOneAfterFileRenamedUnderTheOtherName() throws IOException { final File tempDir = createTempDirectory(); final File f1 = new File(tempDir, "f1"); boolean created = f1.createNewFile(); assertTrue(created); final String url1 = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, f1.getCanonicalPath().replace(File.separatorChar, '/')); final VirtualFile vFile1 = refreshAndFind(url1); final LoggingListener listener1 = new LoggingListener(); VirtualFilePointer pointer1 = myVirtualFilePointerManager.create(url1, disposable, listener1); assertTrue(pointer1.isValid()); String url2 = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, tempDir.getCanonicalPath().replace(File.separatorChar, '/')+"/f2"); final LoggingListener listener2 = new LoggingListener(); VirtualFilePointer pointer2 = myVirtualFilePointerManager.create(url2, disposable, listener2); assertFalse(pointer2.isValid()); rename(vFile1, "f2"); assertTrue(pointer1.isValid()); assertTrue(pointer2.isValid()); assertEquals("[]", listener1.getLog().toString()); assertEquals("[before:false, after:true]", listener2.getLog().toString()); }
public void testMultipleNotifications() throws Exception { final File tempDir = createTempDirectory(); final File file_f1 = new File(tempDir, "f1"); final File file_f2 = new File(tempDir, "f2"); final LoggingListener listener = new LoggingListener(); final VirtualFilePointer pointer_f1 = createPointerByFile(file_f1, listener); final VirtualFilePointer pointer_f2 = createPointerByFile(file_f2, listener); assertFalse(pointer_f1.isValid()); assertFalse(pointer_f2.isValid()); file_f1.createNewFile(); file_f2.createNewFile(); ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { LocalFileSystem.getInstance().refresh(false); } }); assertEquals("[before:false:false, after:true:true]", listener.getLog().toString()); }
public MyDiffRequestChain(@Nullable Project project, @NotNull Iterable<Pair<VirtualFilePointer, FileStatus>> iterable, @NotNull Label before, @NotNull Label after, @Nullable String selectedUrl) { myProject = project; myBefore = before; myAfter = after; int selected = -1; for (Pair<VirtualFilePointer, FileStatus> pair : iterable) { if (selected == -1 && pair.first.getUrl().equals(selectedUrl)) selected = myRequests.size(); myRequests.add(new MyDiffRequestProducer(pair.first, pair.second)); } if (selected != -1) myIndex = selected; }
@Override protected boolean acceptFilter(Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) { try { VirtualFilePointer filePointer = getFilePointer(); if (!filePointer.isValid()) { return false; } VirtualFile file = filePointer.getFile(); if (file != null && file.isValid() && filter.first.contains(file, getProject(), filter.second)) { applyFilter(true); return true; } } catch (Throwable e) { // TODO: catch and ignore exceptions: see to FilePatternPackageSet // sometimes for new file DirectoryFileIndex.getContentRootForFile() return random path } return false; }
@Override public void beforeValidityChanged(@NotNull VirtualFilePointer[] pointers) { if (!myProject.isDisposed()) { if (myInsideRefresh == 0) { if (affectsRoots(pointers)) { beforeRootsChange(false); if (myDoLogCachesUpdate) LOG.info(new Throwable(pointers.length > 0 ? pointers[0].getPresentableUrl():"")); } } else if (!myPointerChangesDetected) { //this is the first pointer changing validity if (affectsRoots(pointers)) { myPointerChangesDetected = true; myProject.getMessageBus().syncPublisher(ProjectTopics.PROJECT_ROOTS).beforeRootsChange(new ModuleRootEventImpl(myProject, false)); if (myDoLogCachesUpdate) LOG.info(new Throwable(pointers.length > 0 ? pointers[0].getPresentableUrl():"")); } } } }
public void removeAssociation(PsiFile file, PsiFile assoc) { final VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) return; if (assoc.getVirtualFile() == null) return; for (VirtualFilePointer pointer : myAssociations.keySet()) { if (pointer.getUrl().equals(virtualFile.getUrl())) { VirtualFilePointerContainer container = myAssociations.get(pointer); if (container != null) { //noinspection ConstantConditions final VirtualFilePointer p = container.findByUrl(assoc.getVirtualFile().getUrl()); if (p != null) { container.remove(p); if (container.size() == 0) { myAssociations.remove(pointer); } touch(); } } return; } } }
@Nullable protected VirtualFilePointer getOutputPathValue(Element element, String tag, final boolean createPointer) { final Element outputPathChild = element.getChild(tag); VirtualFilePointer vptr = null; if (outputPathChild != null && createPointer) { String outputPath = outputPathChild.getAttributeValue(ATTRIBUTE_URL); vptr = createPointer(outputPath); } return vptr; }
@NotNull @Override public List<String> getExcludeFolderUrls() { List<String> excluded = new ArrayList<String>(); for (JpsExcludeFolder folder : myExcludeFolders) { excluded.add(folder.getUrl()); } for (DirectoryIndexExcludePolicy excludePolicy : Extensions .getExtensions(DirectoryIndexExcludePolicy.EP_NAME, myRootModel.getProject())) { for (VirtualFilePointer pointer : excludePolicy.getExcludeRootsForModule(myRootModel)) { excluded.add(pointer.getUrl()); } } return excluded; }
@NotNull @Override public VirtualFile[] getExcludeFolderFiles() { List<VirtualFile> excluded = new ArrayList<VirtualFile>(); for (JpsExcludeFolder folder : myExcludeFolders) { ContainerUtil.addIfNotNull(excluded, folder.getFile()); } for (DirectoryIndexExcludePolicy excludePolicy : Extensions.getExtensions(DirectoryIndexExcludePolicy.EP_NAME, myRootModel.getProject())) { for (VirtualFilePointer pointer : excludePolicy.getExcludeRootsForModule(myRootModel)) { ContainerUtil.addIfNotNull(excluded, pointer.getFile()); } } return VfsUtilCore.toVirtualFileArray(excluded); }
private static HashMap<VirtualFilePointer, VirtualFilePointerContainer> copy(FileAssociationsManagerImpl other) { final HashMap<VirtualFilePointer, VirtualFilePointerContainer> hashMap = new LinkedHashMap<VirtualFilePointer, VirtualFilePointerContainer>(); final Set<VirtualFilePointer> virtualFilePointers = other.myAssociations.keySet(); for (VirtualFilePointer pointer : virtualFilePointers) { final VirtualFilePointerContainer container = other.myFilePointerManager.createContainer(other.myProject); container.addAll(other.myAssociations.get(pointer)); hashMap.put(other.myFilePointerManager.duplicate(pointer, other.myProject, null), container); } return hashMap; }
@Override public boolean removeExcludedRoot(@NotNull String url) { if (myExcludedRoots != null) { VirtualFilePointer pointer = myExcludedRoots.findByUrl(url); if (pointer != null) { myExcludedRoots.remove(pointer); return true; } } return false; }
public Map<VirtualFile, VirtualFile[]> getAssociations() { final HashMap<VirtualFile, VirtualFile[]> map = new LinkedHashMap<VirtualFile, VirtualFile[]>(); final Set<VirtualFilePointer> set = myAssociations.keySet(); for (VirtualFilePointer pointer : set) { if (pointer.isValid()) { final VirtualFile file = pointer.getFile(); map.put(file, myAssociations.get(pointer).getFiles()); } } return map; }
public void removeAssociations(PsiFile file) { final VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) return; for (VirtualFilePointer pointer : myAssociations.keySet()) { if (pointer.getUrl().equals(virtualFile.getUrl())) { myAssociations.remove(pointer); touch(); return; } } }
@NotNull private static VirtualFilePointer[] toPointers(@NotNull List<FilePointerPartNode> pointers) { if (pointers.isEmpty()) return VirtualFilePointer.EMPTY_ARRAY; List<VirtualFilePointer> list = ContainerUtil .mapNotNull(pointers, new Function<FilePointerPartNode, VirtualFilePointer>() { @Override public VirtualFilePointer fun(FilePointerPartNode pair) { return pair.leaf; } }); return list.toArray(new VirtualFilePointer[list.size()]); }
@Override @NotNull public synchronized VirtualFilePointer duplicate(@NotNull VirtualFilePointer pointer, @NotNull Disposable parent, @Nullable VirtualFilePointerListener listener) { VirtualFile file = pointer.getFile(); return file == null ? create(pointer.getUrl(), parent, listener) : create(file, parent, listener); }
private static String buildMessage(@NonNls final String startMsg, VirtualFilePointer[] pointers) { StringBuilder buffer = new StringBuilder(startMsg); buffer.append(":"); for (int i = 0; i < pointers.length; i++) { VirtualFilePointer pointer = pointers[i]; final String s = Boolean.toString(pointer.isValid()); if (i > 0) buffer.append(":"); buffer.append(s); } return buffer.toString(); }
public void testDelete() throws Exception { File tempDirectory = createTempDirectory(); final File fileToDelete = new File(tempDirectory, "toDelete.txt"); fileToDelete.createNewFile(); final LoggingListener fileToDeleteListener = new LoggingListener(); final VirtualFilePointer fileToDeletePointer = createPointerByFile(fileToDelete, fileToDeleteListener); assertTrue(fileToDeletePointer.isValid()); delete(getVirtualFile(fileToDelete)); assertFalse(fileToDeletePointer.isValid()); assertEquals("[before:true, after:false]", fileToDeleteListener.getLog().toString()); }
public void testUrlsHavingOnlyStartingSlashInCommon() throws Exception { VirtualFilePointer p1 = myVirtualFilePointerManager.create("file:///a/p1", disposable, null); VirtualFilePointer p2 = myVirtualFilePointerManager.create("file:///b/p2", disposable, null); final LightVirtualFile root = new LightVirtualFile("/"); LightVirtualFile a = createLightFile(root, "a"); LightVirtualFile b = createLightFile(root, "b"); assertSameElements(myVirtualFilePointerManager.getPointersUnder(a, "p1"), p1); assertSameElements(myVirtualFilePointerManager.getPointersUnder(b, "p2"), p2); }
public void testUrlsHavingOnlyStartingSlashInCommonAndInvalidUrlBetweenThem() throws Exception { VirtualFilePointer p1 = myVirtualFilePointerManager.create("file:///a/p1", disposable, null); myVirtualFilePointerManager.create("file://invalid/path", disposable, null); VirtualFilePointer p2 = myVirtualFilePointerManager.create("file:///b/p2", disposable, null); final LightVirtualFile root = new LightVirtualFile("/"); LightVirtualFile a = createLightFile(root, "a"); LightVirtualFile b = createLightFile(root, "b"); assertSameElements(myVirtualFilePointerManager.getPointersUnder(a, "p1"), p1); assertSameElements(myVirtualFilePointerManager.getPointersUnder(b, "p2"), p2); }
public void testMovePointedFile() throws Exception { File tempDirectory = createTempDirectory(); final File moveTarget = new File(tempDirectory, "moveTarget"); moveTarget.mkdir(); final File fileToMove = new File(tempDirectory, "toMove.txt"); fileToMove.createNewFile(); final LoggingListener fileToMoveListener = new LoggingListener(); final VirtualFilePointer fileToMovePointer = createPointerByFile(fileToMove, fileToMoveListener); assertTrue(fileToMovePointer.isValid()); ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { final VirtualFile virtualFile = getVirtualFile(fileToMove); assertTrue(virtualFile.isValid()); final VirtualFile target = getVirtualFile(moveTarget); assertTrue(target.isValid()); try { virtualFile.move(null, target); } catch (IOException e) { fail(); } } }); assertTrue(fileToMovePointer.isValid()); assertEquals("[]", fileToMoveListener.getLog().toString()); }
public void testMoveFileUnderExistingPointer() throws Exception { File tempDirectory = createTempDirectory(); final File moveTarget = new File(tempDirectory, "moveTarget"); moveTarget.mkdir(); final File fileToMove = new File(tempDirectory, "toMove.txt"); fileToMove.createNewFile(); final LoggingListener listener = new LoggingListener(); final VirtualFilePointer fileToMoveTargetPointer = createPointerByFile(new File(moveTarget, fileToMove.getName()), listener); assertFalse(fileToMoveTargetPointer.isValid()); ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { final VirtualFile virtualFile = getVirtualFile(fileToMove); assertTrue(virtualFile.isValid()); final VirtualFile target = getVirtualFile(moveTarget); assertTrue(target.isValid()); try { virtualFile.move(null, target); } catch (IOException e) { fail(); } } }); assertTrue(fileToMoveTargetPointer.isValid()); assertEquals("[before:false, after:true]", listener.getLog().toString()); }
public void testMovePointedFileUnderAnotherPointer() throws Exception { File tempDirectory = createTempDirectory(); final File moveTarget = new File(tempDirectory, "moveTarget"); moveTarget.mkdir(); final File fileToMove = new File(tempDirectory, "toMove.txt"); fileToMove.createNewFile(); final LoggingListener listener = new LoggingListener(); final LoggingListener targetListener = new LoggingListener(); final VirtualFilePointer fileToMovePointer = createPointerByFile(fileToMove, listener); final VirtualFilePointer fileToMoveTargetPointer = createPointerByFile(new File(moveTarget, fileToMove.getName()), targetListener); assertFalse(fileToMoveTargetPointer.isValid()); ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { final VirtualFile virtualFile = getVirtualFile(fileToMove); assertTrue(virtualFile.isValid()); final VirtualFile target = getVirtualFile(moveTarget); assertTrue(target.isValid()); try { virtualFile.move(null, target); } catch (IOException e) { fail(); } } }); assertTrue(fileToMovePointer.isValid()); assertTrue(fileToMoveTargetPointer.isValid()); assertEquals("[]", listener.getLog().toString()); assertEquals("[before:false, after:true]", targetListener.getLog().toString()); }
public void testRenamingPointedFile() throws IOException { final File tempDir = createTempDirectory(); final File file = new File(tempDir, "f1"); assertTrue(file.createNewFile()); final LoggingListener listener = new LoggingListener(); VirtualFilePointer pointer = createPointerByFile(file, listener); assertTrue(pointer.isValid()); rename(getVirtualFile(file), "f2"); assertTrue(pointer.isValid()); assertEquals("[]", listener.getLog().toString()); }
public void testRenamingFileUnderTheExistingPointer() throws IOException { final File tempDir = createTempDirectory(); final File file = new File(tempDir, "f1"); assertTrue(file.createNewFile()); final LoggingListener listener = new LoggingListener(); VirtualFilePointer pointer = createPointerByFile(new File(file.getParent(), "f2"), listener); assertFalse(pointer.isValid()); rename(getVirtualFile(file), "f2"); assertTrue(pointer.isValid()); assertEquals("[before:false, after:true]", listener.getLog().toString()); }
public void testCreate1() throws Exception { final File tempDirectory = createTempDirectory(); final File fileToCreate = new File(tempDirectory, "toCreate1.txt"); final LoggingListener fileToCreateListener = new LoggingListener(); final VirtualFilePointer fileToCreatePointer = createPointerByFile(fileToCreate, fileToCreateListener); assertFalse(fileToCreatePointer.isValid()); fileToCreate.createNewFile(); final Runnable postRunnable = new Runnable() { @Override public void run() { assertTrue(fileToCreatePointer.isValid()); assertEquals("[before:false, after:true]", fileToCreateListener.getLog().toString()); try { String expectedUrl = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, fileToCreate.getCanonicalPath().replace(File.separatorChar, '/')); assertEquals(expectedUrl.toUpperCase(), fileToCreatePointer.getUrl().toUpperCase()); } catch (IOException e) { fail(); } } }; ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { VirtualFileManager.getInstance().syncRefresh(); final VirtualFile virtualFile = getVirtualFile(tempDirectory); virtualFile.refresh(false, true); } }); postRunnable.run(); }
private VirtualFilePointer createPointerByFile(final File file, final VirtualFilePointerListener fileListener) throws IOException { final String url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, file.getCanonicalPath().replace(File.separatorChar, '/')); final VirtualFile vFile = refreshAndFind(url); return vFile == null ? myVirtualFilePointerManager.create(url, disposable, fileListener) : myVirtualFilePointerManager.create(vFile, disposable, fileListener); }
private static void stressRead(@NotNull final VirtualFilePointer pointer, @NotNull final Collection<Job<Void>> reads) { for (int i = 0; i < 10; i++) { final AtomicReference<Job<Void>> reference = new AtomicReference<Job<Void>>(); reference.set(JobLauncher.getInstance().submitToJobThread(new Runnable() { @Override public void run() { ApplicationManager.getApplication().runReadAction(new Runnable() { @Override public void run() { VirtualFile file = pointer.getFile(); if (file != null && !file.isValid()) { throw new IncorrectOperationException("I've caught it. I am that good"); } } }); } }, new Consumer<Future>() { @Override public void consume(Future future) { try { future.get(); } catch (Exception e) { throw new RuntimeException(e); } finally { reads.remove(reference.get()); } } })); reads.add(reference.get()); } }
public void testMultipleCreationOfTheSamePointerPerformance() throws IOException { final LoggingListener listener = new LoggingListener(); final String url = VfsUtilCore.pathToUrl("/a/b/c/d/e"); final VirtualFilePointer thePointer = myVirtualFilePointerManager.create(url, disposable, listener); TempFileSystem.getInstance(); PlatformTestUtil.startPerformanceTest("same url vfp create", 5000, new ThrowableRunnable() { @Override public void run() throws Throwable { for (int i=0; i<10000000; i++) { VirtualFilePointer pointer = myVirtualFilePointerManager.create(url, disposable, listener); assertSame(pointer, thePointer); } } }).assertTiming(); }
@NotNull @Override public VirtualFilePointer duplicate(@NotNull VirtualFilePointer pointer, @NotNull Disposable parent, @Nullable VirtualFilePointerListener listener) { return new IdentityVirtualFilePointer(pointer.getFile(), pointer.getUrl()); }
@Override public void writeExternal(@NotNull final Element element, @NotNull final String childElementName) { for (VirtualFilePointer pointer : myList) { String url = pointer.getUrl(); final Element rootPathElement = new Element(childElementName); rootPathElement.setAttribute(URL_ATTR, url); element.addContent(rootPathElement); } }
private int indexOf(@NotNull final String url) { for (int i = 0; i < myList.size(); i++) { final VirtualFilePointer pointer = myList.get(i); if (url.equals(pointer.getUrl())) { return i; } } return -1; }
@Override public void remove(@NotNull VirtualFilePointer pointer) { assert !myDisposed; dropCaches(); final boolean result = myList.remove(pointer); LOG.assertTrue(result); }