当前位置: 首页>>代码示例>>Java>>正文


Java LocalFileSystem.findFileByIoFile方法代码示例

本文整理汇总了Java中com.intellij.openapi.vfs.LocalFileSystem.findFileByIoFile方法的典型用法代码示例。如果您正苦于以下问题:Java LocalFileSystem.findFileByIoFile方法的具体用法?Java LocalFileSystem.findFileByIoFile怎么用?Java LocalFileSystem.findFileByIoFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.vfs.LocalFileSystem的用法示例。


在下文中一共展示了LocalFileSystem.findFileByIoFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeAllFiles

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
@Override
public void removeAllFiles(@NotNull final Collection<File> files) throws IOException {
    Validate.notNull(files);

    if (files.isEmpty()) {
        return;
    }

    final LocalFileSystem localFileSystem = LocalFileSystem.getInstance();

    for (File file : files) {
        final VirtualFile virtualFile = localFileSystem.findFileByIoFile(file);

        if (null != virtualFile) {
            ApplicationManager.getApplication().runWriteAction(new RemoveFileComputable(virtualFile));
        } else {
            FileUtil.delete(file);
        }
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:DefaultVirtualFileSystemService.java

示例2: processCheckedOutDirectory

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
@Override
public boolean processCheckedOutDirectory(Project project, File directory) {
  final File[] files = directory.listFiles();
  if (files != null) {
    final LocalFileSystem localFileSystem = LocalFileSystem.getInstance();
    for (File file : files) {
      if (file.isDirectory()) continue;
      final VirtualFile virtualFile = localFileSystem.findFileByIoFile(file);
      if (virtualFile != null) {
        final ProjectOpenProcessor openProcessor = ProjectOpenProcessor.getImportProvider(virtualFile);
        if (openProcessor != null) {
          int rc = Messages
            .showYesNoDialog(project, VcsBundle.message("checkout.open.project.prompt", ProjectCheckoutListener.getProductNameWithArticle(), file.getPath()),
                             VcsBundle.message("checkout.title"), Messages.getQuestionIcon());
          if (rc == Messages.YES) {
            openProcessor.doOpenProject(virtualFile, project, false);
          }
          return true;
        }
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ProjectImporterCheckoutListener.java

示例3: createFromTempFile

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
public static FileContent createFromTempFile(Project project, String name, String ext, @NotNull byte[] content) throws IOException {
  File tempFile = FileUtil.createTempFile(name, "." + ext);
  if (content.length != 0) {
    FileUtil.writeToFile(tempFile, content);
  }
  tempFile.deleteOnExit();
  final LocalFileSystem lfs = LocalFileSystem.getInstance();
  VirtualFile file = lfs.findFileByIoFile(tempFile);
  if (file == null) {
    file = lfs.refreshAndFindFileByIoFile(tempFile);
  }
  if (file != null) {
    return new FileContent(project, file);
  }
  throw new IOException("Can not create temp file for revision content");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:FileContent.java

示例4: findValidParent

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
/**
 * @deprecated use {@link #findValidParentAccurately(com.intellij.openapi.vcs.FilePath)}
 */
@Nullable
@Deprecated
public static VirtualFile findValidParent(FilePath file) {
  ApplicationManager.getApplication().assertReadAccessAllowed();
  VirtualFile parent = file.getVirtualFile();
  if (parent == null) {
    parent = file.getVirtualFileParent();
  }
  if (parent == null) {
    File ioFile = file.getIOFile();
    final LocalFileSystem lfs = LocalFileSystem.getInstance();
    do {
      parent = lfs.findFileByIoFile(ioFile);
      if (parent != null) break;
      ioFile = ioFile.getParentFile();
      if (ioFile == null) return null;
    }
    while (true);
  }
  return parent;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ChangesUtil.java

示例5: addItemsFromSourceSet

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
private static void addItemsFromSourceSet(@Nullable String flavor,
                                          int mask,
                                          int rank,
                                          @NotNull SourceProvider sourceProvider,
                                          @NotNull ResourceType type,
                                          @NotNull String name,
                                          @NotNull List<ItemInfo> results,
                                          @NotNull AndroidFacet facet) {
  Collection<File> resDirectories = sourceProvider.getResDirectories();
  LocalFileSystem fileSystem = LocalFileSystem.getInstance();
  for (File dir : resDirectories) {
    VirtualFile virtualFile = fileSystem.findFileByIoFile(dir);
    if (virtualFile != null) {
      ResourceFolderRepository resources = ResourceFolderRegistry.get(facet,  virtualFile);
      addItemsFromRepository(flavor, mask, rank, resources, type, name, results);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AndroidJavaDocRenderer.java

示例6: doCheckout

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
public void doCheckout(@NotNull final Project project, @Nullable final Listener listener, @Nullable String predefinedRepositoryUrl) {
  BasicAction.saveAll();
  GitCloneDialog dialog = new GitCloneDialog(project, predefinedRepositoryUrl);
  if (!dialog.showAndGet()) {
    return;
  }
  dialog.rememberSettings();
  final LocalFileSystem lfs = LocalFileSystem.getInstance();
  final File parent = new File(dialog.getParentDirectory());
  VirtualFile destinationParent = lfs.findFileByIoFile(parent);
  if (destinationParent == null) {
    destinationParent = lfs.refreshAndFindFileByIoFile(parent);
  }
  if (destinationParent == null) {
    return;
  }
  final String sourceRepositoryURL = dialog.getSourceRepositoryURL();
  final String directoryName = dialog.getDirectoryName();
  final String parentDirectory = dialog.getParentDirectory();
  clone(project, myGit, listener, destinationParent, sourceRepositoryURL, directoryName, parentDirectory);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GitCheckoutProvider.java

示例7: fillMapping

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
private void fillMapping(final SvnMapping mapping, final List<SvnCopyRootSimple> list) {
  final LocalFileSystem lfs = LocalFileSystem.getInstance();

  for (SvnCopyRootSimple simple : list) {
    final VirtualFile copyRoot = lfs.findFileByIoFile(new File(simple.myCopyRoot));
    final VirtualFile vcsRoot = lfs.findFileByIoFile(new File(simple.myVcsRoot));

    if (copyRoot == null || vcsRoot == null) continue;

    final SvnVcs vcs = SvnVcs.getInstance(myProject);
    final Info svnInfo = vcs.getInfo(copyRoot);
    if ((svnInfo == null) || (svnInfo.getRepositoryRootURL() == null)) continue;

    Node node = new Node(copyRoot, svnInfo.getURL(), svnInfo.getRepositoryRootURL());
    final RootUrlInfo info = new RootUrlInfo(node, SvnFormatSelector.findRootAndGetFormat(svnInfo.getFile()), vcsRoot);

    mapping.add(info);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:SvnFileUrlMappingImpl.java

示例8: refreshOutputDirectories

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
public static void refreshOutputDirectories(Collection<File> outputs, boolean async) {
  LocalFileSystem fileSystem = LocalFileSystem.getInstance();
  List<VirtualFile> toRefresh = new ArrayList<VirtualFile>();

  int newDirectories = 0;
  for (File ioOutput : outputs) {
    VirtualFile output = fileSystem.findFileByIoFile(ioOutput);
    if (output != null) {
      toRefresh.add(output);
    }
    else if (ioOutput.exists()) {
      VirtualFile parent = fileSystem.refreshAndFindFileByIoFile(ioOutput.getParentFile());
      if (parent != null) {
        parent.getChildren();
        toRefresh.add(parent);
        newDirectories++;
      }
    }
  }
  if (newDirectories > 10) {
    LOG.info(newDirectories + " new output directories were created, refreshing their parents together to avoid too many rootsChange events");
    RefreshQueue.getInstance().refresh(async, false, null, toRefresh);
  }
  else {
    LOG.debug("Refreshing " + outputs.size() + " outputs");
    fileSystem.refreshIoFiles(outputs, async, false, null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:CompilerUtil.java

示例9: findValidParentAccurately

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
@Nullable
public static VirtualFile findValidParentAccurately(final FilePath filePath) {
  if (filePath.getVirtualFile() != null) return filePath.getVirtualFile();
  final LocalFileSystem lfs = LocalFileSystem.getInstance();
  VirtualFile result = lfs.findFileByIoFile(filePath.getIOFile());
  if (result != null) return result;
  if (! ApplicationManager.getApplication().isReadAccessAllowed()) {
    result = lfs.refreshAndFindFileByIoFile(filePath.getIOFile());
    if (result != null) return result;
  }
  return getValidParentUnderReadAction(filePath);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ChangesUtil.java

示例10: findFirstValidVirtualParent

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
@Nullable
private static VirtualFile findFirstValidVirtualParent(@Nullable File file) {
  LocalFileSystem lfs = LocalFileSystem.getInstance();
  VirtualFile vf = null;
  while (file != null && (vf == null || !vf.isValid())) {
    vf = lfs.findFileByIoFile(file);
    file = file.getParentFile();
  }
  return vf == null || !vf.isValid() ? null : vf;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:RefreshVFsSynchronously.java

示例11: FileGroupingProjectNode

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
public FileGroupingProjectNode(Project project, File file, ViewSettings viewSettings) {
  super(project, file, viewSettings);
  final LocalFileSystem lfs = LocalFileSystem.getInstance();
  myVirtualFile = lfs.findFileByIoFile(file);
  if (myVirtualFile == null) {
    myVirtualFile = lfs.refreshAndFindFileByIoFile(file);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FileGroupingProjectNode.java

示例12: convertFileSet

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
/** Convert a set of IO files into a set of equivalent virtual files */
private static Collection<VirtualFile> convertFileSet(@NotNull Collection<File> fileSet) {
  Collection<VirtualFile> result = Sets.newHashSetWithExpectedSize(fileSet.size());
  LocalFileSystem fileSystem = LocalFileSystem.getInstance();
  for (File file : fileSet) {
    VirtualFile virtualFile = fileSystem.findFileByIoFile(file);
    if (virtualFile != null) {
      result.add(virtualFile);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:IdeaSourceProvider.java

示例13: testTemplateFormatting

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
public void testTemplateFormatting() throws Exception {
  Template template = Template.createFromPath(new File(getTestDataPath(), FileUtil.join("templates", "TestTemplate")));
  template.render(new File(myFixture.getTempDirPath()), new File("dummy"),
                  Maps.<String, Object>newHashMap(), myFixture.getProject());
  FileDocumentManager.getInstance().saveAllDocuments();
  LocalFileSystem fileSystem = LocalFileSystem.getInstance();
  VirtualFile desired = fileSystem.findFileByIoFile(new File(getTestDataPath(),
                                                             FileUtil.join("templates", "TestTemplate", "MergedStringsFile.xml")));
  VirtualFile actual = fileSystem.findFileByIoFile(new File(myFixture.getTempDirPath(),
                                                            FileUtil.join("values", "TestTargetResourceFile.xml")));
  desired.refresh(false, false);
  actual.refresh(false, false);
  PlatformTestUtil.assertFilesEqual(desired, actual);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:TemplateTest.java

示例14: appendNestedVcsRootsToDirt

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
public static void appendNestedVcsRootsToDirt(final VcsDirtyScope dirtyScope, GitVcs vcs, final ProjectLevelVcsManager vcsManager) {
  final Set<FilePath> recursivelyDirtyDirectories = dirtyScope.getRecursivelyDirtyDirectories();
  if (recursivelyDirtyDirectories.isEmpty()) {
    return;
  }

  final LocalFileSystem lfs = LocalFileSystem.getInstance();
  final Set<VirtualFile> rootsUnderGit = new HashSet<VirtualFile>(Arrays.asList(vcsManager.getRootsUnderVcs(vcs)));
  final Set<VirtualFile> inputColl = new HashSet<VirtualFile>(rootsUnderGit);
  final Set<VirtualFile> existingInScope = new HashSet<VirtualFile>();
  for (FilePath dir : recursivelyDirtyDirectories) {
    VirtualFile vf = dir.getVirtualFile();
    if (vf == null) {
      vf = lfs.findFileByIoFile(dir.getIOFile());
    }
    if (vf == null) {
      vf = lfs.refreshAndFindFileByIoFile(dir.getIOFile());
    }
    if (vf != null) {
      existingInScope.add(vf);
    }
  }
  inputColl.addAll(existingInScope);
  FileUtil.removeAncestors(inputColl, new Convertor<VirtualFile, String>() {
                             @Override
                             public String convert(VirtualFile o) {
                               return o.getPath();
                             }
                           }, new PairProcessor<VirtualFile, VirtualFile>() {
                             @Override
                             public boolean process(VirtualFile parent, VirtualFile child) {
                               if (! existingInScope.contains(child) && existingInScope.contains(parent)) {
                                 debug("adding git root for check: " + child.getPath());
                                 ((VcsModifiableDirtyScope)dirtyScope).addDirtyDirRecursively(VcsUtil.getFilePath(child));
                               }
                               return true;
                             }
                           }
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:GitChangeProvider.java

示例15: crawlWCRoots

import com.intellij.openapi.vfs.LocalFileSystem; //导入方法依赖的package包/类
public static Collection<VirtualFile> crawlWCRoots(final Project project, File path, SvnWCRootCrawler callback, ProgressIndicator progress) {
  final LocalFileSystem lfs = LocalFileSystem.getInstance();
  VirtualFile vf = lfs.findFileByIoFile(path);
  if (vf == null) {
    vf = lfs.refreshAndFindFileByIoFile(path);
  }
  if (vf == null) return Collections.emptyList();
  return crawlWCRoots(project, vf, callback, progress);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SvnUtil.java


注:本文中的com.intellij.openapi.vfs.LocalFileSystem.findFileByIoFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。