Package com.intellij.openapi.vfs

Examples of com.intellij.openapi.vfs.LocalFileSystem


    }

    public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
        String moduleRootPath = getContentEntryPath();
        if (moduleRootPath != null) {
            LocalFileSystem localFileSystem = LocalFileSystem.getInstance();
            VirtualFile moduleContentRoot = localFileSystem.refreshAndFindFileByPath(FileUtil.toSystemIndependentName(moduleRootPath));
            if (moduleContentRoot != null) {
                ContentEntry contentEntry = rootModel.addContentEntry(moduleContentRoot);
                List<Pair<String, String>> sourcePaths = getSourcePaths();
                if (sourcePaths != null) {
                    for (Pair<String, String> sourcePath : sourcePaths) {
                        VirtualFile sourceRoot = localFileSystem.refreshAndFindFileByPath(FileUtil.toSystemIndependentName(sourcePath.first));
                        if (sourceRoot != null) {
                            contentEntry.addSourceFolder(sourceRoot, false, sourcePath.second);
                        }
                    }
                }
View Full Code Here


    RefreshPluginTreeAction.refreshPluginTree();
  }

  private static List<VirtualFile> getFileSystemRoots() {
    LocalFileSystem localFileSystem = LocalFileSystem.getInstance();
    Set<VirtualFile> roots = new HashSet<VirtualFile>();
    File[] ioRoots = File.listRoots();
    if (ioRoots != null) {
      for (File root : ioRoots) {
        String path = FileUtil.toSystemIndependentName(root.getAbsolutePath());
        VirtualFile file = localFileSystem.findFileByPath(path);
        if (file != null) {
          roots.add(file);
        }
      }
    }
View Full Code Here

       */
      private static VirtualFile refreshVFS(final File directory) {
        final Ref<VirtualFile> result = new Ref<VirtualFile>();
        ApplicationManager.getApplication().runWriteAction(new Runnable() {
          public void run() {
            final LocalFileSystem lfs = LocalFileSystem.getInstance();
            final VirtualFile vDir = lfs.refreshAndFindFileByIoFile(directory);
            result.set(vDir);
            if (vDir != null) {
              final LocalFileSystem.WatchRequest watchRequest = lfs.addRootToWatch(vDir.getPath(), true);
              ((NewVirtualFile)vDir).markDirtyRecursively();
              vDir.refresh(false, true);
              if (watchRequest != null) {
                lfs.removeWatchedRoot(watchRequest);
              }
            }
          }
        });
        return result.get();
View Full Code Here

        this.configuration = configuration;
    }

    public NavigationItem[] getItemsByName(String name, String pattern, Project project, boolean includeNonProjectItems) {

        LocalFileSystem localFileSystem = LocalFileSystem.getInstance();
        PsiManager psiManager = PsiManager.getInstance(project);
        List<PsiFile> result = new ArrayList<PsiFile>();
        Map<String, Set<String>> names = configuration.getNameToPathsMapping();
        Set<String> fullPathsForName = names.get(name);
        if (fullPathsForName != null) {
            for (String s : fullPathsForName) {
                VirtualFile vfile = localFileSystem.findFileByPath(s);
                if (vfile != null) {
                    result.add(psiManager.findFile(vfile));
                }
            }
        }
View Full Code Here

      }
    }
  }

  private void addAllRemoteUrlMappings(@NotNull Collection<FileInfo> filesInfo, @NotNull BiMap<String, VirtualFile> map) {
    LocalFileSystem fileSystem = LocalFileSystem.getInstance();
    for (FileInfo fileInfo : filesInfo) {
      String displayPath = fileInfo.getDisplayPath();
      File file = fileInfo.toFile();
      if (StringUtil.isNotEmpty(displayPath) && file.isFile()) {
        VirtualFile virtualFile = fileSystem.findFileByIoFile(file);
        if (virtualFile != null) {
          String url = "http://127.0.0.1:" + myServer.getSettings().getPort() + "/test/" + UriUtil.trimLeadingSlashes(displayPath);
          map.forcePut(url, virtualFile);
        }
      }
View Full Code Here

    }

    @Ignore
    protected void _testVariants() throws IOException {

        LocalFileSystem fileSystem = LocalFileSystem.getInstance();
        final VirtualFile testRoot =
                fileSystem.findFileByPath(
                        getTestDataPath() + File.separator + getTestName(false));

        addPackageBuiltin();

        PsiFile testFile = myFixture.configureByFile(getTestName(false) + ".go");
View Full Code Here

    private void refreshCssFile(final CssDirectory cssDirectory, final File cssDestFile) {
        ApplicationManager.getApplication().invokeLater(new Runnable() {
            @Override
            public void run() {
                final LocalFileSystem localFileSystem = LocalFileSystem.getInstance();

                localFileSystem.refresh(false);
                localFileSystem.refreshAndFindFileByPath(cssDestFile.getAbsolutePath());

                final VirtualFile virtualCssRoot = localFileSystem.findFileByIoFile(new File(cssDirectory.getPath()));

                if (virtualCssRoot != null)
                    virtualCssRoot.refresh(false, true);

                final VirtualFile virtualCssFile = localFileSystem.findFileByIoFile(cssDestFile);

                if (virtualCssFile != null)
                    virtualCssFile.refresh(false, false);
            }
        });
View Full Code Here

      final Set<File> outputs = new HashSet<File>();
      final Module[] affectedModules = compileContext.getCompileScope().getAffectedModules();
      for (final String path : CompilerPathsEx.getOutputPaths(affectedModules)) {
        outputs.add(new File(path));
      }
      final LocalFileSystem lfs = LocalFileSystem.getInstance();
      if (!outputs.isEmpty()) {
        final ProgressIndicator indicator = compileContext.getProgressIndicator();
        indicator.setText("Synchronizing output directories...");
        CompilerUtil.refreshOutputDirectories(outputs, _status == ExitStatus.CANCELLED);
        indicator.setText("");
      }
      if (compileContext.isAnnotationProcessorsEnabled() && !myProject.isDisposed()) {
        final Set<File> genSourceRoots = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
        final CompilerConfiguration config = CompilerConfiguration.getInstance(myProject);
        for (Module module : affectedModules) {
          if (config.getAnnotationProcessingConfiguration(module).isEnabled()) {
            final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);
            if (path != null) {
              genSourceRoots.add(new File(path));
            }
          }
        }
        if (!genSourceRoots.isEmpty()) {
          // refresh generates source roots asynchronously; needed for error highlighting update
          lfs.refreshIoFiles(genSourceRoots, true, true, null);
        }
      }
    }
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
View Full Code Here

      rootModel.inheritJdk();
    }

    final String moduleRootPath = getContentEntryPath();
    if (moduleRootPath != null) {
      final LocalFileSystem lfs = LocalFileSystem.getInstance();
      VirtualFile moduleContentRoot = lfs.refreshAndFindFileByPath(FileUtil.toSystemIndependentName(moduleRootPath));
      if (moduleContentRoot != null) {
        final ContentEntry contentEntry = rootModel.addContentEntry(moduleContentRoot);
        final List<Pair<String,String>> sourcePaths = getSourcePaths();
        if (sourcePaths != null) {
          for (final Pair<String, String> sourcePath : sourcePaths) {
            final VirtualFile sourceRoot = lfs.refreshAndFindFileByPath(FileUtil.toSystemIndependentName(sourcePath.first));
            if (sourceRoot != null) {
              contentEntry.addSourceFolder(sourceRoot, false, sourcePath.second);
            }
          }
        }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.vfs.LocalFileSystem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.