Пример #1
0
  /**
   * Checks if the project contains a given source file.
   *
   * @param file the file to check
   * @return <code>true</code> if the project contains the file
   */
  public boolean contains(File file) {
    try {
      File currentFile = file.getCanonicalFile();
      // We ensure the source files are loaded
      getSourceFiles();
      return sourceFileMap.containsKey(currentFile);
    } catch (IOException e) {
      LOG.debug("file error", e);
    }

    return false;
  }
Пример #2
0
 /**
  * Gets the source representation of a given file.
  *
  * @param file the file to retrieve
  * @return the associated source file, or <code>null</code> if the file is not included in the
  *     assembly.
  */
 public SourceFile getFile(File file) {
   File currentFile;
   try {
     currentFile = file.getCanonicalFile();
   } catch (IOException e) {
     // File not found
     if (LOG.isDebugEnabled()) {
       LOG.debug("file not found " + file, e);
     }
     return null;
   }
   // We ensure the source files are loaded
   getSourceFiles();
   return sourceFileMap.get(currentFile);
 }