org.eclipse.datatools.sqltools.sqlbuilder.views.source
Class SQLBuilderDBProposalsService

java.lang.Object
  extended by org.eclipse.datatools.sqltools.sqlbuilder.views.source.SQLBuilderDBProposalsService

public class SQLBuilderDBProposalsService
extends java.lang.Object

This class extends SQLDBProposalsService in the SQLEditor package in order to override the "populate" method. In the SQL Builder context we don't want to do a "reestablishConnection" action, since that momentarily pops up a progress dialog even when the connection is already established. This interferes with the content assist popup and causes the SQL validation to kick in.

Author:
bgp

Constructor Summary
SQLBuilderDBProposalsService(ISQLEditorConnectionInfo connInfo)
          Constructs an instance of this class with the given ISQLEditorConnectionInfo object.
SQLBuilderDBProposalsService(ISQLEditorConnectionInfo connInfo, java.lang.String schemaName)
          Constructs an instance of this class with the given ISQLEditorConnectionInfo object and default (implied) schema name.
 
Method Summary
 ISQLEditorConnectionInfo getConnectionInfo()
          Gets the ISQLEditorConnectionInfo used to provide content assist.
 java.util.List getDBProposals()
          Gets the list of SQLDBProposal objects for the content assist proposals.
 java.lang.String getSchemaName()
          Gets the default (implied) schema name.
 boolean populate(java.util.List tokenList)
          Populates the list database of database object proposals (schemas, tables, columns) using given list of tokens (DB identifiers) indicating the start of the expression for which the user wants DB proposals.
 void setSchemaName(java.lang.String schemaName)
          Sets the default (implied) schema name to the given name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLBuilderDBProposalsService

public SQLBuilderDBProposalsService(ISQLEditorConnectionInfo connInfo)
Constructs an instance of this class with the given ISQLEditorConnectionInfo object.

Parameters:
connInfo - the ISQLEditorConnectionInfo object to use

SQLBuilderDBProposalsService

public SQLBuilderDBProposalsService(ISQLEditorConnectionInfo connInfo,
                                    java.lang.String schemaName)
Constructs an instance of this class with the given ISQLEditorConnectionInfo object and default (implied) schema name.

Parameters:
connInfo - the ISQLEditorConnectionInfo object to use
schemaName - the default (implied) schema name
Method Detail

getConnectionInfo

public ISQLEditorConnectionInfo getConnectionInfo()
Gets the ISQLEditorConnectionInfo used to provide content assist. Implements ISQLDBProposalsService interface.

Returns:
the current ISQLEditorConnectionInfo object
See Also:
ISQLDBProposalsService#getConnectionInfo()

getDBProposals

public java.util.List getDBProposals()
Gets the list of SQLDBProposal objects for the content assist proposals. Implements ISQLDBProposalsService interface.

Returns:
the list of proposals
See Also:
ISQLDBProposalsService.getDBProposals()

getSchemaName

public java.lang.String getSchemaName()
Gets the default (implied) schema name. Implements ISQLDBProposalsService interface.

Returns:
the default (implied) schema name
See Also:
ISQLDBProposalsService#getSchemaName()

populate

public boolean populate(java.util.List tokenList)
Populates the list database of database object proposals (schemas, tables, columns) using given list of tokens (DB identifiers) indicating the start of the expression for which the user wants DB proposals. For example, if the user provides the list (MYSCHEMA, TABLE1), the list of proposals will be the columns of table MYSCHEMA.TABLE1. Retrieve the list using getDBProposals(). Implements ISQLDBProposalsService interface. This method overrides the superclass method to not try to reestablish a connection. We assume that the connection is available.

Parameters:
tokenList - list of strings indicating the start of the expression for which the user wants DB proposals
Returns:
true if DB items were retrieved, otherwise false
See Also:
SQLDBProposalsService#populate(), ISQLDBProposalsService#populate()

setSchemaName

public void setSchemaName(java.lang.String schemaName)
Sets the default (implied) schema name to the given name. This is used to qualify tables when the shema is not present. For example, if setSchema("ABC") has been is called and the user enters XYZ followed by ".", then the generated list of DB proposals consists of all tables under the schema IDENTIFIER1 and all columns in IDENTIFIERA.IDENTIFIER1 if such table exists

Parameters:
schemaName - the default (implied) schema name to set