## org.eclipse.datatools.sqltools.sqlbuilder.views.source
Class SQLCompletionEngine

    java.lang.Object
      org.eclipse.datatools.sqltools.sqlbuilder.views.source.SQLCompletionEngine

    public class SQLCompletionEngine

extends java.lang.Object

Constructor Summary
`SQLCompletionEngine()` Constructs an instance of this class.

Method Summary
`org.eclipse.jface.text.contentassist.ICompletionProposal[]` `computeDBProposals(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.text.ITypedRegion partition, int docOffset, IDBContext dbcontext)` Computes and returns a list of database (catalog) objects (that is, schema, table, and column names) as an array of CompletionProposal objects, based on the current location in the given document.
`org.eclipse.jface.text.contentassist.ICompletionProposal[]` `computeSyntaxProposals(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.text.ITypedRegion partition, int docOffset)` Computes and returns a list of syntax elements (keywords and operators) as an array of CompletionProposal objects, based on the current location in the given document.
`java.util.Vector` `filterProposals(java.util.List proposalList, java.lang.String prefixString, boolean showAll)` Filters the given list of proposals based on the given prefix string.
`java.util.List` `getAvailableColumns()` Gets a list of DBProposal objects from the available columns of the tables in the query statement.
`java.util.List` `getAvailableColumnsForTable(java.lang.String schemaName, java.lang.String tableName)` Gets a list of available column objects for the given schema and table name.
`java.util.List` `getAvailableTables()` Gets a list of SQLDBProposal objects representing the tables in the current schema.
`IDBContext` `getDBContext()` Gets the current DB context object.
`java.util.List` `getDBObjectProposals(java.util.List dbContextList)` Gets a list of SQLDBProposal objects.
`int` `getPartitionOffset(org.eclipse.jface.text.IDocument doc, int docOffset, int offset)` Returns document offset to the start of the "word" where content assist is requested.
`int` `getPartitionOffset(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.text.ITypedRegion partition, int docOffset, int offset)` Returns the document offset to the start of the "word" where content assist is requested.
`int` `getPartitionOffset(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.text.ITypedRegion partition, int docOffset, java.lang.String leadingString, int position)`
`SQLBuilderDBProposalsService` `getSQLDBProposalsService()` Gets the current SQLDBProposalsService object.
`void` `setDBContext(IDBContext dbContext)` Sets the current DB context to the given object.
`void` `setSQLDBProposalsService(SQLBuilderDBProposalsService sqlDBProposalsService)` Sets the current SQLDBProposalsService to the given object.
`static boolean` `showContextInformation(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.text.ITypedRegion partition, int docOffset, java.lang.String leadingString)`
`java.util.Vector` `sortProposals(java.lang.String[] proposals, java.lang.String sortingString, boolean showAll)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SQLCompletionEngine

    public SQLCompletionEngine()

  Constructs an instance of this class. This is the default constructor.

Method Detail

### computeDBProposals

    public org.eclipse.jface.text.contentassist.ICompletionProposal[] computeDBProposals(org.eclipse.jface.text.IDocument doc,
                                                                                         org.eclipse.jface.text.ITypedRegion partition,
                                                                                         int docOffset,
                                                                                         IDBContext dbcontext)

  Computes and returns a list of database (catalog) objects (that is, schema, table, and column names) as an array of CompletionProposal objects, based on the current location in the given document.

  Parameters:
    `doc` - the current document
    `partition` - the current partition in the document
    `docOffset` - the location (offset) in the document where content assist is wanted
    `dbContext` - the database context (that is, the current database connection)
  Returns:
    the array of content assist proposals

### computeSyntaxProposals

    public org.eclipse.jface.text.contentassist.ICompletionProposal[] computeSyntaxProposals(org.eclipse.jface.text.IDocument doc,
                                                                                             org.eclipse.jface.text.ITypedRegion partition,
                                                                                             int docOffset)

  Computes and returns a list of syntax elements (keywords and operators) as an array of CompletionProposal objects, based on the current location in the given document.

  Parameters:
    `doc` - the current document
    `partition` - the current partition in the document
    `docOffset` - the location (offset) in the document where content assist is wanted
  Returns:
    the array of content assist proposals

### filterProposals

    public java.util.Vector filterProposals(java.util.List proposalList,
                                            java.lang.String prefixString,
                                            boolean showAll)

  Filters the given list of proposals based on the given prefix string.

  Parameters:
    `proposalList` - a list of proposals to be filtered
    `prefixString` - the string to be used to filter
    `showAll` - when true, include all proposals when the filter appears to filter out all proposals
  Returns:
    the sorted list of proposals

### getPartitionOffset

    public int getPartitionOffset(org.eclipse.jface.text.IDocument doc,
                                  int docOffset,
                                  int offset)

  Returns document offset to the start of the "word" where content assist is requested.

  Parameters:
    `doc` - IDocument
    `partition` - ITypedRegion
    `docOffset` - int
    `offset` - int

### getPartitionOffset

    public int getPartitionOffset(org.eclipse.jface.text.IDocument doc,
                                  org.eclipse.jface.text.ITypedRegion partition,
                                  int docOffset,
                                  int offset)

  Returns the document offset to the start of the "word" where content assist is requested.

  Parameters:
    `doc` - the current document
    `partition` - document partition region. A region consists of offset, length, and type.
    `docOffset` - offset into the document
    `offset` - offset in the document to start of the name preceeding the activation character

### getPartitionOffset

    public int getPartitionOffset(org.eclipse.jface.text.IDocument doc,
                                  org.eclipse.jface.text.ITypedRegion partition,
                                  int docOffset,
                                  java.lang.String leadingString,
                                  int position)

  Parameters:
    `doc` - IDocument
    `partition` - ITypedRegion
    `docOffset` - int
    `leadingString` - String
    `position` - 1: from current position 0: after leadingString

### showContextInformation

    public static boolean showContextInformation(org.eclipse.jface.text.IDocument doc,
                                                 org.eclipse.jface.text.ITypedRegion partition,
                                                 int docOffset,
                                                 java.lang.String leadingString)

### sortProposals

    public java.util.Vector sortProposals(java.lang.String[] proposals,
                                          java.lang.String sortingString,
                                          boolean showAll)

  Parameters:
    `proposals` - String []
    `sortingString` - String

### getAvailableColumns

    public java.util.List getAvailableColumns()

  Gets a list of DBProposal objects from the available columns of the tables in the query statement.

  Returns:
    the available columns list

### getAvailableTables

    public java.util.List getAvailableTables()

  Gets a list of SQLDBProposal objects representing the tables in the current schema.

  Returns:
    the available tables list

### getAvailableColumnsForTable

    public java.util.List getAvailableColumnsForTable(java.lang.String schemaName,
                                                      java.lang.String tableName)

  Gets a list of available column objects for the given schema and table name. The table must be a table referenced in the FROM clause of a SELECT query or the target table of a INSERT, UPDATE, or DELETE query. (Note that the returned list is a list of SQL model column objects, not column name strings.)

  Parameters:
    `schemaName` - the schema name of the table for which columns are wanted
    `tableName` - the table name for which columns are wanted
  Returns:
    the list of available column objects

### getDBObjectProposals

    public java.util.List getDBObjectProposals(java.util.List dbContextList)

  Gets a list of SQLDBProposal objects.

  Parameters:
    `dbContextList` - a list of identifiers that give a context for the content assist. For example if user entered schema1.table1 then typed ".", then the list consists of two tokens, schema1 and table1.
  Returns:
    the list of DB proposals

### getDBContext

    public IDBContext getDBContext()

  Gets the current DB context object. The DB context has database connection information and the proposal service to use.

  Returns:
    the current DB context object

### setDBContext

    public void setDBContext(IDBContext dbContext)

  Sets the current DB context to the given object. The DB context has database connection information and the proposal service to use.

  Parameters:
    `dbContext` - the DB context to set

### getSQLDBProposalsService

    public SQLBuilderDBProposalsService getSQLDBProposalsService()

  Gets the current SQLDBProposalsService object. The SQLDBProposalsService provides lists of database objects (tables, columns).

  Returns:
    the current SQLDBProposalsService object

### setSQLDBProposalsService

    public void setSQLDBProposalsService(SQLBuilderDBProposalsService sqlDBProposalsService)

  Sets the current SQLDBProposalsService to the given object. The SQLDBProposalsService provides lists of database objects (tables, columns).

  Parameters:
    `sqlDBProposalsService` - the SQLDBProposalsService object to set