本文整理汇总了Java中com.intellij.vcsUtil.VcsUtil.getVirtualFileWithRefresh方法的典型用法代码示例。如果您正苦于以下问题:Java VcsUtil.getVirtualFileWithRefresh方法的具体用法?Java VcsUtil.getVirtualFileWithRefresh怎么用?Java VcsUtil.getVirtualFileWithRefresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.vcsUtil.VcsUtil
的用法示例。
在下文中一共展示了VcsUtil.getVirtualFileWithRefresh方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setNewBase
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
public void setNewBase(final VirtualFile base) {
myBase = base;
myNewContentRevision = null;
myCurrentRevision = null;
myConflicts = null;
final String beforeName = myPatch.getBeforeName();
if (beforeName != null) {
myIoCurrentBase = PathMerger.getFile(new File(myBase.getPath()), beforeName);
myCurrentBase = myIoCurrentBase == null ? null : VcsUtil.getVirtualFileWithRefresh(myIoCurrentBase);
myBaseExists = (myCurrentBase != null) && myCurrentBase.exists();
}
else {
// creation
final String afterName = myPatch.getAfterName();
myBaseExists = true;
myIoCurrentBase = PathMerger.getFile(new File(myBase.getPath()), afterName);
myCurrentBase = VcsUtil.getVirtualFileWithRefresh(myIoCurrentBase);
}
}
示例2: findGitDir
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@Nullable
public static VirtualFile findGitDir(@NotNull VirtualFile rootDir) {
VirtualFile child = rootDir.findChild(DOT_GIT);
if (child == null) {
return null;
}
if (child.isDirectory()) {
return child;
}
// this is standard for submodules, although probably it can
String content;
try {
content = readFile(child);
}
catch (IOException e) {
throw new RuntimeException("Couldn't read " + child, e);
}
String pathToDir;
String prefix = "gitdir:";
if (content.startsWith(prefix)) {
pathToDir = content.substring(prefix.length()).trim();
}
else {
pathToDir = content;
}
if (!FileUtil.isAbsolute(pathToDir)) {
String canonicalPath = FileUtil.toCanonicalPath(FileUtil.join(rootDir.getPath(), pathToDir));
if (canonicalPath == null) {
return null;
}
pathToDir = FileUtil.toSystemIndependentName(canonicalPath);
}
return VcsUtil.getVirtualFileWithRefresh(new File(pathToDir));
}
示例3: testCyclicRename
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@Test
public void testCyclicRename() throws Exception {
List<TestCommit> commits = new ArrayList<TestCommit>();
File source = mkdir("source");
File initialFile = touch("source/PostHighlightingPass.java", "Initial content");
String initMessage = "Created PostHighlightingPass.java in source";
addCommit(initMessage);
String hash = last();
commits.add(new TestCommit(hash, initMessage, initialFile.getPath()));
String filePath = initialFile.getPath();
commits.add(modify(filePath));
TestCommit commit = move(filePath, mkdir("codeInside-impl"), "Moved from source to codeInside-impl");
filePath = commit.myPath;
commits.add(commit);
commits.add(modify(filePath));
commit = move(filePath, mkdir("codeInside"), "Moved from codeInside-impl to codeInside");
filePath = commit.myPath;
commits.add(commit);
commits.add(modify(filePath));
commit = move(filePath, mkdir("lang-impl"), "Moved from codeInside to lang-impl");
filePath = commit.myPath;
commits.add(commit);
commits.add(modify(filePath));
commit = move(filePath, source, "Moved from lang-impl back to source");
filePath = commit.myPath;
commits.add(commit);
commits.add(modify(filePath));
commit = move(filePath, mkdir("java"), "Moved from source to java");
filePath = commit.myPath;
commits.add(commit);
commits.add(modify(filePath));
Collections.reverse(commits);
VirtualFile vFile = VcsUtil.getVirtualFileWithRefresh(new File(filePath));
assertNotNull(vFile);
List<VcsFileRevision> history = GitHistoryUtils.history(myProject, VcsUtil.getFilePath(vFile));
assertEquals("History size doesn't match. Actual history: \n" + toReadable(history), commits.size(), history.size());
assertEquals("History is different.", toReadable(commits), toReadable(history));
}