public class VcsUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MAX_VCS_LOADED_SIZE_KB |
protected static char[] |
ourCharsToBeChopped |
Constructor and Description |
---|
VcsUtil() |
Modifier and Type | Method and Description |
---|---|
static java.util.List<VcsDirectoryMapping> |
addMapping(java.util.List<? extends VcsDirectoryMapping> existingMappings,
java.lang.String path,
java.lang.String vcs) |
static java.lang.String |
chopTrailingChars(java.lang.String source,
char[] chars) |
static <T> T |
computeWithModalProgress(Project project,
java.lang.String title,
boolean canBeCancelled,
ThrowableConvertor<? super ProgressIndicator,T,? extends VcsException> computable) |
static AbstractVcs |
findVcs(AnActionEvent e) |
static AbstractVcs |
findVcsByKey(Project project,
VcsKey key) |
static java.lang.String |
getCanonicalLocalPath(java.lang.String localPath) |
static java.lang.String |
getCanonicalPath(java.io.File file) |
static java.lang.String |
getCanonicalPath(java.lang.String path) |
static byte [] |
getFileByteContent(java.io.File file) |
static java.lang.String |
getFileContent(java.lang.String path) |
static FilePath |
getFilePath(java.io.File file) |
static FilePath |
getFilePath(java.io.File file,
boolean isDirectory) |
static FilePath |
getFilePath(java.lang.String path) |
static FilePath |
getFilePath(java.lang.String path,
boolean isDirectory) |
static FilePath |
getFilePath(VirtualFile file) |
static FilePath |
getFilePath(VirtualFile parent,
java.lang.String name) |
static FilePath |
getFilePath(VirtualFile parent,
java.lang.String fileName,
boolean isDirectory) |
static FilePath |
getFilePathForDeletedFile(java.lang.String path,
boolean isDirectory)
Deprecated.
|
static FilePath |
getFilePathOnNonLocal(java.lang.String path,
boolean isDirectory) |
static FilePath |
getLastCommitPath(Project project,
FilePath path) |
static int |
getMaxVcsLoadedFileSize() |
static VirtualFile |
getOneVirtualFile(AnActionEvent e) |
static java.lang.String |
getPathForProgressPresentation(java.io.File file) |
static java.lang.String |
getShortRevisionString(VcsRevisionNumber revision) |
static AbstractVcs |
getVcsFor(Project project,
FilePath filePath) |
static AbstractVcs |
getVcsFor(Project project,
VirtualFile file) |
static java.util.Set<java.lang.String> |
getVcsIgnoreFileNames(Project project) |
static VirtualFile |
getVcsRootFor(Project project,
FilePath filePath) |
static VirtualFile |
getVcsRootFor(Project project,
VirtualFile file) |
static VirtualFile |
getVirtualFile(java.io.File file) |
static VirtualFile |
getVirtualFile(java.lang.String path) |
static VirtualFile [] |
getVirtualFiles(AnActionEvent e) |
static VirtualFile |
getVirtualFileWithRefresh(java.io.File file) |
static <T> java.util.Map<VcsRoot,java.util.List<T>> |
groupByRoots(Project project,
java.util.Collection<? extends T> items,
boolean putNonVcs,
Function<? super T,? extends FilePath> filePathMapper) |
static <T> java.util.Map<VcsRoot,java.util.List<T>> |
groupByRoots(Project project,
java.util.Collection<? extends T> items,
Function<? super T,? extends FilePath> filePathMapper) |
static boolean |
isAspectAvailableByDefault(java.lang.String id) |
static boolean |
isAspectAvailableByDefault(java.lang.String id,
boolean defaultValue) |
static boolean |
isChangeForDeleted(Change change) |
static boolean |
isChangeForFolder(Change change) |
static boolean |
isChangeForNew(Change change) |
static boolean |
isFileForVcs(FilePath path,
Project project,
AbstractVcs host) |
static boolean |
isFileForVcs(java.lang.String path,
Project project,
AbstractVcs host) |
static boolean |
isFileForVcs(VirtualFile file,
Project project,
AbstractVcs host)
File is considered to be a valid vcs file if it resides under the content
root controlled by the given vcs.
|
static boolean |
isFileUnderVcs(Project project,
FilePath file) |
static boolean |
isFileUnderVcs(Project project,
java.lang.String file) |
static boolean |
isPathRemote(java.lang.String path) |
static boolean |
isRenameChange(Change change) |
static void |
markFileAsDirty(Project project,
FilePath path)
Deprecated.
use the
VcsDirtyScopeManager directly. |
static void |
markFileAsDirty(Project project,
java.lang.String path) |
static void |
markFileAsDirty(Project project,
VirtualFile file)
Deprecated.
use the
VcsDirtyScopeManager directly. |
static VirtualFile[] |
paths2VFiles(java.lang.String[] paths) |
static void |
refreshFiles(Project project,
java.util.HashSet<? extends FilePath> paths)
Deprecated.
use the
VcsDirtyScopeManager directly. |
static boolean |
runVcsProcessWithProgress(VcsRunnable runnable,
java.lang.String progressTitle,
boolean canBeCanceled,
Project project)
Deprecated.
Use
ProgressManager.runProcessWithProgressSynchronously(ThrowableComputable, String, boolean, Project)
and other run methods from the ProgressManager. |
static void |
setAspectAvailability(java.lang.String aspectID,
boolean showByDefault) |
static void |
showStatusMessage(Project project,
java.lang.String message)
Deprecated.
use
StatusBar.Info#set(String, Project) directly. |
static FilePath[] |
sortPathsFromOutermost(FilePath[] files)
Sort file paths so that paths under the same root are placed from the
outermost to the innermost (farthest from the root).
|
static java.lang.String |
trimCommitMessageToSaneSize(java.lang.String message) |
static VirtualFile |
waitForTheFile(java.lang.String path)
Deprecated.
|
protected static final char[] ourCharsToBeChopped
public static final java.lang.String MAX_VCS_LOADED_SIZE_KB
public static int getMaxVcsLoadedFileSize()
@Deprecated public static void markFileAsDirty(Project project, VirtualFile file)
VcsDirtyScopeManager
directly.@Deprecated public static void markFileAsDirty(Project project, FilePath path)
VcsDirtyScopeManager
directly.public static void markFileAsDirty(Project project, java.lang.String path)
@Deprecated public static void refreshFiles(Project project, java.util.HashSet<? extends FilePath> paths)
VcsDirtyScopeManager
directly.public static boolean isFileUnderVcs(Project project, java.lang.String file)
project
- Project componentfile
- File to checkpublic static boolean isFileForVcs(VirtualFile file, Project project, AbstractVcs host)
public static boolean isFileForVcs(FilePath path, Project project, AbstractVcs host)
public static boolean isFileForVcs(java.lang.String path, Project project, AbstractVcs host)
public static AbstractVcs getVcsFor(Project project, FilePath filePath)
public static AbstractVcs getVcsFor(Project project, VirtualFile file)
public static AbstractVcs findVcsByKey(Project project, VcsKey key)
public static AbstractVcs findVcs(AnActionEvent e)
public static VirtualFile getVcsRootFor(Project project, FilePath filePath)
public static VirtualFile getVcsRootFor(Project project, VirtualFile file)
public static VirtualFile getVirtualFile(java.lang.String path)
public static VirtualFile getVirtualFile(java.io.File file)
public static VirtualFile getVirtualFileWithRefresh(java.io.File file)
public static java.lang.String getFileContent(java.lang.String path)
public static byte [] getFileByteContent(java.io.File file)
public static FilePath getFilePath(java.lang.String path)
public static FilePath getFilePath(VirtualFile file)
public static FilePath getFilePath(java.io.File file)
public static FilePath getFilePath(java.lang.String path, boolean isDirectory)
public static FilePath getFilePathOnNonLocal(java.lang.String path, boolean isDirectory)
public static FilePath getFilePath(java.io.File file, boolean isDirectory)
@Deprecated public static FilePath getFilePathForDeletedFile(java.lang.String path, boolean isDirectory)
getFilePath(String, boolean)
public static FilePath getFilePath(VirtualFile parent, java.lang.String name)
public static FilePath getFilePath(VirtualFile parent, java.lang.String fileName, boolean isDirectory)
@Deprecated public static void showStatusMessage(Project project, java.lang.String message)
StatusBar.Info#set(String, Project)
directly.public static boolean isRenameChange(Change change)
change
- "Change" description.public static boolean isChangeForNew(Change change)
change
- "Change" description.public static boolean isChangeForDeleted(Change change)
change
- "Change" description.public static boolean isChangeForFolder(Change change)
public static FilePath[] sortPathsFromOutermost(FilePath[] files)
files
- An array of file paths to be sorted. Sorting is done over the parameter.public static VirtualFile getOneVirtualFile(AnActionEvent e)
e
- ActionEvent objectVirtualFile
available in the current context.
Returns not null
if and only if exactly one file is available.public static VirtualFile [] getVirtualFiles(AnActionEvent e)
e
- ActionEvent objectVirtualFile
s available in the current context.
Returns empty array if there are no available files.@Deprecated public static boolean runVcsProcessWithProgress(VcsRunnable runnable, java.lang.String progressTitle, boolean canBeCanceled, Project project) throws VcsException
ProgressManager.runProcessWithProgressSynchronously(ThrowableComputable, String, boolean, Project)
and other run methods from the ProgressManager.VcsException
public static <T> T computeWithModalProgress(Project project, java.lang.String title, boolean canBeCancelled, ThrowableConvertor<? super ProgressIndicator,T,? extends VcsException> computable) throws VcsException
VcsException
@Deprecated public static VirtualFile waitForTheFile(java.lang.String path)
public static java.lang.String getCanonicalLocalPath(java.lang.String localPath)
public static java.lang.String getCanonicalPath(java.lang.String path)
public static java.lang.String getCanonicalPath(java.io.File file)
public static java.lang.String chopTrailingChars(java.lang.String source, char[] chars)
source
- Source stringchars
- Symbols to be trimmedchopTrailingChars("c:\\my_directory\\//\\",new char[]{'\\'}) is "c:\\my_directory\\//"
,
chopTrailingChars("c:\\my_directory\\//\\",new char[]{'\\','/'}) is "c:\my_directory"
.
Actually this method can be used to normalize file names to chop trailing separator chars.
public static java.lang.String getShortRevisionString(VcsRevisionNumber revision)
public static VirtualFile[] paths2VFiles(java.lang.String[] paths)
public static boolean isAspectAvailableByDefault(java.lang.String id)
public static boolean isAspectAvailableByDefault(java.lang.String id, boolean defaultValue)
public static void setAspectAvailability(java.lang.String aspectID, boolean showByDefault)
public static boolean isPathRemote(java.lang.String path)
public static java.lang.String getPathForProgressPresentation(java.io.File file)
public static <T> java.util.Map<VcsRoot,java.util.List<T>> groupByRoots(Project project, java.util.Collection<? extends T> items, Function<? super T,? extends FilePath> filePathMapper)
public static <T> java.util.Map<VcsRoot,java.util.List<T>> groupByRoots(Project project, java.util.Collection<? extends T> items, boolean putNonVcs, Function<? super T,? extends FilePath> filePathMapper)
public static java.util.List<VcsDirectoryMapping> addMapping(java.util.List<? extends VcsDirectoryMapping> existingMappings, java.lang.String path, java.lang.String vcs)
public static java.util.Set<java.lang.String> getVcsIgnoreFileNames(Project project)
public static java.lang.String trimCommitMessageToSaneSize(java.lang.String message)