use of com.intellij.history.core.tree.Entry 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.Entry in project intellij-community by JetBrains.
the class DifferenceReverter method getFilesToClearROStatus.
@Override
protected List<VirtualFile> getFilesToClearROStatus() throws IOException {
LinkedHashSet<VirtualFile> files = new LinkedHashSet<>();
for (Difference each : myDiffs) {
Entry l = each.getLeft();
Entry r = each.getRight();
VirtualFile f = l == null ? null : myGateway.findVirtualFile(l.getPath());
if (f != null)
files.add(f);
f = r == null ? null : myGateway.findVirtualFile(r.getPath());
if (f != null)
files.add(f);
}
return new ArrayList<>(files);
}
use of com.intellij.history.core.tree.Entry in project intellij-community by JetBrains.
the class UndoChangeRevertingVisitor method revertDeletion.
private void revertDeletion(VirtualFile parent, Entry e) throws IOException {
VirtualFile f = myGateway.findOrCreateFileSafely(parent, e.getName(), e.isDirectory());
if (e.isDirectory()) {
for (Entry child : e.getChildren()) revertDeletion(f, child);
} else {
registerDelayedContentApply(f, e.getContent(), e.getTimestamp());
registerDelayedROStatusApply(f, e.isReadOnly());
}
}
use of com.intellij.history.core.tree.Entry in project intellij-community by JetBrains.
the class LocalHistoryFacade method getByteContentBefore.
private ByteContent getByteContentBefore(RootEntry root, String path, Change change) {
root = root.copy();
String newPath = revertUpTo(root, path, null, change, false, false);
Entry entry = root.findEntry(newPath);
if (entry == null)
return new ByteContent(false, null);
if (entry.isDirectory())
return new ByteContent(true, null);
return new ByteContent(false, entry.getContent().getBytesIfAvailable());
}
use of com.intellij.history.core.tree.Entry in project intellij-community by JetBrains.
the class CreateEntryChange method revertOn.
@Override
public void revertOn(RootEntry root, boolean warnOnFileNotFound) {
Entry e = root.findEntry(myPath);
if (e == null) {
cannotRevert(myPath, warnOnFileNotFound);
return;
}
removeEntry(e);
}
Aggregations