本文整理汇总了Java中com.intellij.openapi.vfs.VfsUtilCore.toVirtualFileArray方法的典型用法代码示例。如果您正苦于以下问题:Java VfsUtilCore.toVirtualFileArray方法的具体用法?Java VfsUtilCore.toVirtualFileArray怎么用?Java VfsUtilCore.toVirtualFileArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vfs.VfsUtilCore
的用法示例。
在下文中一共展示了VfsUtilCore.toVirtualFileArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: occursInPackagePrefixes
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@NotNull
@Override
public VirtualFile[] occursInPackagePrefixes(@NotNull PsiPackage psiPackage) {
List<VirtualFile> result = new ArrayList<VirtualFile>();
final Module[] modules = ModuleManager.getInstance(psiPackage.getProject()).getModules();
String qualifiedName = psiPackage.getQualifiedName();
for (final Module module : modules) {
for (final ContentEntry contentEntry : ModuleRootManager.getInstance(module).getContentEntries()) {
final List<SourceFolder> sourceFolders = contentEntry.getSourceFolders(JavaModuleSourceRootTypes.SOURCES);
for (final SourceFolder sourceFolder : sourceFolders) {
final String packagePrefix = sourceFolder.getPackagePrefix();
if (packagePrefix.startsWith(qualifiedName)) {
final VirtualFile file = sourceFolder.getFile();
if (file != null) {
result.add(file);
}
}
}
}
}
return VfsUtilCore.toVirtualFileArray(result);
}
示例2: getSelectedFiles
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
protected VirtualFile[] getSelectedFiles() {
final Change[] changes = getSelectedChanges();
Collection<VirtualFile> files = new HashSet<VirtualFile>();
for (Change change : changes) {
final ContentRevision afterRevision = change.getAfterRevision();
if (afterRevision != null) {
final VirtualFile file = afterRevision.getFile().getVirtualFile();
if (file != null && file.isValid()) {
files.add(file);
}
}
}
files.addAll(getSelectedVirtualFiles(null));
return VfsUtilCore.toVirtualFileArray(files);
}
示例3: getFiles
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的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);
}
示例4: collectAffectedFiles
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
/**
* given a list of action-target files, returns ALL the files that should be
* subject to the action Does not keep directories, but recursively adds
* directory contents
*
* @param project the project subject of the action
* @param files the root selection
* @return the complete set of files this action should apply to
*/
@NotNull
protected VirtualFile[] collectAffectedFiles(@NotNull Project project, @NotNull VirtualFile[] files) {
List<VirtualFile> affectedFiles = new ArrayList<VirtualFile>(files.length);
ProjectLevelVcsManager projectLevelVcsManager = ProjectLevelVcsManager.getInstance(project);
for (VirtualFile file : files) {
if (!file.isDirectory() && projectLevelVcsManager.getVcsFor(file) instanceof GitVcs) {
affectedFiles.add(file);
}
else if (file.isDirectory() && isRecursive()) {
addChildren(project, affectedFiles, file);
}
}
return VfsUtilCore.toVirtualFileArray(affectedFiles);
}
示例5: getFiles
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@Override
@NotNull
public VirtualFile[] getFiles(@NotNull OrderRootType rootType) {
checkDisposed();
VirtualFilePointerContainer container = myRoots.get(rootType);
if (container == null) {
return VirtualFile.EMPTY_ARRAY;
}
List<VirtualFile> expanded = new SmartList<VirtualFile>();
for (VirtualFile file : container.getFiles()) {
if (file.isDirectory()) {
if (myJarDirectories.contains(rootType, file.getUrl())) {
collectJarFiles(file, expanded, myJarDirectories.isRecursive(rootType, file.getUrl()));
continue;
}
}
expanded.add(file);
}
return VfsUtilCore.toVirtualFileArray(expanded);
}
示例6: getRoots
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@NotNull
@Override
public VirtualFile[] getRoots() {
if (myUsingCache) {
checkCanUseCache();
final OrderRootsCache cache = myOrderEnumerator.getCache();
if (cache != null) {
final int flags = myOrderEnumerator.getFlags();
final VirtualFile[] cached = cache.getCachedRoots(myRootType, flags);
if (cached == null) {
return cache.setCachedRoots(myRootType, flags, computeRootsUrls()).getFiles();
}
else {
return cached;
}
}
}
return VfsUtilCore.toVirtualFileArray(computeRoots());
}
示例7: getOrmLibSources
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@NotNull
public VirtualFile[] getOrmLibSources() {
final File libsDir = new File(myHomePath, "src/orm");
final File[] files = libsDir.listFiles();
List<VirtualFile> roots = new ArrayList<VirtualFile>();
if (files != null) {
for (File file : files) {
final String url = VfsUtil.getUrlForLibraryRoot(file);
final VirtualFile zipRoot = VirtualFileManager.getInstance().findFileByUrl(url);
if (zipRoot != null && zipRoot.isDirectory()) {
String fileName = file.getName();
final String srcDirName = StringUtil.trimEnd(fileName, "-src.zip");
final VirtualFile sourcesDir = zipRoot.findFileByRelativePath(srcDirName + "/src/java");
if (sourcesDir != null) {
roots.add(sourcesDir);
}
else {
roots.add(zipRoot);
}
}
}
}
return VfsUtilCore.toVirtualFileArray(roots);
}
示例8: getFilesFromChanges
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public static VirtualFile[] getFilesFromChanges(final Collection<Change> changes) {
ArrayList<VirtualFile> files = new ArrayList<VirtualFile>();
for (Change change : changes) {
final ContentRevision afterRevision = change.getAfterRevision();
if (afterRevision != null) {
FilePath filePath = afterRevision.getFile();
VirtualFile file = filePath.getVirtualFile();
if (file == null || !file.isValid()) {
file = LocalFileSystem.getInstance().refreshAndFindFileByPath(filePath.getPath());
}
if (file != null && file.isValid()) {
files.add(file);
}
}
}
return VfsUtilCore.toVirtualFileArray(files);
}
示例9: detect
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@Override
public MuleLibraryProperties detect(@NotNull List<VirtualFile> classesRoots) {
final VirtualFile[] libraryFiles = VfsUtilCore.toVirtualFileArray(classesRoots);
for (VirtualFile libraryFile : libraryFiles) {
final String muleHome = MuleSdk.getMuleHome(libraryFile.getCanonicalFile());
if(muleHome != null){
return new MuleLibraryProperties(new MuleSdk(muleHome));
}
}
return null;
}
示例10: filterLocalFiles
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
private static VirtualFile[] filterLocalFiles(VirtualFile[] fileArray) {
ArrayList<VirtualFile> result = new ArrayList<VirtualFile>();
for (VirtualFile virtualFile : fileArray) {
if (isLocal(virtualFile)) {
result.add(virtualFile);
}
}
return VfsUtilCore.toVirtualFileArray(result);
}
示例11: getAllResourceDirs
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@NotNull
@Override
public VirtualFile[] getAllResourceDirs() {
Set<VirtualFile> result = new HashSet<VirtualFile>();
collectResourceDirs(getFacet(), result, new HashSet<Module>());
return VfsUtilCore.toVirtualFileArray(result);
}
示例12: getFiles
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
static VirtualFile[] getFiles(DataContext dataContext) {
ArrayList<VirtualFile> filesList = ContainerUtil.newArrayList();
VirtualFile[] files = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext);
for (int i = 0; files != null && i < files.length; i++) {
VirtualFile file = files[i];
if (file.isInLocalFileSystem()) {
filesList.add(file);
}
}
return VfsUtilCore.toVirtualFileArray(filesList);
}
示例13: getExcludeFolderFiles
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@NotNull
@Override
public VirtualFile[] getExcludeFolderFiles() {
List<VirtualFile> excluded = new ArrayList<VirtualFile>();
for (JpsExcludeFolder folder : myExcludeFolders) {
ContainerUtil.addIfNotNull(excluded, folder.getFile());
}
for (DirectoryIndexExcludePolicy excludePolicy : Extensions.getExtensions(DirectoryIndexExcludePolicy.EP_NAME, myRootModel.getProject())) {
for (VirtualFilePointer pointer : excludePolicy.getExcludeRootsForModule(myRootModel)) {
ContainerUtil.addIfNotNull(excluded, pointer.getFile());
}
}
return VfsUtilCore.toVirtualFileArray(excluded);
}
示例14: getVirtualFiles
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@Override
@NotNull
public VirtualFile[] getVirtualFiles() {
List<VirtualFile> result = new ArrayList<VirtualFile>();
for (ProjectRoot root : myRoots) {
ContainerUtil.addAll(result, root.getVirtualFiles());
}
return VfsUtilCore.toVirtualFileArray(result);
}
示例15: getContentRoots
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@Override
@NotNull
public VirtualFile[] getContentRoots() {
final ArrayList<VirtualFile> result = new ArrayList<VirtualFile>();
for (ContentEntry contentEntry : getContent()) {
final VirtualFile file = contentEntry.getFile();
if (file != null) {
result.add(file);
}
}
return VfsUtilCore.toVirtualFileArray(result);
}