org.eclipse.xtext.ui.editor.contentassist
Class XtextContentAssistProcessor

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.contentassist.XtextContentAssistProcessor
All Implemented Interfaces:
org.eclipse.jface.text.contentassist.IContentAssistProcessor, CompletionProposalComputer.State, ContextInformationComputer.State
Direct Known Subclasses:
RepeatedContentAssistProcessor

public class XtextContentAssistProcessor
extends java.lang.Object
implements org.eclipse.jface.text.contentassist.IContentAssistProcessor, CompletionProposalComputer.State, ContextInformationComputer.State

Author:
Sebastian Zarnekow - Initial contribution and API

Field Summary
static java.lang.String COMPLETION_AUTO_ACTIVATION_CHARS
           
static java.lang.String CONTEXT_INFO_AUTO_ACTIVATION_CHARS
           
static java.lang.String ERROR_MESSAGE
           
 
Constructor Summary
XtextContentAssistProcessor()
           
 
Method Summary
 org.eclipse.jface.text.contentassist.ICompletionProposal[] computeCompletionProposals(org.eclipse.jface.text.ITextViewer viewer, int offset)
          Returns a list of completion proposals based on the specified location within the document that corresponds to the current cursor position within the text viewer.
 org.eclipse.jface.text.contentassist.IContextInformation[] computeContextInformation(org.eclipse.jface.text.ITextViewer viewer, int offset)
          Returns information about possible contexts based on the specified location within the document that corresponds to the current cursor position within the text viewer.
protected  CompletionProposalComputer createCompletionProposalComputer(org.eclipse.jface.text.ITextViewer viewer, int offset)
           
protected  ContextInformationComputer createContextInformationComputer(org.eclipse.jface.text.ITextViewer viewer, int offset)
           
 ICompletionProposalAcceptor decorateAcceptor(ICompletionProposalAcceptor acceptor)
           
 IContextInformationAcceptor decorateAcceptor(IContextInformationAcceptor acceptor)
           
 ITemplateAcceptor decorateAcceptor(ITemplateAcceptor acceptor)
           
 char[] getCompletionProposalAutoActivationCharacters()
          Returns the characters which when entered by the user should automatically trigger the presentation of possible completions.
 ICompletionProposalPostProcessor getCompletionProposalPostProcessor()
           
 IContentProposalProvider getContentProposalProvider()
           
 ContentAssistContext.Factory getContextFactory()
           
 char[] getContextInformationAutoActivationCharacters()
          Returns the characters which when entered by the user should automatically trigger the presentation of context information.
 IContextInformationProvider getContextInformationProvider()
           
 org.eclipse.jface.text.contentassist.IContextInformationValidator getContextInformationValidator()
          Returns a validator used to determine when displayed context information should be dismissed.
 java.lang.String getErrorMessage()
          Returns the reason why this content assist processor was unable to produce any completion proposals or context information.
 ITemplateProposalProvider getTemplateProposalProvider()
           
 void setCompletionProposalAutoActivationCharacters(java.lang.String completionProposalAutoActivationCharacters)
           
 void setCompletionProposalPostProcessor(ICompletionProposalPostProcessor completionProposalPostProcessor)
           
 void setContentProposalProvider(IContentProposalProvider contentProposalProvider)
           
 void setContextFactory(ContentAssistContext.Factory contextFactory)
           
 void setContextInformationAutoActivationCharacters(java.lang.String contextInformationAutoActivationCharacters)
           
 void setErrorMessage(java.lang.String errorMessage)
           
 void setTemplateProposalProvider(ITemplateProposalProvider templateProposalProvider)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPLETION_AUTO_ACTIVATION_CHARS

public static final java.lang.String COMPLETION_AUTO_ACTIVATION_CHARS
See Also:
Constant Field Values

CONTEXT_INFO_AUTO_ACTIVATION_CHARS

public static final java.lang.String CONTEXT_INFO_AUTO_ACTIVATION_CHARS
See Also:
Constant Field Values

ERROR_MESSAGE

public static final java.lang.String ERROR_MESSAGE
See Also:
Constant Field Values
Constructor Detail

XtextContentAssistProcessor

public XtextContentAssistProcessor()
Method Detail

computeCompletionProposals

public org.eclipse.jface.text.contentassist.ICompletionProposal[] computeCompletionProposals(org.eclipse.jface.text.ITextViewer viewer,
                                                                                             int offset)
Description copied from interface: org.eclipse.jface.text.contentassist.IContentAssistProcessor
Returns a list of completion proposals based on the specified location within the document that corresponds to the current cursor position within the text viewer.

Specified by:
computeCompletionProposals in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
Parameters:
viewer - the viewer whose document is used to compute the proposals
offset - an offset within the document for which completions should be computed
Returns:
an array of completion proposals or null if no proposals are possible

createCompletionProposalComputer

protected CompletionProposalComputer createCompletionProposalComputer(org.eclipse.jface.text.ITextViewer viewer,
                                                                      int offset)

computeContextInformation

public org.eclipse.jface.text.contentassist.IContextInformation[] computeContextInformation(org.eclipse.jface.text.ITextViewer viewer,
                                                                                            int offset)
Description copied from interface: org.eclipse.jface.text.contentassist.IContentAssistProcessor
Returns information about possible contexts based on the specified location within the document that corresponds to the current cursor position within the text viewer.

Specified by:
computeContextInformation in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
Parameters:
viewer - the viewer whose document is used to compute the possible contexts
offset - an offset within the document for which context information should be computed
Returns:
an array of context information objects or null if no context could be found

createContextInformationComputer

protected ContextInformationComputer createContextInformationComputer(org.eclipse.jface.text.ITextViewer viewer,
                                                                      int offset)

getCompletionProposalAutoActivationCharacters

public char[] getCompletionProposalAutoActivationCharacters()
Description copied from interface: org.eclipse.jface.text.contentassist.IContentAssistProcessor
Returns the characters which when entered by the user should automatically trigger the presentation of possible completions.

Specified by:
getCompletionProposalAutoActivationCharacters in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
Returns:
the auto activation characters for completion proposal or null if no auto activation is desired

getContextInformationAutoActivationCharacters

public char[] getContextInformationAutoActivationCharacters()
Description copied from interface: org.eclipse.jface.text.contentassist.IContentAssistProcessor
Returns the characters which when entered by the user should automatically trigger the presentation of context information.

Specified by:
getContextInformationAutoActivationCharacters in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
Returns:
the auto activation characters for presenting context information or null if no auto activation is desired

getContextInformationValidator

public org.eclipse.jface.text.contentassist.IContextInformationValidator getContextInformationValidator()
Description copied from interface: org.eclipse.jface.text.contentassist.IContentAssistProcessor
Returns a validator used to determine when displayed context information should be dismissed. May only return null if the processor is incapable of computing context information.

Specified by:
getContextInformationValidator in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
Returns:
a context information validator, or null if the processor is incapable of computing context information

getErrorMessage

public java.lang.String getErrorMessage()
Description copied from interface: org.eclipse.jface.text.contentassist.IContentAssistProcessor
Returns the reason why this content assist processor was unable to produce any completion proposals or context information.

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

setCompletionProposalAutoActivationCharacters

public void setCompletionProposalAutoActivationCharacters(java.lang.String completionProposalAutoActivationCharacters)

setContextFactory

public void setContextFactory(ContentAssistContext.Factory contextFactory)

getContextFactory

public ContentAssistContext.Factory getContextFactory()
Specified by:
getContextFactory in interface CompletionProposalComputer.State
Specified by:
getContextFactory in interface ContextInformationComputer.State

setErrorMessage

public void setErrorMessage(java.lang.String errorMessage)

setContextInformationAutoActivationCharacters

public void setContextInformationAutoActivationCharacters(java.lang.String contextInformationAutoActivationCharacters)

setContentProposalProvider

public void setContentProposalProvider(IContentProposalProvider contentProposalProvider)

getContentProposalProvider

public IContentProposalProvider getContentProposalProvider()
Specified by:
getContentProposalProvider in interface CompletionProposalComputer.State

setTemplateProposalProvider

public void setTemplateProposalProvider(ITemplateProposalProvider templateProposalProvider)

getTemplateProposalProvider

public ITemplateProposalProvider getTemplateProposalProvider()
Specified by:
getTemplateProposalProvider in interface CompletionProposalComputer.State

getContextInformationProvider

public IContextInformationProvider getContextInformationProvider()
Specified by:
getContextInformationProvider in interface ContextInformationComputer.State

decorateAcceptor

public ICompletionProposalAcceptor decorateAcceptor(ICompletionProposalAcceptor acceptor)
Specified by:
decorateAcceptor in interface CompletionProposalComputer.State

decorateAcceptor

public ITemplateAcceptor decorateAcceptor(ITemplateAcceptor acceptor)
Specified by:
decorateAcceptor in interface CompletionProposalComputer.State

decorateAcceptor

public IContextInformationAcceptor decorateAcceptor(IContextInformationAcceptor acceptor)
Specified by:
decorateAcceptor in interface ContextInformationComputer.State

setCompletionProposalPostProcessor

public void setCompletionProposalPostProcessor(ICompletionProposalPostProcessor completionProposalPostProcessor)

getCompletionProposalPostProcessor

public ICompletionProposalPostProcessor getCompletionProposalPostProcessor()