|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal
public class ConfigurableCompletionProposal
| Nested Class Summary | |
|---|---|
protected static class |
ConfigurableCompletionProposal.ExitPolicy
|
static interface |
ConfigurableCompletionProposal.IReplacementTextApplier
|
| Constructor Summary | |
|---|---|
ConfigurableCompletionProposal(java.lang.String replacementString,
int replacementOffset,
int replacementLength,
int cursorPosition)
Creates a new completion proposal based on the provided information. |
|
ConfigurableCompletionProposal(java.lang.String replacementString,
int replacementOffset,
int replacementLength,
int cursorPosition,
org.eclipse.swt.graphics.Image image,
org.eclipse.jface.viewers.StyledString displayString,
org.eclipse.jface.text.contentassist.IContextInformation contextInformation,
java.lang.String additionalProposalInfo)
Creates a new completion proposal. |
|
| Method Summary | |
|---|---|
void |
apply(org.eclipse.jface.text.IDocument document)
Inserts the proposed completion into the given document. |
void |
apply(org.eclipse.jface.text.ITextViewer viewer,
char trigger,
int stateMask,
int offset)
Applies the proposed completion to the given document. |
int |
compareTo(ConfigurableCompletionProposal other)
|
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
getAdditionalProposalInfo()
Returns optional additional information about the proposal. |
java.lang.Object |
getAdditionalProposalInfo(org.eclipse.core.runtime.IProgressMonitor monitor)
Returns additional information about the proposal. |
org.eclipse.jface.text.contentassist.IContextInformation |
getContextInformation()
Returns optional context information associated with this proposal. |
int |
getCursorPosition()
|
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. |
PrefixMatcher |
getMatcher()
|
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. |
int |
getPriority()
|
int |
getReplaceContextLength()
|
int |
getReplacementLength()
|
int |
getReplacementOffset()
|
java.lang.String |
getReplacementString()
|
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. |
int |
getSelectionLength()
|
int |
getSelectionStart()
|
org.eclipse.jface.viewers.StyledString |
getStyledDisplayString()
Returns the styled string used to display this proposal in the list of completion proposals. |
ConfigurableCompletionProposal.IReplacementTextApplier |
getTextApplier()
|
int |
hashCode()
|
boolean |
isAutoInsertable()
Returns true if the proposal may be automatically
inserted, false otherwise. |
void |
selected(org.eclipse.jface.text.ITextViewer viewer,
boolean smartToggle)
Called when the proposal is selected. |
void |
setAdditionalProposalInfo(java.lang.Object additionalProposalInfo)
|
void |
setAutoInsertable(boolean autoInsertable)
|
void |
setContextInformation(org.eclipse.jface.text.contentassist.IContextInformation contextInformation)
|
void |
setCursorPosition(int cursorPosition)
|
void |
setDisplayString(java.lang.String displayString)
|
void |
setDisplayString(org.eclipse.jface.viewers.StyledString displayString)
|
void |
setHover(IEObjectHover hover)
|
void |
setImage(org.eclipse.swt.graphics.Image image)
|
void |
setMatcher(PrefixMatcher matcher)
|
void |
setPriority(int priority)
|
void |
setReplaceContextLength(int replaceContextLength)
|
void |
setReplacementLength(int replacementLength)
|
void |
setReplacementOffset(int replacementOffset)
|
void |
setReplacementString(java.lang.String replacementString)
|
void |
setSelectionLength(int selectionLength)
|
void |
setSelectionStart(int selectionStart)
|
void |
setSimpleLinkedMode(org.eclipse.jface.text.ITextViewer viewer,
char... exitChars)
|
void |
setTextApplier(ConfigurableCompletionProposal.IReplacementTextApplier textApplier)
|
protected void |
setUpLinkedMode(org.eclipse.jface.text.IDocument document)
Sets up a simple linked mode at getCursorPosition() and an exit policy that will
exit the mode when closingCharacter is typed and an exit position at
getCursorPosition() + 1. |
java.lang.String |
toString()
|
void |
unselected(org.eclipse.jface.text.ITextViewer viewer)
Called when the proposal is unselected. |
boolean |
validate(org.eclipse.jface.text.IDocument document,
int offset,
org.eclipse.jface.text.DocumentEvent event)
Requests the proposal to be validated with respect to the document event. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ConfigurableCompletionProposal(java.lang.String replacementString,
int replacementOffset,
int replacementLength,
int cursorPosition)
null.
replacementString - the actual string to be inserted into the documentreplacementOffset - the offset of the text to be replacedreplacementLength - the length of the text to be replacedcursorPosition - the position of the cursor following the insert relative to replacementOffset
public ConfigurableCompletionProposal(java.lang.String replacementString,
int replacementOffset,
int replacementLength,
int cursorPosition,
org.eclipse.swt.graphics.Image image,
org.eclipse.jface.viewers.StyledString displayString,
org.eclipse.jface.text.contentassist.IContextInformation contextInformation,
java.lang.String additionalProposalInfo)
replacementString - the actual string to be inserted into the documentreplacementOffset - the offset of the text to be replacedreplacementLength - the length of the text to be replacedcursorPosition - the position of the cursor following the insert relative to replacementOffsetimage - the image to display for this proposaldisplayString - the string to be displayed for the proposalcontextInformation - the context information associated with this proposaladditionalProposalInfo - the additional information associated with this proposal| Method Detail |
|---|
public void apply(org.eclipse.jface.text.IDocument document)
org.eclipse.jface.text.contentassist.ICompletionProposal
apply in interface org.eclipse.jface.text.contentassist.ICompletionProposaldocument - the document into which to insert the proposed completionpublic org.eclipse.swt.graphics.Point getSelection(org.eclipse.jface.text.IDocument document)
org.eclipse.jface.text.contentassist.ICompletionProposalnull, 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).
getSelection in interface org.eclipse.jface.text.contentassist.ICompletionProposaldocument - the document into which the proposed completion has been inserted
public org.eclipse.jface.text.contentassist.IContextInformation getContextInformation()
org.eclipse.jface.text.contentassist.ICompletionProposal
getContextInformation in interface org.eclipse.jface.text.contentassist.ICompletionProposalnullpublic org.eclipse.swt.graphics.Image getImage()
org.eclipse.jface.text.contentassist.ICompletionProposal
getImage in interface org.eclipse.jface.text.contentassist.ICompletionProposalnull if no image is desiredpublic java.lang.String getDisplayString()
org.eclipse.jface.text.contentassist.ICompletionProposal
getDisplayString in interface org.eclipse.jface.text.contentassist.ICompletionProposalICompletionProposalExtension6.getStyledDisplayString()public org.eclipse.jface.viewers.StyledString getStyledDisplayString()
org.eclipse.jface.text.contentassist.ICompletionProposalExtension6
Note: ICompletionProposal.getDisplayString() still needs to be
correctly implemented as this method might be ignored in case of uninstalled owner draw
support.
getStyledDisplayString in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension6public java.lang.String getAdditionalProposalInfo()
org.eclipse.jface.text.contentassist.ICompletionProposal
If ICompletionProposalExtension5 is implemented, this method should not be called any
longer. This method may be deprecated in a future release.
getAdditionalProposalInfo in interface org.eclipse.jface.text.contentassist.ICompletionProposalnullpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean isAutoInsertable()
org.eclipse.jface.text.contentassist.ICompletionProposalExtension4true if the proposal may be automatically
inserted, false otherwise. Automatic insertion can
happen if the proposal is the only one being proposed, in which
case the content assistant may decide to not prompt the user with
a list of proposals, but simply insert the single proposal. A
proposal may veto this behavior by returning false
to a call to this method.
isAutoInsertable in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension4true if the proposal may be inserted
automatically, false if notpublic void setAutoInsertable(boolean autoInsertable)
public java.lang.String getReplacementString()
public int getReplacementOffset()
public int getReplacementLength()
public int getCursorPosition()
public void setDisplayString(java.lang.String displayString)
public void setDisplayString(org.eclipse.jface.viewers.StyledString displayString)
public void setReplacementString(java.lang.String replacementString)
public void setReplacementOffset(int replacementOffset)
public void setReplacementLength(int replacementLength)
public void setCursorPosition(int cursorPosition)
public void setImage(org.eclipse.swt.graphics.Image image)
public void setContextInformation(org.eclipse.jface.text.contentassist.IContextInformation contextInformation)
public void setAdditionalProposalInfo(java.lang.Object additionalProposalInfo)
public int getSelectionStart()
public int getSelectionLength()
public void setSelectionLength(int selectionLength)
public void setSelectionStart(int selectionStart)
public void setSimpleLinkedMode(org.eclipse.jface.text.ITextViewer viewer,
char... exitChars)
public void apply(org.eclipse.jface.text.ITextViewer viewer,
char trigger,
int stateMask,
int offset)
org.eclipse.jface.text.contentassist.ICompletionProposalExtension2ICompletionProposalExtension2.validate(IDocument, int, DocumentEvent)
returns true if called for offset.
apply in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension2viewer - the text viewer into which to insert the proposed completiontrigger - the trigger to apply the completionstateMask - the state mask of the modifiersoffset - the offset at which the trigger has been activated
public void selected(org.eclipse.jface.text.ITextViewer viewer,
boolean smartToggle)
org.eclipse.jface.text.contentassist.ICompletionProposalExtension2
selected in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension2viewer - the text viewer.smartToggle - the smart toggle key was pressedpublic void unselected(org.eclipse.jface.text.ITextViewer viewer)
org.eclipse.jface.text.contentassist.ICompletionProposalExtension2
unselected in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension2viewer - the text viewer.
public boolean validate(org.eclipse.jface.text.IDocument document,
int offset,
org.eclipse.jface.text.DocumentEvent event)
org.eclipse.jface.text.contentassist.ICompletionProposalExtension2false.
If the document event was null, only the caret offset was changed, but not the document.
This method replaces ICompletionProposalExtension.isValidFor(IDocument, int)
validate in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension2document - the documentoffset - the caret offsetevent - the document event, may be null
public void setMatcher(PrefixMatcher matcher)
public PrefixMatcher getMatcher()
public void setReplaceContextLength(int replaceContextLength)
public int getReplaceContextLength()
public void setPriority(int priority)
public int getPriority()
public int compareTo(ConfigurableCompletionProposal other)
compareTo in interface java.lang.Comparable<ConfigurableCompletionProposal>protected void setUpLinkedMode(org.eclipse.jface.text.IDocument document)
getCursorPosition() and an exit policy that will
exit the mode when closingCharacter is typed and an exit position at
getCursorPosition() + 1.
document - the documentclosingCharacter - the exit characterpublic void setTextApplier(ConfigurableCompletionProposal.IReplacementTextApplier textApplier)
public ConfigurableCompletionProposal.IReplacementTextApplier getTextApplier()
public org.eclipse.jface.text.IInformationControlCreator getInformationControlCreator()
org.eclipse.jface.text.contentassist.ICompletionProposalExtension3
getInformationControlCreator in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension3null if no custom control creator is available
public java.lang.CharSequence getPrefixCompletionText(org.eclipse.jface.text.IDocument document,
int completionOffset)
org.eclipse.jface.text.contentassist.ICompletionProposalExtension3ICompletionProposalExtension3.getPrefixCompletionStart(IDocument, int) if this proposal was
applied. If the replacement string cannot be determined,
null may be returned.
getPrefixCompletionText in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension3document - the document that the receiver applies tocompletionOffset - the offset into document where the
completion takes place
null if it cannot be
determined
public int getPrefixCompletionStart(org.eclipse.jface.text.IDocument document,
int completionOffset)
org.eclipse.jface.text.contentassist.ICompletionProposalExtension3
getPrefixCompletionStart in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension3document - the document that the receiver applies tocompletionOffset - the offset into document where the
completion takes place
public void setHover(IEObjectHover hover)
public java.lang.Object getAdditionalProposalInfo(org.eclipse.core.runtime.IProgressMonitor monitor)
org.eclipse.jface.text.contentassist.ICompletionProposalExtension5This method may be called on a non-UI thread.
By default, the returned information is converted to a string and displayed as text; if
ICompletionProposalExtension3.getInformationControlCreator() is implemented, the
information will be passed to a custom information control for display.
getAdditionalProposalInfo in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension5monitor - a monitor to report progress and to watch for
cancelation.
null for no informationpublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||