本文整理汇总了Java中com.intellij.openapi.vfs.LocalFileSystem.findFileByPath方法的典型用法代码示例。如果您正苦于以下问题:Java LocalFileSystem.findFileByPath方法的具体用法?Java LocalFileSystem.findFileByPath怎么用?Java LocalFileSystem.findFileByPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vfs.LocalFileSystem
的用法示例。
在下文中一共展示了LocalFileSystem.findFileByPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFileSystemRoots
import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
private static VirtualFile[] getFileSystemRoots() {
final LocalFileSystem localFileSystem = LocalFileSystem.getInstance();
final Set<VirtualFile> roots = new HashSet<VirtualFile>();
final File[] ioRoots = File.listRoots();
if (ioRoots != null) {
for (final File root : ioRoots) {
final String path = FileUtil.toSystemIndependentName(root.getAbsolutePath());
final VirtualFile file = localFileSystem.findFileByPath(path);
if (file != null) {
roots.add(file);
}
}
}
return VfsUtilCore.toVirtualFileArray(roots);
}
示例2: getInitialFile
import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
@Nullable
@Override
protected VirtualFile getInitialFile() {
String dir = super.getComponentText();
if (!dir.isEmpty()) {
return super.getInitialFile();
}
LocalFileSystem fileSystem = LocalFileSystem.getInstance();
return myDefaultPath == null
? fileSystem.findFileByPath(toSystemIndependentName(PathManager.getHomePath()))
: fileSystem.findFileByPath(toSystemIndependentName(myDefaultPath));
}
示例3: getExistingModuleFiles
import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
@NotNull
public List<VirtualFile> getExistingModuleFiles() {
LocalFileSystem fs = LocalFileSystem.getInstance();
List<VirtualFile> result = new ArrayList<VirtualFile>();
Set<String> pathsInStack = getModulePaths();
for (String each : pathsInStack) {
VirtualFile f = fs.findFileByPath(each);
if (f != null) result.add(f);
}
return result;
}
示例4: convertToLocalVirtualFile
import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
/**
* Convert {@link VcsVirtualFile} to the {@link LocalFileSystem local} Virtual File.
*
* TODO
* It is a workaround for the following problem: VcsVirtualFiles returned from the {@link FileHistoryPanelImpl} contain the current path
* of the file, not the path that was in certain revision. This has to be fixed by making {@link HgFileRevision} implement
* {@link VcsFileRevisionEx}.
*/
@Nullable
public static VirtualFile convertToLocalVirtualFile(@Nullable VirtualFile file) {
if (!(file instanceof AbstractVcsVirtualFile)) {
return file;
}
LocalFileSystem lfs = LocalFileSystem.getInstance();
VirtualFile resultFile = lfs.findFileByPath(file.getPath());
if (resultFile == null) {
resultFile = lfs.refreshAndFindFileByPath(file.getPath());
}
return resultFile;
}