org.radrails.db.internal.ui.editors.sql
Class SQLCompletionProcessor

java.lang.Object
  extended byorg.eclipse.jface.text.templates.TemplateCompletionProcessor
      extended byorg.radrails.db.internal.ui.editors.sql.SQLCompletionProcessor
All Implemented Interfaces:
org.eclipse.jface.text.contentassist.IContentAssistProcessor, ISQLSyntax

public class SQLCompletionProcessor
extends org.eclipse.jface.text.templates.TemplateCompletionProcessor
implements org.eclipse.jface.text.contentassist.IContentAssistProcessor, ISQLSyntax

The SQL content assist processor. This content assist processor proposes text completions and computes context information for a SQL content type.


Field Summary
 
Fields inherited from interface org.radrails.db.internal.ui.editors.sql.ISQLSyntax
allWords, constants, functions, predicates, reservedwords, types
 
Constructor Summary
SQLCompletionProcessor()
           
 
Method Summary
 org.eclipse.jface.text.contentassist.ICompletionProposal[] computeCompletionProposals(org.eclipse.jface.text.ITextViewer viewer, int documentOffset)
          This method returns a list of completion proposals as ICompletionProposal objects.
 org.eclipse.jface.text.contentassist.IContextInformation[] computeContextInformation(org.eclipse.jface.text.ITextViewer viewer, int documentOffset)
          This method is incomplete in that it does not implement logic to produce some context help relevant to SQL.
 char[] getCompletionProposalAutoActivationCharacters()
           
 char[] getContextInformationAutoActivationCharacters()
           
 org.eclipse.jface.text.contentassist.IContextInformationValidator getContextInformationValidator()
           
 java.lang.String getErrorMessage()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLCompletionProcessor

public SQLCompletionProcessor()
Method Detail

computeCompletionProposals

public org.eclipse.jface.text.contentassist.ICompletionProposal[] computeCompletionProposals(org.eclipse.jface.text.ITextViewer viewer,
                                                                                             int documentOffset)
This method returns a list of completion proposals as ICompletionProposal objects. The proposals are based on the word at the offset in the document where the cursor is positioned. In this implementation, we find the word at the document offset and compare it to our list of SQL reserved words. The list is a subset, of those words that match what the user has entered. For example, the text or proposes the SQL keywords OR and ORDER. The list is returned as an array of completion proposals.

Specified by:
computeCompletionProposals in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
See Also:
IContentAssistProcessor.computeCompletionProposals(ITextViewer, int)

computeContextInformation

public org.eclipse.jface.text.contentassist.IContextInformation[] computeContextInformation(org.eclipse.jface.text.ITextViewer viewer,
                                                                                            int documentOffset)
This method is incomplete in that it does not implement logic to produce some context help relevant to SQL. It just hard codes two strings to demonstrate the action

Specified by:
computeContextInformation in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
See Also:
IContentAssistProcessor.computeContextInformation(ITextViewer, int)

getCompletionProposalAutoActivationCharacters

public char[] getCompletionProposalAutoActivationCharacters()
Specified by:
getCompletionProposalAutoActivationCharacters in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
See Also:
IContentAssistProcessor.getCompletionProposalAutoActivationCharacters()

getContextInformationAutoActivationCharacters

public char[] getContextInformationAutoActivationCharacters()
Specified by:
getContextInformationAutoActivationCharacters in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
See Also:
IContentAssistProcessor.getContextInformationAutoActivationCharacters()

getErrorMessage

public java.lang.String getErrorMessage()
Specified by:
getErrorMessage in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
See Also:
IContentAssistProcessor.getErrorMessage()

getContextInformationValidator

public org.eclipse.jface.text.contentassist.IContextInformationValidator getContextInformationValidator()
Specified by:
getContextInformationValidator in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
See Also:
IContentAssistProcessor.getContextInformationValidator()