com.ibm.lab.soln.sqleditor.sql
Class SQLCompletionProcessor

java.lang.Object
  |
  +--com.ibm.lab.soln.sqleditor.sql.SQLCompletionProcessor
All Implemented Interfaces:
org.eclipse.jface.text.contentassist.IContentAssistProcessor, ISQLSyntax

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

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


Inner Class Summary
protected static class SQLCompletionProcessor.Validator
          Simple content assist tip closer.
 
Field Summary
protected  org.eclipse.jface.text.contentassist.IContextInformationValidator fValidator
           
protected  java.util.Vector proposalList
           
 
Fields inherited from interface com.ibm.lab.soln.sqleditor.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()
           
protected  org.eclipse.jface.text.contentassist.ICompletionProposal[] turnProposalVectorIntoAdaptedArray(WordPartDetector word)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fValidator

protected org.eclipse.jface.text.contentassist.IContextInformationValidator fValidator

proposalList

protected java.util.Vector proposalList
See Also:
IContentAssistProcessor.computeCompletionProposals(ITextViewer, int)
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 jsut 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()

getContextInformationValidator

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

getErrorMessage

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

turnProposalVectorIntoAdaptedArray

protected org.eclipse.jface.text.contentassist.ICompletionProposal[] turnProposalVectorIntoAdaptedArray(WordPartDetector word)