Java Code Examples for com.intellij.openapi.vcs.FilePath#getName()
The following examples show how to use
com.intellij.openapi.vcs.FilePath#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RemoteFileUtil.java From p4ic4idea with Apache License 2.0 | 6 votes |
private static List<String> splitFilePaths(final FilePath filePath) { File[] roots = File.listRoots(); List<String> revRet = new ArrayList<>(); FilePath next = filePath; while (next != null) { String name = next.getName(); if (name.length() == 0) { name = next.getIOFile().getAbsolutePath(); while (name.endsWith(File.separator)) { name = name.substring(0, name.length() - File.separator.length()); } } revRet.add(name); if (isRoot(next, roots)) { next = null; } else { next = next.getParentPath(); } } Collections.reverse(revRet); return revRet; }
Example 2
Source File: DiffRequestFactoryImpl.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull public static String getTitle(@Nonnull FilePath path1, @Nonnull FilePath path2, @Nonnull String separator) { if ((path1.isDirectory() || path2.isDirectory()) && path1.getPath().equals(path2.getPath())) { return path1.getPresentableUrl(); } String name1 = path1.getName(); String name2 = path2.getName(); if (path1.isDirectory() ^ path2.isDirectory()) { if (path1.isDirectory()) name1 += File.separatorChar; if (path2.isDirectory()) name2 += File.separatorChar; } FilePath parent1 = path1.getParentPath(); FilePath parent2 = path2.getParentPath(); return getRequestTitle(name1, path1.getPresentableUrl(), parent1 != null ? parent1.getPresentableUrl() : null, name2, path2.getPresentableUrl(), parent2 != null ? parent2.getPresentableUrl() : null, separator); }
Example 3
Source File: ExternallyRenamedChange.java From consulo with Apache License 2.0 | 6 votes |
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.getIOFile().getAbsolutePath().equals(target.getIOFile().getAbsolutePath())) { // not rename or move return; } if (Comparing.equal(target.getParentPath(), localPath.getParentPath())) { myRenamed = true; } else { myMoved = true; } myCopied = false; myRenamedTargetName = target.getName(); myRenameOrMoveCached = true; }
Example 4
Source File: TFSContentRevision.java From azure-devops-intellij with MIT License | 5 votes |
public static TFSContentRevision create(final Project project, final @NotNull FilePath localPath, final int changeset, final String modificationDate) { return new TFSContentRevision(project) { public int getChangeset() { return changeset; } @NotNull public FilePath getFile() { return localPath; } protected String getFilePath() { return localPath.getPath(); } public String getModificationDate() { return modificationDate; } @NotNull public VcsRevisionNumber getRevisionNumber() { return new TfsRevisionNumber(changeset, localPath.getName(), modificationDate); } }; }
Example 5
Source File: TFSContentRevision.java From azure-devops-intellij with MIT License | 5 votes |
/** * Creates a revision especially for a renamed file since the original path is needed to display where the file * used to reside while the server path is needed to pull down that version of the file from the server for diffs * * @param project * @param orignalPath: path of the file before it was renamed * @param changeset * @param modificationDate * @param serverPath: path of the file on the server * @return */ public static TFSContentRevision createRenameRevision(final Project project, final @NotNull FilePath orignalPath, final int changeset, final String modificationDate, final String serverPath) { return new TFSContentRevision(project) { public int getChangeset() { return changeset; } @NotNull public FilePath getFile() { return orignalPath; } protected String getFilePath() { return serverPath; } public String getModificationDate() { return modificationDate; } @NotNull public VcsRevisionNumber getRevisionNumber() { return new TfsRevisionNumber(changeset, orignalPath.getName(), modificationDate); } }; }
Example 6
Source File: VirtualFileListCellRenderer.java From consulo with Apache License 2.0 | 4 votes |
protected String getName(FilePath path) { return path.getName(); }