コード例 #1
0
  @Override
  public void addFileContent(
      IIndexFragmentFile sourceFile,
      IncludeInformation[] includes,
      IASTPreprocessorStatement[] macros,
      IASTName[][] names,
      ASTFilePathResolver pathResolver,
      YieldableIndexLock lock)
      throws CoreException, InterruptedException {
    assert sourceFile.getIndexFragment() == this;

    PDOMFile pdomFile = (PDOMFile) sourceFile;
    pdomFile.addMacros(macros);
    final ASTFilePathResolver origResolver = fPathResolver;
    fPathResolver = pathResolver;
    try {
      pdomFile.addNames(names, lock);
    } finally {
      fPathResolver = origResolver;
    }
    // Includes expose the temporary file in the index, we must not yield the lock beyond this
    // point.
    pdomFile.addIncludesTo(includes);

    final IIndexFileLocation location = pdomFile.getLocation();
    if (location != null) {
      fEvent.fClearedFiles.remove(location);
      fEvent.fFilesWritten.add(location);
    }
  }
コード例 #2
0
  @Override
  public void clearFile(IIndexFragmentFile file) throws CoreException {
    assert file.getIndexFragment() == this;
    IIndexFileLocation location = file.getLocation();
    PDOMFile pdomFile = (PDOMFile) file;
    pdomFile.clear();
    IIndexInclude include = pdomFile.getParsedInContext();
    if (include != null) {
      PDOMFile includedBy = (PDOMFile) include.getIncludedBy();
      if (includedBy.getTimestamp() > 0)
        getIndexOfFilesWithUnresolvedIncludes().insert(includedBy.getRecord());
    }

    fEvent.fClearedFiles.add(location);
  }