private void addSymbolsFromSettings ( ) { if ( ! Utils . isNullOrEmpty ( context . getSettings ( ) . getImportsFile ( ) ) ) { Symbols imported = new Symbols ( ) ; for ( String name : context . getSettings ( ) . getImportsFile ( ) . split ( ";" ) ) { try { InputStream is = Utils . getFileOrResource ( name ) ; Symbols symbol = JAXB . unmarshal ( is , Symbols . class ) ; is . close ( ) ; imported . getSymbols ( ) . addAll ( symbol . getSymbols ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( "Failed to read imports: " + e . getMessage ( ) ) ; } } if ( Utils . isNullOrEmpty ( context . getSettings ( ) . getImportFilter ( ) ) ) { imports . getSymbols ( ) . addAll ( imported . getSymbols ( ) ) ; } else { Pattern regex = Pattern . compile ( context . getSettings ( ) . getImportFilter ( ) ) ; for ( String symbol : imported . getSymbols ( ) ) { if ( regex . matcher ( symbol ) . matches ( ) ) { imports . getSymbols ( ) . add ( symbol ) ; } } } } }
Reads the imports files to construct the list of import symbols to use .