use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class RollbackProgressModifier method accept.
public void accept(final List<FilePath> paths) {
if (myIndicator != null) {
if (paths != null && (!paths.isEmpty())) {
for (FilePath path : paths) {
checkName(path.getPath());
}
myIndicator.setFraction(myCnt / myTotal);
myIndicator.setText2(VcsBundle.message("rolling.back.file", paths.get(0).getPath()));
}
}
}
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) {
final Boolean nonLocal = e.getData(VcsDataKeys.VCS_NON_LOCAL_HISTORY_SESSION);
if (Boolean.TRUE.equals(nonLocal))
return null;
VirtualFile file = e.getData(VcsDataKeys.VCS_VIRTUAL_FILE);
if (file == null || file.isDirectory())
return null;
FilePath filePath = e.getData(VcsDataKeys.FILE_PATH);
if (filePath == null || filePath.getFileType().isBinary())
return null;
return file;
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class GetVersionAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
FilePath filePath = e.getData(VcsDataKeys.FILE_PATH);
VcsFileRevision revision = e.getData(VcsDataKeys.VCS_FILE_REVISION);
if (e.getProject() == null || filePath == null || revision == null) {
e.getPresentation().setEnabledAndVisible(false);
} else {
e.getPresentation().setEnabledAndVisible(isContentAvailable(filePath, revision, e));
}
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class GetVersionAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getRequiredData(CommonDataKeys.PROJECT);
if (ChangeListManager.getInstance(project).isFreezedWithNotification(null))
return;
VcsFileRevision revision = e.getRequiredData(VcsDataKeys.VCS_FILE_REVISION);
FilePath filePath = e.getRequiredData(VcsDataKeys.FILE_PATH);
doGet(project, revision, filePath);
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class VcsLogUtil method collectRoots.
@NotNull
private static Set<VirtualFile> collectRoots(@NotNull Collection<FilePath> files, @NotNull Set<VirtualFile> roots) {
Set<VirtualFile> selectedRoots = new HashSet<>();
List<VirtualFile> sortedRoots = ContainerUtil.sorted(roots, Comparator.comparing(VirtualFile::getPath));
for (FilePath filePath : files) {
VirtualFile virtualFile = filePath.getVirtualFile();
if (virtualFile != null && roots.contains(virtualFile)) {
// if a root itself is selected, add this root
selectedRoots.add(virtualFile);
} else {
VirtualFile candidateAncestorRoot = null;
for (VirtualFile root : sortedRoots) {
if (FileUtil.isAncestor(VfsUtilCore.virtualToIoFile(root), filePath.getIOFile(), false)) {
candidateAncestorRoot = root;
}
}
if (candidateAncestorRoot != null) {
selectedRoots.add(candidateAncestorRoot);
}
}
// add all roots under selected path
if (virtualFile != null) {
for (VirtualFile root : roots) {
if (VfsUtilCore.isAncestor(virtualFile, root, false)) {
selectedRoots.add(root);
}
}
}
}
return selectedRoots;
}
Aggregations