## org.eclipse.datatools.sqltools.sqleditor.internal.sql
Class SQLCompletionEngine

    java.lang.Object
      org.eclipse.datatools.sqltools.sqleditor.internal.sql.SQLCompletionEngine

All Implemented Interfaces:
  ISQLCompletionEngine

    public class SQLCompletionEngine

extends java.lang.Object
implements ISQLCompletionEngine

This class computes proposals for text completion.

Author:
  Hetty Dougherty

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

Method Summary
`org.eclipse.jface.text.contentassist.IContextInformation[]` `computeContextInformation(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.text.ITypedRegion partition, int documentOffset, org.eclipse.swt.graphics.Point selection)` Compute ContextInformation
`org.eclipse.jface.text.contentassist.ICompletionProposal[]` `computeProposals(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.text.ITypedRegion partition, int documentOffset, org.eclipse.swt.graphics.Point selection)` Computes and returns an array of text completion proposals based on the given document, document region, and location in the document.
`ISQLDBProposalsService` `getDBProposalsService()` Gets the current `DBProposalsService`.
`int` `getPartitionOffset(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.text.ITypedRegion partition, int documentOffset, 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 documentOffset, java.lang.String leadingString, int position)` Returns the document offset to the start of the "word" where content assist is requested.
`void` `setDBProposalsService(ISQLDBProposalsService dbProposalsService)` Sets the `DBProposalsService` to use.
`java.util.Vector` `sortProposals(java.util.List proposals, java.lang.String sortingString, boolean showAll)` Sorts the given list of proposals.

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

### computeProposals

    public org.eclipse.jface.text.contentassist.ICompletionProposal[] computeProposals(org.eclipse.jface.text.IDocument doc,
                                                                                       org.eclipse.jface.text.ITypedRegion partition,
                                                                                       int documentOffset,
                                                                                       org.eclipse.swt.graphics.Point selection)

  Computes and returns an array of text completion proposals based on the given document, document region, and location in the document.

  Specified by:
    `computeProposals` in interface `ISQLCompletionEngine`
  Parameters:
    `doc` - the current document
    `partition` - a document partion region. A region consists of offset, length, and type.
    `documentOffset` - the current offset in the document
    `selection` - the range of the current selection in coordinates of this viewer's document
  See Also:
    `ISQLCompletionEngine#computeProposals(IDocument, ITypedRegion, int, IDBProposalsService)`

### getPartitionOffset

    public int getPartitionOffset(org.eclipse.jface.text.IDocument doc,
                                  org.eclipse.jface.text.ITypedRegion partition,
                                  int documentOffset,
                                  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.
    `documentOffset` - 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 documentOffset,
                                  java.lang.String leadingString,
                                  int position)

  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.
    `documentOffset` - offset into the document
    `leadingString` -
    `position` - `1` from current position `0` after leadingString
  Returns:
    the partition offset

### sortProposals

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

  Sorts the given list of proposals.

  Parameters:
    `proposals` - list of proposals to be sorted
    `sortingString` - string to be used as sorting "seed"
    `showAll` -
  Returns:
    the sorted list of proposals

### setDBProposalsService

    public void setDBProposalsService(ISQLDBProposalsService dbProposalsService)

  Sets the `DBProposalsService` to use.

  Parameters:
    `dbProposalsService` - the `DBProposalsService` to use

### getDBProposalsService

    public ISQLDBProposalsService getDBProposalsService()

  Gets the current `DBProposalsService`.

  Parameters:
    `dbProposalsService` - the current `DBProposalsService`.

### computeContextInformation

    public org.eclipse.jface.text.contentassist.IContextInformation[] computeContextInformation(org.eclipse.jface.text.IDocument doc,
                                                                                                org.eclipse.jface.text.ITypedRegion partition,
                                                                                                int documentOffset,
                                                                                                org.eclipse.swt.graphics.Point selection)

  Description copied from interface: `ISQLCompletionEngine`
  Compute ContextInformation

  Specified by:
    `computeContextInformation` in interface `ISQLCompletionEngine`
  Parameters:
    `doc` - The document
    `partition` - document partition
    `documentOffset` - current offset in the document
    `selection` - the range of the current selection in coordinates of this viewer's document