use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class AnnotateRevisionAction method getFile.
@Nullable
@Override
protected VirtualFile getFile(@NotNull AnActionEvent e) {
VcsFileRevision revision = getFileRevision(e);
if (revision == null)
return null;
final FileType currentFileType = myAnnotation.getFile().getFileType();
FilePath filePath = (revision instanceof VcsFileRevisionEx ? ((VcsFileRevisionEx) revision).getPath() : VcsUtil.getFilePath(myAnnotation.getFile()));
return new VcsVirtualFile(filePath.getPath(), revision, VcsFileSystem.getInstance()) {
@NotNull
@Override
public FileType getFileType() {
FileType type = super.getFileType();
if (!type.isBinary())
return type;
if (!currentFileType.isBinary())
return currentFileType;
return PlainTextFileType.INSTANCE;
}
};
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class Change method equals.
public boolean equals(final Object o) {
if (this == o)
return true;
if (o == null || (!(o instanceof Change)))
return false;
final Change otherChange = ((Change) o);
final ContentRevision br1 = getBeforeRevision();
final ContentRevision br2 = otherChange.getBeforeRevision();
final ContentRevision ar1 = getAfterRevision();
final ContentRevision ar2 = otherChange.getAfterRevision();
FilePath fbr1 = br1 != null ? br1.getFile() : null;
FilePath fbr2 = br2 != null ? br2.getFile() : null;
FilePath far1 = ar1 != null ? ar1.getFile() : null;
FilePath far2 = ar2 != null ? ar2.getFile() : null;
return Comparing.equal(fbr1, fbr2) && Comparing.equal(far1, far2);
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class ExternallyRenamedChange method setRenamedOrMovedTarget.
public void setRenamedOrMovedTarget(final FilePath target) {
myMoved = myRenamed = false;
if ((getBeforeRevision() != null) || (getAfterRevision() == null)) {
// not external rename or move
return;
}
final FilePath localPath = ChangesUtil.getFilePath(this);
if (localPath.getPath().equals(target.getPath())) {
// not rename or move
return;
}
if (Comparing.equal(target.getParentPath(), localPath.getParentPath())) {
myRenamed = true;
} else {
myMoved = true;
}
myCopied = false;
myRenamedTargetName = target.getName();
myRenameOrMoveCached = true;
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class ApplyPatchContext method registerBeforeRename.
public void registerBeforeRename(final VirtualFile file) {
FilePath path = VcsUtil.getFilePath(file);
myPathsBeforeRename.put(file, path);
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class IdeaTextPatchBuilder method convertRevisionToAir.
@Nullable
private static AirContentRevision convertRevisionToAir(final ContentRevision cr, final Long ts) {
if (cr == null)
return null;
final FilePath fp = cr.getFile();
final StaticPathDescription description = new StaticPathDescription(fp.isDirectory(), ts == null ? fp.getIOFile().lastModified() : ts, fp.getPath());
if (cr instanceof BinaryContentRevision) {
return new BinaryAirContentRevision((BinaryContentRevision) cr, description, ts);
} else {
return new TextAirContentRevision(cr, description, ts);
}
}
Aggregations