## org.eclipse.datatools.sqltools.sqleditor.internal.templates
Class PositionBasedCompletionProposal

    java.lang.Object
      org.eclipse.datatools.sqltools.sqleditor.internal.templates.PositionBasedCompletionProposal

All Implemented Interfaces:
  org.eclipse.jface.text.contentassist.ICompletionProposal, org.eclipse.jface.text.contentassist.ICompletionProposalExtension2

    public class PositionBasedCompletionProposal

extends java.lang.Object
implements org.eclipse.jface.text.contentassist.ICompletionProposal, org.eclipse.jface.text.contentassist.ICompletionProposalExtension2

An enhanced implementation of the `ICompletionProposal` interface implementing all the extension interfaces.

Since:
  3.0

Constructor Summary
`PositionBasedCompletionProposal(java.lang.String replacementString, org.eclipse.jface.text.Position replacementPosition, int cursorPosition)` Creates a new completion proposal based on the provided information.
`PositionBasedCompletionProposal(java.lang.String replacementString, org.eclipse.jface.text.Position replacementPosition, int cursorPosition, org.eclipse.swt.graphics.Image image, java.lang.String displayString, org.eclipse.jface.text.contentassist.IContextInformation contextInformation, java.lang.String additionalProposalInfo)` Creates a new completion proposal.

Method Summary
`void` `apply(org.eclipse.jface.text.IDocument document)`
`void` `apply(org.eclipse.jface.text.ITextViewer viewer, char trigger, int stateMask, int offset)`
`java.lang.String` `getAdditionalProposalInfo()`
`org.eclipse.jface.text.contentassist.IContextInformation` `getContextInformation()`
`java.lang.String` `getDisplayString()`
`org.eclipse.swt.graphics.Image` `getImage()`
`org.eclipse.swt.graphics.Point` `getSelection(org.eclipse.jface.text.IDocument document)`
`void` `selected(org.eclipse.jface.text.ITextViewer viewer, boolean smartToggle)`
`void` `unselected(org.eclipse.jface.text.ITextViewer viewer)`
`boolean` `validate(org.eclipse.jface.text.IDocument document, int offset, org.eclipse.jface.text.DocumentEvent event)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PositionBasedCompletionProposal

    public PositionBasedCompletionProposal(java.lang.String replacementString,
                                           org.eclipse.jface.text.Position replacementPosition,
                                           int cursorPosition)

  Creates a new completion proposal based on the provided information. The replacement string is considered being the display string too. All remaining fields are set to `null`.

  Parameters:
    `replacementString` - the actual string to be inserted into the document
    `replacementPosition` - the position of the text to be replaced
    `cursorPosition` - the position of the cursor following the insert relative to replacementOffset

### PositionBasedCompletionProposal

    public PositionBasedCompletionProposal(java.lang.String replacementString,
                                           org.eclipse.jface.text.Position replacementPosition,
                                           int cursorPosition,
                                           org.eclipse.swt.graphics.Image image,
                                           java.lang.String displayString,
                                           org.eclipse.jface.text.contentassist.IContextInformation contextInformation,
                                           java.lang.String additionalProposalInfo)

  Creates a new completion proposal. All fields are initialized based on the provided information.

  Parameters:
    `replacementString` - the actual string to be inserted into the document
    `replacementPosition` - the position of the text to be replaced
    `cursorPosition` - the position of the cursor following the insert relative to replacementOffset
    `image` - the image to display for this proposal
    `displayString` - the string to be displayed for the proposal
    `contextInformation` - the context information associated with this proposal
    `additionalProposalInfo` - the additional information associated with this proposal

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`

### getContextInformation

    public org.eclipse.jface.text.contentassist.IContextInformation getContextInformation()

  Specified by:
    `getContextInformation` 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`

### getDisplayString

    public java.lang.String getDisplayString()

  Specified by:
    `getDisplayString` in interface `org.eclipse.jface.text.contentassist.ICompletionProposal`

### getAdditionalProposalInfo

    public java.lang.String getAdditionalProposalInfo()

  Specified by:
    `getAdditionalProposalInfo` in interface `org.eclipse.jface.text.contentassist.ICompletionProposal`

### 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`