Class TemplateProposal

  • All Implemented Interfaces:
    ICompletionProposalPriorityExtension, org.eclipse.jface.text.contentassist.ICompletionProposal, org.eclipse.jface.text.contentassist.ICompletionProposalExtension2, org.eclipse.jface.text.contentassist.ICompletionProposalExtension4, org.eclipse.jface.text.contentassist.ICompletionProposalExtension5, org.eclipse.jface.text.contentassist.ICompletionProposalExtension6

    public class TemplateProposal
    extends Object
    implements org.eclipse.jface.text.contentassist.ICompletionProposal, org.eclipse.jface.text.contentassist.ICompletionProposalExtension2, org.eclipse.jface.text.contentassist.ICompletionProposalExtension4, org.eclipse.jface.text.contentassist.ICompletionProposalExtension5, org.eclipse.jface.text.contentassist.ICompletionProposalExtension6, ICompletionProposalPriorityExtension
    Default template proposal
    • Constructor Detail

      • TemplateProposal

        public TemplateProposal​(List<IVariable> variables,
                                ITemplate template,
                                int replaceOffset,
                                int replaceLength,
                                org.eclipse.jface.text.ITextViewer viewer,
                                String prefix,
                                org.eclipse.swt.graphics.Image image)
        Creates new instance of this with given parameters
        Parameters:
        variables - The variables of the template, cannot be null
        template - The template from which the proposal is created, cannot be null
        replaceOffset - The offset of the region that has to be replaced with proposal content, cannot be null
        replaceLength - The length of the region that has to be replaced with proposal content, cannot be null
        viewer - The viewer for which this proposal is created, cannot be null
        prefix - The prefix text, when this proposal was called, cannot be null
        image - The image of the proposal to display to user, can be null
    • Method Detail

      • apply

        public void apply​(org.eclipse.jface.text.IDocument document)
        Specified by:
        apply in interface org.eclipse.jface.text.contentassist.ICompletionProposal
      • getSelection

        public org.eclipse.swt.graphics.Point getSelection​(org.eclipse.jface.text.IDocument document)
        Specified by:
        getSelection in interface org.eclipse.jface.text.contentassist.ICompletionProposal
      • getAdditionalProposalInfo

        public String getAdditionalProposalInfo()
        Specified by:
        getAdditionalProposalInfo in interface org.eclipse.jface.text.contentassist.ICompletionProposal
      • getDisplayString

        public String getDisplayString()
        Specified by:
        getDisplayString in interface org.eclipse.jface.text.contentassist.ICompletionProposal
      • getImage

        public org.eclipse.swt.graphics.Image getImage()
        Specified by:
        getImage in interface org.eclipse.jface.text.contentassist.ICompletionProposal
      • getContextInformation

        public org.eclipse.jface.text.contentassist.IContextInformation getContextInformation()
        Specified by:
        getContextInformation in interface org.eclipse.jface.text.contentassist.ICompletionProposal
      • getStyledDisplayString

        public StyledString getStyledDisplayString()
        Specified by:
        getStyledDisplayString in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension6
      • getAdditionalProposalInfo

        public Object getAdditionalProposalInfo​(org.eclipse.core.runtime.IProgressMonitor monitor)
        Specified by:
        getAdditionalProposalInfo in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension5
      • isAutoInsertable

        public boolean isAutoInsertable()
        Specified by:
        isAutoInsertable in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension4
      • apply

        public void apply​(org.eclipse.jface.text.ITextViewer viewer,
                          char trigger,
                          int stateMask,
                          int offset)
        Specified by:
        apply in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension2
      • selected

        public void selected​(org.eclipse.jface.text.ITextViewer viewer,
                             boolean smartToggle)
        Specified by:
        selected in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension2
      • unselected

        public void unselected​(org.eclipse.jface.text.ITextViewer viewer)
        Specified by:
        unselected in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension2
      • validate

        public boolean validate​(org.eclipse.jface.text.IDocument document,
                                int offset,
                                org.eclipse.jface.text.DocumentEvent event)
        Specified by:
        validate in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension2
      • setPriorityHelper

        public void setPriorityHelper​(ITemplatePriorityHelper priorityHelper)
        Sets the priority helper that helps to adjust proposal's priority
        Parameters:
        priorityHelper - The priority helper to help to adjust priority, can be null