Eclipse Platform
2.0

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.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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
additionalProposalInfo - the additional information associated with this proposal
Method Detail

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.

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

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.

Specified by:
getAdditionalProposalInfo in interface ICompletionProposal
Returns:
the additional information or null

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.