org.eclipse.jface.text.contentassist
Class CompletionProposal
java.lang.Object
org.eclipse.jface.text.contentassist.CompletionProposal
-
All Implemented Interfaces:
-
ICompletionProposal
-
public final class CompletionProposal
- extends
Object
- implements
ICompletionProposal
The standard implementation of the ICompletionProposal
interface.
Constructor Summary
|
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. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
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 to
null
.
-
Parameters:
-
replacementString
- the actual string to be inserted into the document -
replacementOffset
- the offset of the text to be replaced -
replacementLength
- the length of the text to be replaced -
cursorPosition
- 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 document -
replacementOffset
- the offset of the text to be replaced -
replacementLength
- the length 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
apply
public void apply(
IDocument document)
-
Description copied from interface:
ICompletionProposal
- Inserts the proposed completion into the given document.
-
-
Specified by:
-
apply
in interface
ICompletionProposal
-
-
Parameters:
-
document
- the document into which to insert the proposed completion
getSelection
public
Point getSelection(
IDocument document)
-
Description copied from interface:
ICompletionProposal
- Returns the new selection after the proposal has been applied to
the given document in absolute document coordinates. If it returns
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)
.
-
-
Specified by:
-
getSelection
in interface
ICompletionProposal
-
-
Parameters:
-
document
- the document into which the proposed completion has been inserted
-
Returns:
- the new selection in absolute document coordinates
getContextInformation
public
IContextInformation getContextInformation()
-
Description copied from interface:
ICompletionProposal
- Returns optional context information associated with this proposal.
The context information will automatically be shown if the proposal
has been applied.
-
-
Specified by:
-
getContextInformation
in interface
ICompletionProposal
-
-
Returns:
- the context information for this proposal or
null
getImage
public
Image getImage()
-
Description copied from interface:
ICompletionProposal
- Returns 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:
-
getImage
in interface
ICompletionProposal
-
-
Returns:
- the image to be shown or
null
if no image is desired
getDisplayString
public
String getDisplayString()
-
Description copied from interface:
ICompletionProposal
- Returns the string to be displayed in the list of completion proposals.
-
-
Specified by:
-
getDisplayString
in interface
ICompletionProposal
-
-
Returns:
- the string to be displayed
-
See Also:
-
ICompletionProposalExtension6.getStyledDisplayString()
getAdditionalProposalInfo
public
String getAdditionalProposalInfo()
-
Description copied from interface:
ICompletionProposal
- Returns 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
ICompletionProposalExtension5
is implemented, this method should not be called any
longer. This method may be deprecated in a future release.
-
-
Specified by:
-
getAdditionalProposalInfo
in interface
ICompletionProposal
-
-
Returns:
- the additional information or
null
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.