while ( tablesRs.next( ) )
int numberOfTable; Preferences preferences = ReportPlugin.getDefault( ).getPluginPreferences( ); if ( preferences.contains( DateSetPreferencePage.USER_MAX_NUM_OF_TABLE_EACH_SCHEMA ) )
	protected void populateTableList( String schemaName ,TreeItem schemaTreeItem )	{		if(schemaTreeItem!=null)		{			removeTreeItem( schemaTreeItem );		}		String namePattern = null;		String[] tableType = null;		cachedSearchTxt = searchTxt.getText();			namePattern = getTailoredSearchText( searchTxt.getText() );		  		String dbtype = getSelectedDbType( );		cachedDbType = dbtype;		if ( dbtype != null )		{			if ( DbType.TABLE_STRING.equalsIgnoreCase( dbtype )					|| DbType.VIEW_STRING.equalsIgnoreCase( dbtype ) )			{				tableType = new String[]{					dbtype				};			}		}	    String catalogName = metaDataProvider.getCatalog();		ArrayList tableList = new ArrayList();			ResultSet tablesRs = null;		ArrayList procedureRs = null;		if (schemaName != null && schemaName.trim().length() > 0)		{									// For each schema Get  the List of Tables			int numTables = 0;			{				if( metaDataProvider.isProcedureSupported() )					procedureRs = metaDataProvider.getAllProcedure( catalogName, schemaName, namePattern );				if( !DbType.PROCEDURE_STRING.equalsIgnoreCase(dbtype))					tablesRs = metaDataProvider.getAlltables(catalogName,schemaName,namePattern,tableType);					tableList = new ArrayList();				try				{					// Create the schema Node					Image image = tableImage;															if ( tablesRs != null )					{						while ( tablesRs.next( ) )						{							// tablesRs.getString("TABLE_NAME") must be called							// before							// tablesRs.getString("TABLE_TYPE"). This is because							// once using JDBC-ODBC-SQLSERVER							// the index of "TABLE_NAME" is higher than that of							// "TABLE_TYPE".And when connection							// is built using JDBC-ODBC-SQLSERVER the							// ResultSet.getString() method, if being called							// use a low index, then called using a high index,							// will result in an exception.							String tableName = tablesRs.getString( "TABLE_NAME" );							String type = tablesRs.getString( "TABLE_TYPE" );							if ( type.equalsIgnoreCase( "SYSTEM TABLE" ) )								continue;							int dbType = DbObject.TABLE_TYPE;							if ( type.equalsIgnoreCase( "TABLE" ) )							{								image = tableImage;								dbType = DbObject.TABLE_TYPE;							}							else if ( type.equalsIgnoreCase( "VIEW" ) )							{								image = viewImage;								dbType = DbObject.VIEW_TYPE;							}							String fullyQualifiedTableName = tableName;							if ( schemaName != null									&& schemaName.trim( ).length( ) > 0 )							{								fullyQualifiedTableName = schemaName										+ "." + tableName;							}							DbObject dbObject = new DbObject( fullyQualifiedTableName,									tableName,									dbType,									image );							tableList.add( dbObject );							numTables++;						}					}					if ( needToCreateProcedureNode( dbtype, procedureRs ))					{						String fullyQualifiedTableName = "STORED PROCEDURES";						if ( schemaName != null								&& schemaName.trim( ).length( ) > 0 )						{							fullyQualifiedTableName = schemaName + "." + "STORED PROCEDURES";						}						DbObject dbObject = new DbObject( fullyQualifiedTableName,"STORED PROCEDURES", DbObject.PROCEDURE_TYPE, tableImage);						tableList.add( dbObject );					}					if ( schemaTreeItem != null ) 					{						TreeItem item[] = Utility.createTreeItems( schemaTreeItem,								tableList,								SWT.NONE,								null );						//expand table TreeItem						if ( expandDbObjectsTree && item != null && item.length > 0 )						{							availableDbObjectsTree.showItem( item[0] );						}					}				}				catch(SQLException e)				{					e.printStackTrace();				}			}		}	}