Interface ICompletionProposalExtension2
- All Known Implementing Classes:
TemplateProposal
public interface ICompletionProposalExtension2
Extends
ICompletionProposal
with the following functions:
- handling of trigger characters with modifiers
- visual indication for selection of a proposal
- Since:
- 2.1
-
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(ITextViewer viewer, char trigger, int stateMask, int offset) Applies the proposed completion to the given document.void
selected
(ITextViewer viewer, boolean smartToggle) Called when the proposal is selected.void
unselected
(ITextViewer viewer) Called when the proposal is unselected.boolean
validate
(IDocument document, int offset, DocumentEvent event) Requests the proposal to be validated with respect to the document event.
-
Method Details
-
apply
Applies the proposed completion to the given document. The insertion has been triggered by entering the given character with a modifier at the given offset. This method assumes thatvalidate(IDocument, int, DocumentEvent)
returnstrue
if called foroffset
.- Parameters:
viewer
- the text viewer into which to insert the proposed completiontrigger
- the trigger to apply the completionstateMask
- the state mask of the modifiersoffset
- the offset at which the trigger has been activated
-
selected
Called when the proposal is selected.- Parameters:
viewer
- the text viewer.smartToggle
- the smart toggle key was pressed
-
unselected
Called when the proposal is unselected.- Parameters:
viewer
- the text viewer.
-
validate
Requests the proposal to be validated with respect to the document event. If the proposal cannot be validated, the methods returnsfalse
. If the document event wasnull
, only the caret offset was changed, but not the document. This method replacesICompletionProposalExtension.isValidFor(IDocument, int)
- Parameters:
document
- the documentoffset
- the caret offsetevent
- the document event, may benull
- Returns:
- boolean
-