com.intellij.util.FileContentUtil Java Examples

The following examples show how to use com.intellij.util.FileContentUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HaxeUtil.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
public static void reparseProjectFiles(@NotNull final Project project) {
  Task.Backgroundable task = new Task.Backgroundable(project, HaxeBundle.message("haxe.project.reparsing"), false) {
    public void run(@NotNull ProgressIndicator indicator) {
      final Collection<VirtualFile> haxeFiles = new ArrayList<VirtualFile>();
      final VirtualFile baseDir = project.getBaseDir();
      if (baseDir != null) {
        FileBasedIndex.getInstance().iterateIndexableFiles(new ContentIterator() {
          public boolean processFile(VirtualFile file) {
            if (HaxeFileType.HAXE_FILE_TYPE == file.getFileType()) {
              haxeFiles.add(file);
            }
            return true;
          }
        }, project, indicator);
      }
      ApplicationManager.getApplication().invokeAndWait(new Runnable() {
        public void run() {
          FileContentUtil.reparseFiles(project, haxeFiles, !project.isDefault());
        }
      }, ModalityState.NON_MODAL);
    }
  };
  ProgressManager.getInstance().run(task);
}
 
Example #2
Source File: RefactoringUtils.java    From netbeans-mmd-plugin with Apache License 2.0 5 votes vote down vote up
public static void reparseFile(final PsiFile file) {
  ApplicationManager.getApplication().runReadAction(new Runnable() {
    @Override
    public void run() {
      FileContentUtil.reparseFiles(file.getProject(), Collections.singletonList(file.getVirtualFile()), true);
    }
  });
}
 
Example #3
Source File: GlobalVariableQuickfix.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
private void doRegistryAction(boolean register) {
    if (register) {
        BashProjectSettings.storedSettings(project).addGlobalVariable(variableName);
    } else {
        BashProjectSettings.storedSettings(project).removeGlobalVariable(variableName);
    }

    FileContentUtil.reparseFiles(project, Collections.emptyList(), true);
}
 
Example #4
Source File: LanguageConsoleImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void setLanguage(Language language) {
  if (!(virtualFile instanceof LightVirtualFile)) {
    throw new UnsupportedOperationException();
  }
  ((LightVirtualFile)virtualFile).setLanguage(language);
  ((LightVirtualFile)virtualFile).setContent(getDocument(), getDocument().getText(), false);
  FileContentUtil.reparseFiles(project, Collections.singletonList(virtualFile), false);
}
 
Example #5
Source File: PsiDocumentManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void reparseFiles(@Nonnull Collection<? extends VirtualFile> files, boolean includeOpenFiles) {
  FileContentUtil.reparseFiles(myProject, files, includeOpenFiles);
}