EList list = chart.getSampleData( ).getOrthogonalSampleData( ); for ( int i = 0; i < list.size( ); i++ ) {    if ( ( (OrthogonalSampleData) list.get( i ) ).getSeriesDefinitionIndex( ) == cmbSeriesSelect.getSelectionIndex( ) ) { list.remove( i );  i--; } } seriesDefns.remove( cmbSeriesSelect.getSelectionIndex( ) );
removeSeriesDefinition( );
	public void widgetSelected( SelectionEvent e )	{		if ( e.widget.equals( btnSeriesAdd ) )		{			if ( seriesDefns.size( ) <= 1 )			{				ChartUIUtil.addNewSeriesDefinition( chart,						seriesDefns,						getCurrentSeriesDefinition( ).eContainer( ).eAdapters( ) );			}			else			{				// Remove color registry				EList removeDefns = ( (SeriesDefinition) seriesDefns.get( cmbSeriesSelect.getSelectionIndex( ) ) ).getDesignTimeSeries( )						.getDataDefinition( );				for ( int i = 0; i < removeDefns.size( ); i++ )				{					String expression = ( (Query) removeDefns.get( i ) ).getDefinition( );					// If it's last element, remove color binding					List otherDfs = getOtherQueryDefinitions( );					if ( DataDefinitionTextManager.getInstance( )							.getNumberOfSameDataDefinition( expression ) == 1							&& !otherDfs.contains( expression ) )					{						ColorPalette.getInstance( )								.retrieveColor( ChartUIUtil.getColumnName( expression ) );					}				}				// Refresh table color				for ( int i = 0; i < getCustomTable( ).getColumnNumber( ); i++ )				{					getCustomTable( ).setColumnColor( i,							ColorPalette.getInstance( )									.getColor( getCustomTable( ).getColumnHeading( i ) ) );				}				// Remove sample data and series				EList list = chart.getSampleData( ).getOrthogonalSampleData( );				for ( int i = 0; i < list.size( ); i++ )				{					// Check each entry if it is associated with the series					// definition					// to be removed					if ( ( (OrthogonalSampleData) list.get( i ) ).getSeriesDefinitionIndex( ) == cmbSeriesSelect.getSelectionIndex( ) )					{						list.remove( i );						// Reset counter						i--;					}				}				seriesDefns.remove( cmbSeriesSelect.getSelectionIndex( ) );			}			refreshButton( );			refreshCombo( );			refreshQuery( );			createDataDefinition( );			refreshQuery( );			selectDataUI.refreshRightBindingArea( );			selectDataUI.layoutAll( );		}		else if ( e.widget.equals( cmbSeriesSelect ) )		{			createDataDefinition( );			refreshQuery( );			selectDataUI.layoutAll( );		}	}