for ( int i = 0; i < wantedSections.length; i++ ) { if ( sections.containsKey( wantedSections[ i ] ) ) { MLDonkeyOptions optionspage = ( MLDonkeyOptions ) sections.get( wantedSections[ i ] ); addToRoot( new PreferenceNode ( wantedSections[ i ], optionspage ) ); }
it = sections.values().iterator(); while ( it.hasNext() ) { MLDonkeyOptions page = ( MLDonkeyOptions )it.next(); addToRoot( ( new PreferenceNode ( "", page ) ) );
	private void createMLDonkeyOptions( boolean connected, CoreCommunication mldonkey ) {		OptionsInfoMap options = mldonkey.getOptionsInfoMap();		OptionsPreferenceStore optionsStore = new OptionsPreferenceStore();		optionsStore.setInput(options);		Map sections = new HashMap();		Map plugins = new HashMap();				/*now we iterate over the whole thing and create the preferencePages*/		Iterator it = options.keySet().iterator();		while ( it.hasNext() ) {								OptionsInfo option = ( OptionsInfo ) options.get( it.next() );						String section = option.getSectionToAppear();			String plugin = option.getPluginToAppear();															if ( ( section == null ) && ( plugin == null ) && showOption(option) ) {								/* create the General-section, or if already done, only add the option */				if ( !sections.containsKey( "General" ) ) {					MLDonkeyOptions temp = new MLDonkeyOptions( "General", FieldEditorPreferencePage.FLAT );					addToRoot( new PreferenceNode ( "General", temp ) );					sections.put( "General", temp );						temp.setPreferenceStore( optionsStore );								}							/*commented out the following, as it produces ton's of options in this tab				 * which made it unreadable					 */				( ( MLDonkeyOptions  )sections.get( "General" ) ).addOption( option );							}						else if ( ( section != null ) && showOption(option) ) {							/* create the section, or if already done, only add the option */				if ( !sections.containsKey( section ) ) {					MLDonkeyOptions temp = new MLDonkeyOptions( section, FieldEditorPreferencePage.FLAT );					//myprefs.addToRoot( new PreferenceNode ( section, temp ) );					sections.put( section, temp );					temp.setPreferenceStore( optionsStore );					}				( ( MLDonkeyOptions  )sections.get( section ) ).addOption( option );			}			else if ( ( plugin != null ) && showOption(option) ) {							/* create the pluginSection, or if already done, only add the option */				if ( !plugins.containsKey( plugin ) ) {					/*only create the plugin, if it is possible at all...*/										MLDonkeyOptions temp = new MLDonkeyOptions( plugin, FieldEditorPreferencePage.FLAT );										plugins.put( plugin, temp );					temp.setPreferenceStore( optionsStore );										}				( ( MLDonkeyOptions  )plugins.get( plugin ) ).addOption( option );							//create the plugin, or if already done, only add the option				}		}		/*Now we create the tree-structure, since we received all options*/						 /*		  * first the sections:		  */		//this creates only the sections defined in wantedSections[]		 		 for ( int i = 0; i < wantedSections.length; i++ ) {			if ( sections.containsKey( wantedSections[ i ] ) ) {				MLDonkeyOptions optionspage = ( MLDonkeyOptions ) sections.get( wantedSections[ i ] );				  addToRoot( new PreferenceNode ( wantedSections[ i ], optionspage ) );			}						}		 		 /*		  * and now the Plugins:		  */		  if (plugins.size() != 0){		 			PreferenceNode pluginOptions = new PreferenceNode( "plugins", new MLDonkeyOptions( "Plugins", FieldEditorPreferencePage.FLAT ) );			addToRoot( pluginOptions );									/*this creates only the sections defined in wantedPlugins[]	*/ 			   for ( int i = 0; i < wantedPlugins.length; i++ ) {				  if ( plugins.containsKey( wantedPlugins[ i ] ) ) {					  MLDonkeyOptions optionspage = ( MLDonkeyOptions ) plugins.get( wantedPlugins[ i ] );						 pluginOptions.add( new PreferenceNode ( wantedPlugins[ i ], optionspage ) );				  }							  }			  }		}