org.eclipse.xtext.ui.editor.quickfix
Class QuickAssistCompletionProposal

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.quickfix.QuickAssistCompletionProposal
All Implemented Interfaces:
org.eclipse.jface.text.contentassist.ICompletionProposal, org.eclipse.jface.text.contentassist.ICompletionProposalExtension3

public class QuickAssistCompletionProposal
extends java.lang.Object
implements org.eclipse.jface.text.contentassist.ICompletionProposal, org.eclipse.jface.text.contentassist.ICompletionProposalExtension3


Constructor Summary
QuickAssistCompletionProposal(org.eclipse.jface.text.Position pos, IssueResolution resolution, org.eclipse.swt.graphics.Image image)
           
 
Method Summary
 void apply(org.eclipse.jface.text.IDocument document)
          Inserts the proposed completion into the given document.
 java.lang.String getAdditionalProposalInfo()
          Returns optional additional information about the proposal.
 org.eclipse.jface.text.contentassist.IContextInformation getContextInformation()
          Returns optional context information associated with this proposal.
 java.lang.String getDisplayString()
          Returns the string to be displayed in the list of completion proposals.
 org.eclipse.swt.graphics.Image getImage()
          Returns the image to be displayed in the list of completion proposals.
 org.eclipse.jface.text.IInformationControlCreator getInformationControlCreator()
          Returns the information control creator of this completion proposal.
 int getPrefixCompletionStart(org.eclipse.jface.text.IDocument document, int completionOffset)
          Returns the document offset at which the receiver would insert its proposal.
 java.lang.CharSequence getPrefixCompletionText(org.eclipse.jface.text.IDocument document, int completionOffset)
          Returns the string that would be inserted at the position returned from ICompletionProposalExtension3.getPrefixCompletionStart(IDocument, int) if this proposal was applied.
 org.eclipse.swt.graphics.Point getSelection(org.eclipse.jface.text.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

QuickAssistCompletionProposal

public QuickAssistCompletionProposal(org.eclipse.jface.text.Position pos,
                                     IssueResolution resolution,
                                     org.eclipse.swt.graphics.Image image)
Method Detail

apply

public void apply(org.eclipse.jface.text.IDocument document)
Description copied from interface: org.eclipse.jface.text.contentassist.ICompletionProposal
Inserts the proposed completion into the given document.

Specified by:
apply in interface org.eclipse.jface.text.contentassist.ICompletionProposal
Parameters:
document - the document into which to insert the proposed completion

getSelection

public org.eclipse.swt.graphics.Point getSelection(org.eclipse.jface.text.IDocument document)
Description copied from interface: org.eclipse.jface.text.contentassist.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 org.eclipse.jface.text.contentassist.ICompletionProposal
Parameters:
document - the document into which the proposed completion has been inserted
Returns:
the new selection in absolute document coordinates

getAdditionalProposalInfo

public java.lang.String getAdditionalProposalInfo()
Description copied from interface: org.eclipse.jface.text.contentassist.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 org.eclipse.jface.text.contentassist.ICompletionProposal
Returns:
the additional information or null

getDisplayString

public java.lang.String getDisplayString()
Description copied from interface: org.eclipse.jface.text.contentassist.ICompletionProposal
Returns the string to be displayed in the list of completion proposals.

Specified by:
getDisplayString in interface org.eclipse.jface.text.contentassist.ICompletionProposal
Returns:
the string to be displayed
See Also:
ICompletionProposalExtension6.getStyledDisplayString()

getImage

public org.eclipse.swt.graphics.Image getImage()
Description copied from interface: org.eclipse.jface.text.contentassist.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 org.eclipse.jface.text.contentassist.ICompletionProposal
Returns:
the image to be shown or null if no image is desired

getContextInformation

public org.eclipse.jface.text.contentassist.IContextInformation getContextInformation()
Description copied from interface: org.eclipse.jface.text.contentassist.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 org.eclipse.jface.text.contentassist.ICompletionProposal
Returns:
the context information for this proposal or null

getInformationControlCreator

public org.eclipse.jface.text.IInformationControlCreator getInformationControlCreator()
Description copied from interface: org.eclipse.jface.text.contentassist.ICompletionProposalExtension3
Returns the information control creator of this completion proposal.

Specified by:
getInformationControlCreator in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension3
Returns:
the information control creator, or null if no custom control creator is available

getPrefixCompletionStart

public int getPrefixCompletionStart(org.eclipse.jface.text.IDocument document,
                                    int completionOffset)
Description copied from interface: org.eclipse.jface.text.contentassist.ICompletionProposalExtension3
Returns the document offset at which the receiver would insert its proposal.

Specified by:
getPrefixCompletionStart in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension3
Parameters:
document - the document that the receiver applies to
completionOffset - the offset into document where the completion takes place
Returns:
the offset at which the proposal would insert its proposal

getPrefixCompletionText

public java.lang.CharSequence getPrefixCompletionText(org.eclipse.jface.text.IDocument document,
                                                      int completionOffset)
Description copied from interface: org.eclipse.jface.text.contentassist.ICompletionProposalExtension3
Returns the string that would be inserted at the position returned from ICompletionProposalExtension3.getPrefixCompletionStart(IDocument, int) if this proposal was applied. If the replacement string cannot be determined, null may be returned.

Specified by:
getPrefixCompletionText in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension3
Parameters:
document - the document that the receiver applies to
completionOffset - the offset into document where the completion takes place
Returns:
the replacement string or null if it cannot be determined