public final class CompletionProposal extends Object implements ICompletionProposal
ICompletionProposal
interface.Constructor and Description |
---|
CompletionProposal(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.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(IDocument document)
Inserts the proposed completion into the given document.
|
String |
getAdditionalProposalInfo()
Returns optional additional information about the proposal.
|
IContextInformation |
getContextInformation()
Returns optional context information associated with this proposal.
|
String |
getDisplayString()
Returns the string to be displayed in the list of completion proposals.
|
Image |
getImage()
Returns the image to be displayed in the list of completion proposals.
|
Point |
getSelection(IDocument document)
Returns the new selection after the proposal has been applied to
the given document in absolute document coordinates.
|
public CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition)
null
.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 replacementOffsetpublic CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo)
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 proposalpublic void apply(IDocument document)
ICompletionProposal
apply
in interface ICompletionProposal
document
- the document into which to insert the proposed completionpublic Point getSelection(IDocument document)
ICompletionProposal
null
, 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 during ICompletionProposal.apply(IDocument)
.getSelection
in interface ICompletionProposal
document
- the document into which the proposed completion has been insertedpublic IContextInformation getContextInformation()
ICompletionProposal
getContextInformation
in interface ICompletionProposal
null
public Image getImage()
ICompletionProposal
getImage
in interface ICompletionProposal
null
if no image is desiredpublic String getDisplayString()
ICompletionProposal
getDisplayString
in interface ICompletionProposal
ICompletionProposalExtension6.getStyledDisplayString()
public String getAdditionalProposalInfo()
ICompletionProposal
If ICompletionProposalExtension5
is implemented, this method should not be called any
longer. This method may be deprecated in a future release.
getAdditionalProposalInfo
in interface ICompletionProposal
null
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.