org.eclipse.cdt.internal.ui.text.contentassist
Class CCompletionProposal

java.lang.Object
  extended by org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProposal
All Implemented Interfaces:
ICCompletionProposal, org.eclipse.jface.text.contentassist.ICompletionProposal, org.eclipse.jface.text.contentassist.ICompletionProposalExtension, org.eclipse.jface.text.contentassist.ICompletionProposalExtension2, org.eclipse.jface.text.contentassist.ICompletionProposalExtension3

public class CCompletionProposal
extends java.lang.Object
implements ICCompletionProposal, org.eclipse.jface.text.contentassist.ICompletionProposalExtension, org.eclipse.jface.text.contentassist.ICompletionProposalExtension2, org.eclipse.jface.text.contentassist.ICompletionProposalExtension3


Constructor Summary
CCompletionProposal(java.lang.String replacementString, int replacementOffset, int replacementLength, org.eclipse.swt.graphics.Image image, java.lang.String displayString, int relevance)
          Creates a new completion proposal.
CCompletionProposal(java.lang.String replacementString, int replacementOffset, int replacementLength, org.eclipse.swt.graphics.Image image, java.lang.String displayString, int relevance, org.eclipse.jface.text.ITextViewer viewer)
          Creates a new completion proposal.
CCompletionProposal(java.lang.String replacementString, int replacementOffset, int replacementLength, org.eclipse.swt.graphics.Image image, java.lang.String displayString, java.lang.String idString, int relevance, org.eclipse.jface.text.ITextViewer viewer)
          Creates a new completion proposal.
 
Method Summary
 void apply(org.eclipse.jface.text.IDocument document)
           
 void apply(org.eclipse.jface.text.IDocument document, char trigger, int offset)
           
 void apply(org.eclipse.jface.text.ITextViewer viewer, char trigger, int stateMask, int offset)
           
 boolean equals(java.lang.Object other)
           
 java.lang.String getAdditionalProposalInfo()
           
 org.eclipse.jface.text.contentassist.IContextInformation getContextInformation()
           
 int getContextInformationPosition()
           
 java.lang.String getDisplayString()
           
 java.lang.String getIdString()
          This method is used by the comparator to compare proposals.
 org.eclipse.swt.graphics.Image getImage()
           
 org.eclipse.jface.text.IInformationControlCreator getInformationControlCreator()
           
 int getPrefixCompletionStart(org.eclipse.jface.text.IDocument document, int completionOffset)
           
 java.lang.CharSequence getPrefixCompletionText(org.eclipse.jface.text.IDocument document, int completionOffset)
           
 int getRelevance()
          Gets the proposal's relevance.
 int getReplacementLength()
          Gets the replacement length.
 int getReplacementOffset()
          Gets the replacement offset.
 java.lang.String getReplacementString()
          Gets the replacement string.
 org.eclipse.swt.graphics.Point getSelection(org.eclipse.jface.text.IDocument document)
           
 char[] getTriggerCharacters()
           
 int hashCode()
           
 boolean isValidFor(org.eclipse.jface.text.IDocument document, int offset)
           
 void selected(org.eclipse.jface.text.ITextViewer viewer, boolean smartToggle)
           
 void setAdditionalProposalInfo(java.lang.String proposalInfo)
          Sets the proposal info.
 void setContextInformation(org.eclipse.jface.text.contentassist.IContextInformation contextInformation)
          Sets the context information.
 void setCursorPosition(int cursorPosition)
          Sets the cursor position relative to the insertion offset.
 void setImage(org.eclipse.swt.graphics.Image image)
          Sets the image.
 void setRelevance(int relevance)
          Sets the proposal's relevance.
 void setReplacementLength(int replacementLength)
          Sets the replacement length.
 void setReplacementOffset(int replacementOffset)
          Sets the replacement offset.
 void setReplacementString(java.lang.String replacementString)
          Sets the replacement string.
 void setTriggerCharacters(char[] triggerCharacters)
          Sets the trigger characters.
 void unselected(org.eclipse.jface.text.ITextViewer viewer)
           
 void updateReplacementLength(int length)
           
 void updateReplacementOffset(int newOffset)
           
 boolean validate(org.eclipse.jface.text.IDocument document, int offset, org.eclipse.jface.text.DocumentEvent event)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CCompletionProposal

public CCompletionProposal(java.lang.String replacementString,
                           int replacementOffset,
                           int replacementLength,
                           org.eclipse.swt.graphics.Image image,
                           java.lang.String displayString,
                           int relevance)
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
image - the image to display for this proposal
displayString - the string to be displayed for the proposal If set to null, the replacement string will be taken as display string.

CCompletionProposal

public CCompletionProposal(java.lang.String replacementString,
                           int replacementOffset,
                           int replacementLength,
                           org.eclipse.swt.graphics.Image image,
                           java.lang.String displayString,
                           int relevance,
                           org.eclipse.jface.text.ITextViewer viewer)
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
image - the image to display for this proposal
displayString - the string to be displayed for the proposal
viewer - the text viewer for which this proposal is computed, may be null If set to null, the replacement string will be taken as display string.

CCompletionProposal

public CCompletionProposal(java.lang.String replacementString,
                           int replacementOffset,
                           int replacementLength,
                           org.eclipse.swt.graphics.Image image,
                           java.lang.String displayString,
                           java.lang.String idString,
                           int relevance,
                           org.eclipse.jface.text.ITextViewer viewer)
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
image - the image to display for this proposal
displayString - the string to be displayed for the proposal
idString - the string to be uniquely identify this proposal
viewer - the text viewer for which this proposal is computed, may be null If set to null, the replacement string will be taken as display string.
Method Detail

setContextInformation

public void setContextInformation(org.eclipse.jface.text.contentassist.IContextInformation contextInformation)
Sets the context information.

Parameters:
contextInformation - The context information associated with this proposal

setTriggerCharacters

public void setTriggerCharacters(char[] triggerCharacters)
Sets the trigger characters.

Parameters:
triggerCharacters - The set of characters which can trigger the application of this completion proposal

setAdditionalProposalInfo

public void setAdditionalProposalInfo(java.lang.String proposalInfo)
Sets the proposal info.

Parameters:
proposalInfo - The additional information associated with this proposal or null

setCursorPosition

public void setCursorPosition(int cursorPosition)
Sets the cursor position relative to the insertion offset. By default this is the length of the completion string (Cursor positioned after the completion)

Parameters:
cursorPosition - The cursorPosition to set

apply

public void apply(org.eclipse.jface.text.IDocument document,
                  char trigger,
                  int offset)
Specified by:
apply in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension

apply

public void apply(org.eclipse.jface.text.IDocument document)
Specified by:
apply in interface org.eclipse.jface.text.contentassist.ICompletionProposal

getSelection

public org.eclipse.swt.graphics.Point getSelection(org.eclipse.jface.text.IDocument document)
Specified by:
getSelection in interface org.eclipse.jface.text.contentassist.ICompletionProposal

getContextInformation

public org.eclipse.jface.text.contentassist.IContextInformation getContextInformation()
Specified by:
getContextInformation in interface org.eclipse.jface.text.contentassist.ICompletionProposal

getImage

public org.eclipse.swt.graphics.Image getImage()
Specified by:
getImage in interface org.eclipse.jface.text.contentassist.ICompletionProposal

getDisplayString

public java.lang.String getDisplayString()
Specified by:
getDisplayString in interface org.eclipse.jface.text.contentassist.ICompletionProposal

getIdString

public java.lang.String getIdString()
This method is used by the comparator to compare proposals. It ignores the return type of a function.

Specified by:
getIdString in interface ICCompletionProposal
Returns:
the string representing the display name without the return type (if any).

getAdditionalProposalInfo

public java.lang.String getAdditionalProposalInfo()
Specified by:
getAdditionalProposalInfo in interface org.eclipse.jface.text.contentassist.ICompletionProposal

getTriggerCharacters

public char[] getTriggerCharacters()
Specified by:
getTriggerCharacters in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension

getContextInformationPosition

public int getContextInformationPosition()
Specified by:
getContextInformationPosition in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension

getReplacementOffset

public int getReplacementOffset()
Gets the replacement offset.

Returns:
Returns a int

getPrefixCompletionStart

public int getPrefixCompletionStart(org.eclipse.jface.text.IDocument document,
                                    int completionOffset)
Specified by:
getPrefixCompletionStart in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension3

setReplacementOffset

public void setReplacementOffset(int replacementOffset)
Sets the replacement offset.

Parameters:
replacementOffset - The replacement offset to set

getReplacementLength

public int getReplacementLength()
Gets the replacement length.

Returns:
Returns a int

setReplacementLength

public void setReplacementLength(int replacementLength)
Sets the replacement length.

Parameters:
replacementLength - The replacementLength to set

getReplacementString

public java.lang.String getReplacementString()
Gets the replacement string.

Returns:
Returns a String

getPrefixCompletionText

public java.lang.CharSequence getPrefixCompletionText(org.eclipse.jface.text.IDocument document,
                                                      int completionOffset)
Specified by:
getPrefixCompletionText in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension3

setReplacementString

public void setReplacementString(java.lang.String replacementString)
Sets the replacement string.

Parameters:
replacementString - The replacement string to set

setImage

public void setImage(org.eclipse.swt.graphics.Image image)
Sets the image.

Parameters:
image - The image to set

isValidFor

public boolean isValidFor(org.eclipse.jface.text.IDocument document,
                          int offset)
Specified by:
isValidFor in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension

validate

public boolean validate(org.eclipse.jface.text.IDocument document,
                        int offset,
                        org.eclipse.jface.text.DocumentEvent event)
Specified by:
validate in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension2

getRelevance

public int getRelevance()
Gets the proposal's relevance.

Specified by:
getRelevance in interface ICCompletionProposal
Returns:
Returns a int

setRelevance

public void setRelevance(int relevance)
Sets the proposal's relevance.

Parameters:
relevance - The relevance to set

apply

public void apply(org.eclipse.jface.text.ITextViewer viewer,
                  char trigger,
                  int stateMask,
                  int offset)
Specified by:
apply in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension2

selected

public void selected(org.eclipse.jface.text.ITextViewer viewer,
                     boolean smartToggle)
Specified by:
selected in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension2

unselected

public void unselected(org.eclipse.jface.text.ITextViewer viewer)
Specified by:
unselected in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension2

getInformationControlCreator

public org.eclipse.jface.text.IInformationControlCreator getInformationControlCreator()
Specified by:
getInformationControlCreator in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension3

updateReplacementOffset

public void updateReplacementOffset(int newOffset)

updateReplacementLength

public void updateReplacementLength(int length)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object