org.eclipse.datatools.sqltools.sqleditor.internal.sql
Class SQLCompletionProcessor

java.lang.Object
  extended by org.eclipse.datatools.sqltools.sqleditor.internal.sql.SQLCompletionProcessor
All Implemented Interfaces:
org.eclipse.jface.text.contentassist.IContentAssistProcessor

public class SQLCompletionProcessor
extends java.lang.Object
implements org.eclipse.jface.text.contentassist.IContentAssistProcessor

This class implements a content assist processor for SQL code.

This processor should be registered with a content assistant in order to get involved in the assisting process.

Author:
Hetty Dougherty

Constructor Summary
SQLCompletionProcessor()
           
 
Method Summary
 org.eclipse.jface.text.contentassist.ICompletionProposal[] computeCompletionProposals(org.eclipse.jface.text.ITextViewer viewer, int documentOffset)
          Returns a list of proposed content completions based on the specified location within the document that corresponds to the current cursor position within the text-editor control.
 org.eclipse.jface.text.contentassist.IContextInformation[] computeContextInformation(org.eclipse.jface.text.ITextViewer viewer, int documentOffset)
           
 char[] getCompletionProposalAutoActivationCharacters()
          Returns a string of characters which when pressed should automatically display content-assist proposals.
 char[] getContextInformationAutoActivationCharacters()
          Returns a string of characters which when pressed should automatically display a content-assist tip.
 org.eclipse.jface.text.contentassist.IContextInformationValidator getContextInformationValidator()
          Returns a delegate used to determine when a displayed tip should be dismissed.
 ISQLDBProposalsService getDBProposalService()
          Gets the DBProposalsService.
 java.lang.String getErrorMessage()
          Returns the reason why the content-assist processor was unable to produce any proposals or tips.
 void orderProposalsAlphabetically(boolean order)
          Tells this processor to order the proposals alphabetically.
 void setDBProposalsService(ISQLDBProposalsService dbProposalsService)
          Sets the ISQLDBProposalsService to use to generate DB object proposals (tables, columns) for content assist.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLCompletionProcessor

public SQLCompletionProcessor()
Method Detail

orderProposalsAlphabetically

public void orderProposalsAlphabetically(boolean order)
Tells this processor to order the proposals alphabetically.

Parameters:
order - true if proposals should be ordered.

computeCompletionProposals

public org.eclipse.jface.text.contentassist.ICompletionProposal[] computeCompletionProposals(org.eclipse.jface.text.ITextViewer viewer,
                                                                                             int documentOffset)
Returns a list of proposed content completions based on the specified location within the document that corresponds to the current cursor position within the text-editor control.

Specified by:
computeCompletionProposals in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
Parameters:
viewer - the viewer whose document is used to compute the proposals
documentPosition - a location within the document
Returns:
an array of content-assist proposals

computeContextInformation

public org.eclipse.jface.text.contentassist.IContextInformation[] computeContextInformation(org.eclipse.jface.text.ITextViewer viewer,
                                                                                            int documentOffset)
Specified by:
computeContextInformation in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor

getCompletionProposalAutoActivationCharacters

public char[] getCompletionProposalAutoActivationCharacters()
Returns a string of characters which when pressed should automatically display content-assist proposals.

Specified by:
getCompletionProposalAutoActivationCharacters in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
Returns:
string of characters
See Also:
IContentAssistProcessor.getCompletionProposalAutoActivationCharacters()

getContextInformationAutoActivationCharacters

public char[] getContextInformationAutoActivationCharacters()
Returns a string of characters which when pressed should automatically display a content-assist tip.

Specified by:
getContextInformationAutoActivationCharacters in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
Returns:
string of characters

getContextInformationValidator

public org.eclipse.jface.text.contentassist.IContextInformationValidator getContextInformationValidator()
Returns a delegate used to determine when a displayed tip should be dismissed.

Specified by:
getContextInformationValidator in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
Returns:
a tip closer

getDBProposalService

public ISQLDBProposalsService getDBProposalService()
Gets the DBProposalsService.

Returns:
the DBProposalsService

getErrorMessage

public java.lang.String getErrorMessage()
Returns the reason why the content-assist processor was unable to produce any proposals or tips.

Specified by:
getErrorMessage in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
Returns:
an error message or null if no error occurred

setDBProposalsService

public void setDBProposalsService(ISQLDBProposalsService dbProposalsService)
Sets the ISQLDBProposalsService to use to generate DB object proposals (tables, columns) for content assist.

Parameters:
dbProposalsService - the ISQLDBProposalsService object to use