Eclipse Platform
Release 3.0

org.eclipse.jface.text.contentassist
Interface ICompletionProposalExtension2

All Known Implementing Classes:
TemplateProposal

public interface ICompletionProposalExtension2

Extends ICompletionProposal with the following functions:

Since:
2.1

Method Summary
 void 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 Detail

apply

public void apply(ITextViewer viewer,
                  char trigger,
                  int stateMask,
                  int offset)
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 that validate(IDocument, int, DocumentEvent) returns true if called for offset.

Parameters:
viewer - the text viewer into which to insert the proposed completion
trigger - the trigger to apply the completion
stateMask - the state mask of the modifiers
offset - the offset at which the trigger has been activated

selected

public void selected(ITextViewer viewer,
                     boolean smartToggle)
Called when the proposal is selected.

Parameters:
viewer - the text viewer.
smartToggle - the smart toggle key was pressed

unselected

public void unselected(ITextViewer viewer)
Called when the proposal is unselected.

Parameters:
viewer - the text viewer.

validate

public boolean validate(IDocument document,
                        int offset,
                        DocumentEvent event)
Requests the proposal to be validated with respect to the document event. If the proposal cannot be validated, the methods returns false. If the document event was null, only the caret offset was changed, but not the document. This method replaces ICompletionProposalExtension.isValidFor(IDocument, int)

Parameters:
document - the document
offset - the caret offset
event - the document event, may be null
Returns:
boolean

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.