private IConfigurationElement getParserWithHeighestPriority ( String natureId , IConfigurationElement [ ] config ) { IConfigurationElement selectedParser = null ; int selectedParserPriority = 0 ; for ( IConfigurationElement e : config ) { if ( e . getAttribute ( "nature" ) . equals ( natureId ) ) { if ( selectedParser == null ) { selectedParser = e ; String selectedParserPriorityString = selectedParser . getAttribute ( "priority" ) ; if ( selectedParserPriorityString != null ) selectedParserPriority = Integer . parseInt ( selectedParserPriorityString ) ; } else { String parserPriorityString = selectedParser . getAttribute ( "priority" ) ; if ( parserPriorityString != null ) { int parserPriority = Integer . parseInt ( parserPriorityString ) ; if ( parserPriority > selectedParserPriority ) { selectedParser = e ; selectedParserPriority = parserPriority ; } } } } } return selectedParser ; }
Gets the parser available for the given nature having the highest priority