Class CompletionProposal
java.lang.Object
org.eclipse.jface.text.contentassist.CompletionProposal
- All Implemented Interfaces:
ICompletionProposal
The standard implementation of the
ICompletionProposal interface.-
Constructor Summary
ConstructorsConstructorDescriptionCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition) Creates a new completion proposal based on the provided information.CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo) Creates a new completion proposal. -
Method Summary
Modifier and TypeMethodDescriptionvoidInserts the proposed completion into the given document.Returns optional additional information about the proposal.Returns optional context information associated with this proposal.Returns the string to be displayed in the list of completion proposals.getImage()Returns the image to be displayed in the list of completion proposals.getSelection(IDocument document) Returns the new selection after the proposal has been applied to the given document in absolute document coordinates.
-
Constructor Details
-
CompletionProposal
public CompletionProposal(String replacementString, int replacementOffset, int replacementLength, 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 tonull.- Parameters:
replacementString- the actual string to be inserted into the documentreplacementOffset- the offset of the text to be replacedreplacementLength- the length of the text to be replacedcursorPosition- the position of the cursor following the insert relative to replacementOffset
-
CompletionProposal
public CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, 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 documentreplacementOffset- the offset of the text to be replacedreplacementLength- the length of the text to be replacedcursorPosition- the position of the cursor following the insert relative to replacementOffsetimage- the image to display for this proposaldisplayString- the string to be displayed for the proposalcontextInformation- the context information associated with this proposaladditionalProposalInfo- the additional information associated with this proposal
-
-
Method Details
-
apply
Description copied from interface:ICompletionProposalInserts the proposed completion into the given document.- Specified by:
applyin interfaceICompletionProposal- Parameters:
document- the document into which to insert the proposed completion
-
getSelection
Description copied from interface:ICompletionProposalReturns the new selection after the proposal has been applied to the given document in absolute document coordinates. If it returnsnull, no new selection is set. A document change can trigger other document changes, which have to be taken into account when calculating the new selection. Typically, this would be done by installing a document listener or by using a document position duringICompletionProposal.apply(IDocument).- Specified by:
getSelectionin interfaceICompletionProposal- Parameters:
document- the document into which the proposed completion has been inserted- Returns:
- the new selection in absolute document coordinates
-
getContextInformation
Description copied from interface:ICompletionProposalReturns optional context information associated with this proposal. The context information will automatically be shown if the proposal has been applied.- Specified by:
getContextInformationin interfaceICompletionProposal- Returns:
- the context information for this proposal or
null
-
getImage
Description copied from interface:ICompletionProposalReturns the image to be displayed in the list of completion proposals. The image would typically be shown to the left of the display string.- Specified by:
getImagein interfaceICompletionProposal- Returns:
- the image to be shown or
nullif no image is desired
-
getDisplayString
Description copied from interface:ICompletionProposalReturns the string to be displayed in the list of completion proposals.- Specified by:
getDisplayStringin interfaceICompletionProposal- Returns:
- the string to be displayed
- See Also:
-
getAdditionalProposalInfo
Description copied from interface:ICompletionProposalReturns optional additional information about the proposal. The additional information will be presented to assist the user in deciding if the selected proposal is the desired choice.If
ICompletionProposalExtension5is implemented, this method should not be called any longer. This method may be deprecated in a future release.- Specified by:
getAdditionalProposalInfoin interfaceICompletionProposal- Returns:
- the additional information or
null
-