public void setColorizeFile ( File path ) { try { if ( path . getName ( ) . endsWith ( "xml" ) ) { ColorPositoryParser parser = new ColorPositoryParser ( ) ; _colRepo = ( ColorPository ) ( parser . parseConfig ( path ) ) ; } else { _colRepo = ColorPository . loadColorPository ( new FileInputStream ( path ) ) ; } _classList . removeAllItems ( ) ; _classList1 . removeAllItems ( ) ; _classList1 . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent event ) { setupColors ( _colorList1 , ( String ) _classList1 . getSelectedItem ( ) ) ; } } ) ; _classList2 . removeAllItems ( ) ; _classList2 . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent event ) { setupColors ( _colorList2 , ( String ) _classList2 . getSelectedItem ( ) ) ; } } ) ; _classList3 . removeAllItems ( ) ; _classList3 . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent event ) { setupColors ( _colorList3 , ( String ) _classList3 . getSelectedItem ( ) ) ; } } ) ; _classList4 . removeAllItems ( ) ; _classList4 . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent event ) { setupColors ( _colorList4 , ( String ) _classList4 . getSelectedItem ( ) ) ; } } ) ; Iterator < ColorPository . ClassRecord > iter = _colRepo . enumerateClasses ( ) ; ArrayList < String > names = Lists . newArrayList ( ) ; while ( iter . hasNext ( ) ) { String str = iter . next ( ) . name ; names . add ( str ) ; } _classList1 . addItem ( NONE ) ; _classList2 . addItem ( NONE ) ; _classList3 . addItem ( NONE ) ; _classList4 . addItem ( NONE ) ; Collections . sort ( names ) ; for ( String name : names ) { _classList . addItem ( name ) ; _classList1 . addItem ( name ) ; _classList2 . addItem ( name ) ; _classList3 . addItem ( name ) ; _classList4 . addItem ( name ) ; } _classList . setSelectedIndex ( 0 ) ; _classList1 . setSelectedIndex ( 0 ) ; _classList2 . setSelectedIndex ( 0 ) ; _classList3 . setSelectedIndex ( 0 ) ; _classList4 . setSelectedIndex ( 0 ) ; _colFilePath . setText ( path . getPath ( ) ) ; CONFIG . setValue ( LAST_COLORIZATION_KEY , path . getAbsolutePath ( ) ) ; } catch ( Exception ex ) { _status . setText ( "Error opening colorization file: " + ex ) ; } }
Loads up the colorization classes from the specified file .