src/main/java/ca/phon/plugins/praat/TextGridManager.java
/**
	 * List available TextGrids for a given session.
	 *
	 * @param corpus
	 * @param session
	 *
	 * @return list of TextGrid files available
	 */
List available TextGrids for a given session.
@param corpus
@param session

@return list of TextGrid files available
List available TextGrids for a given session . @param corpus @param session @return list of TextGrid files available
public List<File> textGridFilesForSession(Session session) {
		List<File> retVal = new ArrayList<>();
		final File mediaFile = MediaLocator.findMediaFile(project, session);
		if(mediaFile != null) {
			final File tgFile = new File(mediaFile.getParentFile(), FilenameUtils.getBaseName(mediaFile.getName()) + TEXTGRID_EXT);
			if(tgFile.exists()) {
				retVal.add(tgFile);
			}
		}
		final Path textGridFolderPath = Paths.get(textGridFolder(session.getCorpus(), session.getName()));
		if(Files.exists(textGridFolderPath)) {
			 try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(textGridFolderPath)) {
				 for(Path subFile:directoryStream) {
					 if(subFile.getFileName().toString().endsWith(TEXTGRID_EXT)) {
						 retVal.add(subFile.toFile());
					 }
				 }
			 } catch (IOException e) {
				 LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
			 }
		}
		return retVal;
	}
public List < File > textGridFilesForSession ( Session session ) { List < File > retVal = new ArrayList < > ( ) ; final File mediaFile = MediaLocator . findMediaFile ( project , session ) ; if ( mediaFile != null ) { final File tgFile = new File ( mediaFile . getParentFile ( ) , FilenameUtils . getBaseName ( mediaFile . getName ( ) ) + TEXTGRID_EXT ) ; if ( tgFile . exists ( ) ) { retVal . add ( tgFile ) ; } } final Path textGridFolderPath = Paths . get ( textGridFolder ( session . getCorpus ( ) , session . getName ( ) ) ) ; if ( Files . exists ( textGridFolderPath ) ) { try ( DirectoryStream < Path > directoryStream = Files . newDirectoryStream ( textGridFolderPath ) ) { for ( Path subFile : directoryStream ) { if ( subFile . getFileName ( ) . toString ( ) . endsWith ( TEXTGRID_EXT ) ) { retVal . add ( subFile . toFile ( ) ) ; } } } catch ( IOException e ) { LOGGER . log ( Level . SEVERE , e . getLocalizedMessage ( ) , e ) ; } } return retVal ; }
List available TextGrids for a given session.
List available TextGrids for a given session .