use of com.intellij.history.core.tree.DirectoryEntry in project intellij-community by JetBrains.
the class IdeaGateway method doCreateEntry.
@Nullable
private Entry doCreateEntry(@NotNull VirtualFile file, boolean forDeletion) {
if (!file.isDirectory()) {
if (!isVersioned(file))
return null;
Pair<StoredContent, Long> contentAndStamps;
if (forDeletion) {
FileDocumentManager m = FileDocumentManager.getInstance();
// should not try to load document
Document d = m.isFileModified(file) ? m.getCachedDocument(file) : null;
contentAndStamps = acquireAndClearCurrentContent(file, d);
} else {
contentAndStamps = getActualContentNoAcquire(file);
}
return doCreateFileEntry(file, contentAndStamps);
}
DirectoryEntry newDir = null;
if (file instanceof VirtualFileSystemEntry) {
int nameId = ((VirtualFileSystemEntry) file).getNameId();
if (nameId > 0) {
newDir = new DirectoryEntry(nameId);
}
}
if (newDir == null) {
newDir = new DirectoryEntry(file.getName());
}
doCreateChildren(newDir, iterateDBChildren(file), forDeletion);
if (!isVersioned(file) && newDir.getChildren().isEmpty())
return null;
return newDir;
}
use of com.intellij.history.core.tree.DirectoryEntry in project intellij-community by JetBrains.
the class IdeaGateway method doCreateChildrenForPathOnly.
private void doCreateChildrenForPathOnly(@NotNull DirectoryEntry parent, @NotNull String path, @NotNull Iterable<VirtualFile> children) {
for (VirtualFile child : children) {
// on Mac FS root name is "/"
String name = StringUtil.trimStart(child.getName(), "/");
if (!path.startsWith(name))
continue;
String rest = path.substring(name.length());
if (!rest.isEmpty() && rest.charAt(0) != '/')
continue;
if (!rest.isEmpty() && rest.charAt(0) == '/') {
rest = rest.substring(1);
}
Entry e = doCreateEntryForPathOnly(child, rest);
if (e == null)
continue;
parent.addChild(e);
}
}
use of com.intellij.history.core.tree.DirectoryEntry in project intellij-community by JetBrains.
the class IdeaGateway method doCreateEntryForPathOnly.
@Nullable
private Entry doCreateEntryForPathOnly(@NotNull VirtualFile file, @NotNull String path) {
if (!file.isDirectory()) {
if (!isVersioned(file))
return null;
return doCreateFileEntry(file, getActualContentNoAcquire(file));
}
DirectoryEntry newDir = new DirectoryEntry(file.getName());
doCreateChildrenForPathOnly(newDir, path, iterateDBChildren(file));
if (!isVersioned(file) && newDir.getChildren().isEmpty())
return null;
return newDir;
}
Aggregations