本文整理汇总了Java中com.intellij.openapi.vfs.pointers.VirtualFilePointer.getFile方法的典型用法代码示例。如果您正苦于以下问题:Java VirtualFilePointer.getFile方法的具体用法?Java VirtualFilePointer.getFile怎么用?Java VirtualFilePointer.getFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vfs.pointers.VirtualFilePointer
的用法示例。
在下文中一共展示了VirtualFilePointer.getFile方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFiles
import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入方法依赖的package包/类
@NotNull
@Override
public VirtualFile[] getFiles(@NotNull OrderRootType rootType) {
final VirtualFilePointerContainer container = myRoots.get(rootType);
if (container == null) return VirtualFile.EMPTY_ARRAY;
final List<VirtualFile> expanded = new ArrayList<VirtualFile>();
for (JpsLibraryRoot root : myJpsLibrary.getRoots(getJpsRootType(rootType))) {
final VirtualFilePointer pointer = container.findByUrl(root.getUrl());
if (pointer == null) continue;
VirtualFile file = pointer.getFile();
if (file == null) continue;
if (file.isDirectory() && root.getInclusionOptions() != JpsLibraryRoot.InclusionOptions.ROOT_ITSELF) {
LibraryImpl.collectJarFiles(file, expanded, root.getInclusionOptions() == JpsLibraryRoot.InclusionOptions.ARCHIVES_UNDER_ROOT_RECURSIVELY);
continue;
}
expanded.add(file);
}
return VfsUtilCore.toVirtualFileArray(expanded);
}
示例2: acceptFilter
import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入方法依赖的package包/类
@Override
protected boolean acceptFilter(Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
try {
VirtualFilePointer filePointer = getFilePointer();
if (!filePointer.isValid()) {
return false;
}
VirtualFile file = filePointer.getFile();
if (file != null && file.isValid() && filter.first.contains(file, getProject(), filter.second)) {
applyFilter(true);
return true;
}
}
catch (Throwable e) {
// TODO: catch and ignore exceptions: see to FilePatternPackageSet
// sometimes for new file DirectoryFileIndex.getContentRootForFile() return random path
}
return false;
}
示例3: duplicate
import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入方法依赖的package包/类
@Override
@NotNull
public synchronized VirtualFilePointer duplicate(@NotNull VirtualFilePointer pointer,
@NotNull Disposable parent,
@Nullable VirtualFilePointerListener listener) {
VirtualFile file = pointer.getFile();
return file == null ? create(pointer.getUrl(), parent, listener) : create(file, parent, listener);
}
示例4: duplicate
import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入方法依赖的package包/类
@NotNull
@Override
public VirtualFilePointer duplicate(@NotNull VirtualFilePointer pointer,
@NotNull Disposable parent,
@Nullable VirtualFilePointerListener listener) {
return new IdentityVirtualFilePointer(pointer.getFile(), pointer.getUrl());
}
示例5: cacheThings
import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入方法依赖的package包/类
@NotNull
private Trinity<String[], VirtualFile[], VirtualFile[]> cacheThings() {
Trinity<String[], VirtualFile[], VirtualFile[]> result;
if (myList.isEmpty()) {
result = EMPTY;
}
else {
List<VirtualFile> cachedFiles = new ArrayList<VirtualFile>(myList.size());
List<String> cachedUrls = new ArrayList<String>(myList.size());
List<VirtualFile> cachedDirectories = new ArrayList<VirtualFile>(myList.size() / 3);
boolean allFilesAreDirs = true;
for (VirtualFilePointer v : myList) {
VirtualFile file = v.getFile();
String url = v.getUrl();
cachedUrls.add(url);
if (file != null) {
cachedFiles.add(file);
if (file.isDirectory()) {
cachedDirectories.add(file);
}
else {
allFilesAreDirs = false;
}
}
}
VirtualFile[] directories = VfsUtilCore.toVirtualFileArray(cachedDirectories);
VirtualFile[] files = allFilesAreDirs ? directories : VfsUtilCore.toVirtualFileArray(cachedFiles);
String[] urlsArray = ArrayUtil.toStringArray(cachedUrls);
result = Trinity.create(urlsArray, files, directories);
}
myCachedThings = result;
myTimeStampOfCachedThings = myVirtualFilePointerManager.getModificationCount();
return result;
}
示例6: isSettingsFile
import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入方法依赖的package包/类
private boolean isSettingsFile(String path) {
for (VirtualFilePointer each : mySettingsFilesPointers) {
VirtualFile f = each.getFile();
if (f != null && FileUtil.pathsEqual(path, f.getPath())) return true;
}
return false;
}
示例7: getAssociations
import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入方法依赖的package包/类
public Map<VirtualFile, VirtualFile[]> getAssociations() {
final HashMap<VirtualFile, VirtualFile[]> map = new LinkedHashMap<VirtualFile, VirtualFile[]>();
final Set<VirtualFilePointer> set = myAssociations.keySet();
for (VirtualFilePointer pointer : set) {
if (pointer.isValid()) {
final VirtualFile file = pointer.getFile();
map.put(file, myAssociations.get(pointer).getFiles());
}
}
return map;
}
示例8: verifyPointersInCorrectState
import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入方法依赖的package包/类
private static void verifyPointersInCorrectState(VirtualFilePointer[] pointers) {
for (VirtualFilePointer pointer : pointers) {
final VirtualFile file = pointer.getFile();
assertTrue(file == null || file.isValid());
}
}
示例9: getMappedFile
import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入方法依赖的package包/类
@Override
public VirtualFile getMappedFile(@NotNull PsiFile file) {
final VirtualFilePointer url = getMappedPointer(file);
return url != null ? url.getFile() : null;
}