LPEX
4.4.0

com.ibm.lpex.alef.contentassist
Class CompletionProposal

java.lang.Object
  extended by com.ibm.lpex.alef.contentassist.CompletionProposal
All Implemented Interfaces:
ICompletionProposal

public final class CompletionProposal
extends Object
implements ICompletionProposal

The standard LPEX implementation of the ICompletionProposal interface.


Constructor Summary
CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition)
          Create a new completion proposal based on the information provided.
CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo)
          Create a new completion proposal.
 
Method Summary
 void apply(LpexTextViewer viewer)
          In LPEX, we apply against the LpexTextViewer directly, not its document.
 String getAdditionalProposalInfo()
          Return optional additional information about the proposal.
 IContextInformation getContextInformation()
          Return optional context information associated with this proposal.
 String getDisplayString()
          Return the string to be displayed in the list of completion proposals.
 Image getImage()
          Return the image to be displayed in the list of completion proposals.
 
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)
Create a new completion proposal based on the information provided. 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 relative to the current cursor position (i.e., 0 or < 0)
replacementLength - the length of the text to be replaced
cursorPosition - N/U (in Eclipse: 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)
Create 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 relative to the current cursor position (i.e., 0 or < 0)
replacementLength - the length of the text to be replaced
cursorPosition - N/U (in Eclipse: 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
Method Detail

apply

public void apply(LpexTextViewer viewer)
In LPEX, we apply against the LpexTextViewer directly, not its document. The proposal is applied at an offset defined as relative to the current cursor position (which is located somewhere inside the final word that we want upon completion); the offset, therefore, is 0 or the negative number of positions prior to the cursor.

Specified by:
apply in interface ICompletionProposal
Parameters:
viewer - the LpexTextViewer into whose document the proposed completion should be inserted

getContextInformation

public IContextInformation getContextInformation()
Description copied from interface: ICompletionProposal
Return 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
Return 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
Return 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
Return 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

LPEX
4.4.0

Copyright � 2016 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.