package com.quantum.editors; import com.quantum.ImageStore; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.contentassist.CompletionProposal; import org.eclipse.jface.text.contentassist.ICompletionProposal; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.text.contentassist.IContextInformation; import org.eclipse.jface.text.contentassist.IContextInformationValidator; /** * @author BC */ public class SQLContentAssistProcessor implements IContentAssistProcessor { private String text; /** * @param string */ public SQLContentAssistProcessor(String text) { this.text = text; } public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { ICompletionProposal proposal = new CompletionProposal("select", offset, 0, 6, ImageStore.getImage(ImageStore.TEMPLATE), "select - select columns from a table or view", null, null); //System.out.println(this.text); // complete a key word // complete a function // provide a template // TODO Auto-generated method stub return new ICompletionProposal[] { proposal }; } /** * BCH: I have no idea what the difference is between context information and * completion proposals. */ public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { return null; } /** * Unless this method includes a space character, the standard Ctrl-Space key doesn't * provide content assist. */ public char[] getCompletionProposalAutoActivationCharacters() { return new char[] { ' ' }; } public char[] getContextInformationAutoActivationCharacters() { return null; } public String getErrorMessage() { return null; } public IContextInformationValidator getContextInformationValidator() { return null; } }