本文整理汇总了Java中com.intellij.openapi.vcs.changes.Change.getVirtualFile方法的典型用法代码示例。如果您正苦于以下问题:Java Change.getVirtualFile方法的具体用法?Java Change.getVirtualFile怎么用?Java Change.getVirtualFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vcs.changes.Change
的用法示例。
在下文中一共展示了Change.getVirtualFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getChangedFiles
import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
@NotNull
public static List<PsiFile> getChangedFiles(@NotNull final Project project, @NotNull Collection<Change> changes) {
Function<Change, PsiFile> changeToPsiFileMapper = new Function<Change, PsiFile>() {
private PsiManager myPsiManager = PsiManager.getInstance(project);
@Override
public PsiFile fun(Change change) {
VirtualFile vFile = change.getVirtualFile();
return vFile != null ? myPsiManager.findFile(vFile) : null;
}
};
return ContainerUtil.mapNotNull(changes, changeToPsiFileMapper);
}
示例2: getChanges
import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
/**
* Marks the given files dirty in myDirtyScope, gets changes from myChangeProvider and groups the changes in the map.
* Assumes that only one change for a file has happened.
*/
protected Map<FilePath, Change> getChanges(VirtualFile... changedFiles) throws VcsException {
final List<FilePath> changedPaths = ObjectsConvertor.vf2fp(Arrays.asList(changedFiles));
// get changes
MockChangelistBuilder builder = new MockChangelistBuilder();
myChangeProvider.getChanges(myDirtyScope, builder, new EmptyProgressIndicator(), new MockChangeListManagerGate(ChangeListManager.getInstance(myProject)));
List<Change> changes = builder.getChanges();
// get changes for files
final Map<FilePath, Change> result = new HashMap<FilePath, Change>();
for (Change change : changes) {
VirtualFile file = change.getVirtualFile();
FilePath filePath = null;
if (file == null) { // if a file was deleted, just find the reference in the original list of files and use it.
String path = change.getBeforeRevision().getFile().getPath();
for (FilePath fp : changedPaths) {
if (FileUtil.pathsEqual(fp.getPath(), path)) {
filePath = fp;
break;
}
}
} else {
filePath = VcsUtil.getFilePath(file);
}
result.put(filePath, change);
}
return result;
}
示例3: matches
import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
private static boolean matches(@NotNull Change change, @NotNull VirtualFile file) {
VirtualFile virtualFile = change.getVirtualFile();
return virtualFile != null && virtualFile.equals(file) || seemsToBeMoved(change, file);
}