public void addChild(@NotNull VirtualFileSystemEntry child) { final String childName = child.getName(); final boolean ignoreCase = !getFileSystem().isCaseSensitive(); synchronized (myData) { int indexInReal = findIndex(myData.myChildrenIds, childName, ignoreCase); myData.removeAdoptedName(childName); if (indexInReal < 0) { insertChildAt(child, indexInReal); ((PersistentFSImpl)PersistentFS.getInstance()).incStructuralModificationCount(); } // else already stored assertConsistency(ignoreCase, child); } }
public void setNewName(@NotNull String newName) { if (!isValidName(newName)) { throw new IllegalArgumentException(VfsBundle.message("file.invalid.name.error", newName)); } VirtualDirectoryImpl parent = getParent(); parent.removeChild(this); mySegment.setNameId(myId, FileNameCache.storeName(newName)); ((PersistentFSImpl)PersistentFS.getInstance()).incStructuralModificationCount(); parent.addChild(this); }
public void testFileLength() throws Exception { File file = FileUtil.createTempFile("test", "txt"); FileUtil.writeToFile(file, "hello"); VirtualFile virtualFile = myFS.refreshAndFindFileByIoFile(file); assertNotNull(virtualFile); String s = VfsUtilCore.loadText(virtualFile); assertEquals("hello", s); assertEquals(5, virtualFile.getLength()); FileUtil.writeToFile(file, "new content"); ((PersistentFSImpl)PersistentFS.getInstance()).cleanPersistedContents(); s = VfsUtilCore.loadText(virtualFile); assertEquals("new content", s); assertEquals(11, virtualFile.getLength()); }
public void testFileLength() throws Exception { File file = FileUtil.createTempFile("test", "txt"); FileUtil.writeToFile(file, "hello"); VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file); assertNotNull(virtualFile); String s = VfsUtilCore.loadText(virtualFile); assertEquals("hello", s); assertEquals(5, virtualFile.getLength()); FileUtil.writeToFile(file, "new content"); ((PersistentFSImpl)PersistentFS.getInstance()).cleanPersistedContents(); s = VfsUtilCore.loadText(virtualFile); assertEquals("new content", s); assertEquals(11, virtualFile.getLength()); }
public void addChild(@Nonnull VirtualFileSystemEntry child) { final String childName = child.getName(); final boolean ignoreCase = !getFileSystem().isCaseSensitive(); synchronized (myData) { int indexInReal = findIndex(myData.myChildrenIds, childName, ignoreCase); myData.removeAdoptedName(childName); if (indexInReal < 0) { insertChildAt(child, indexInReal); ((PersistentFSImpl)PersistentFS.getInstance()).incStructuralModificationCount(); } // else already stored assertConsistency(ignoreCase, child); } }
public void setNewName(@Nonnull String newName) { if (!getFileSystem().isValidName(newName)) { throw new IllegalArgumentException(VfsBundle.message("file.invalid.name.error", newName)); } VirtualDirectoryImpl parent = getParent(); parent.removeChild(this); mySegment.setNameId(myId, FileNameCache.storeName(newName)); ((PersistentFSImpl)PersistentFS.getInstance()).incStructuralModificationCount(); parent.addChild(this); }
private static void cleanPersistedVFSContent() { ((PersistentFSImpl)PersistentFS.getInstance()).cleanPersistedContents(); }
private void removeFromArray(int index) { myData.myChildrenIds = ArrayUtil.remove(myData.myChildrenIds, index); ((PersistentFSImpl)PersistentFS.getInstance()).incStructuralModificationCount(); }