Java源码示例:com.intellij.openapi.vcs.changes.FilePathsHelper
示例1
public void clearCurrent(Set<String> paths) {
final HashSet<String> converted = new HashSet<>();
for (String path : paths) {
converted.add(FilePathsHelper.convertPath(path));
}
synchronized (myLock) {
final Set<CurrentKey> toRemove = new HashSet<>();
myCurrentRevisionsCache.iterateKeys(new Consumer<CurrentKey>() {
@Override
public void consume(CurrentKey currentKey) {
if (converted.contains(FilePathsHelper.convertPath(currentKey.getPath().getPath()))) {
toRemove.add(currentKey);
}
}
});
for (CurrentKey key : toRemove) {
myCurrentRevisionsCache.remove(key);
}
}
}
示例2
@Override
public void consumeContentBeforePatchApplied(@Nonnull String path,
@Nonnull CharSequence content,
CommitContext commitContext) {
if (commitContext == null) return;
Map<String, String> map = commitContext.getUserData(ourName);
if (map == null) {
map = new HashMap<String, String>();
commitContext.putUserData(ourName, map);
}
final File file = new File(myBaseDir, path);
map.put(FilePathsHelper.convertPath(file.getPath()), content.toString());
}
示例3
public static String getCharset(final String path, final CommitContext commitContext) {
if (commitContext == null) return null;
final Map<String, String> userData = commitContext.getUserData(ourName);
return userData == null ? null : userData.get(FilePathsHelper.convertPath(path));
}
示例4
@Override
public int compare(DiffRequestProducer o1, DiffRequestProducer o2) {
return FilePathsHelper.convertPath(o1.getName()).compareTo(FilePathsHelper.convertPath(o2.getName()));
}
示例5
public StaticFilePath(boolean isDirectory, String path, VirtualFile vf) {
myIsDirectory = isDirectory;
myPath = path;
myVf = vf;
myKey = FilePathsHelper.convertPath(path);
}