Class AtlCompletionProposal
- java.lang.Object
-
- org.eclipse.m2m.atl.adt.ui.text.atl.AtlCompletionProposal
-
- All Implemented Interfaces:
java.lang.Comparable<AtlCompletionProposal>,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 AtlCompletionProposal extends java.lang.Object implements org.eclipse.jface.text.contentassist.ICompletionProposalExtension, org.eclipse.jface.text.contentassist.ICompletionProposalExtension2, org.eclipse.jface.text.contentassist.ICompletionProposalExtension3, org.eclipse.jface.text.contentassist.ICompletionProposal, java.lang.Comparable<AtlCompletionProposal>
The ATL completion proposal definition.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAtlCompletionProposal.ExitPolicy
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.jface.text.ITextViewerfTextViewerprotected booleanfToggleEating
-
Constructor Summary
Constructors Constructor Description AtlCompletionProposal(java.lang.String replacementString, int replacementOffset, int replacementLength, org.eclipse.swt.graphics.Image image, java.lang.String displayString, int relevance, java.lang.String additionalProposalInfo)Creates a new completion proposal.AtlCompletionProposal(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, java.lang.String additionalProposalInfo)Creates a new completion proposal.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(org.eclipse.jface.text.IDocument document)voidapply(org.eclipse.jface.text.IDocument document, char trigger, int offset)voidapply(org.eclipse.jface.text.ITextViewer viewer, char trigger, int stateMask, int offset)intcompareTo(AtlCompletionProposal arg0)java.lang.StringgetAdditionalProposalInfo()org.eclipse.jface.text.contentassist.IContextInformationgetContextInformation()intgetContextInformationPosition()java.lang.StringgetDisplayString()org.eclipse.swt.graphics.ImagegetImage()org.eclipse.jface.text.IInformationControlCreatorgetInformationControlCreator()intgetPrefixCompletionStart(org.eclipse.jface.text.IDocument document, int completionOffset)java.lang.CharSequencegetPrefixCompletionText(org.eclipse.jface.text.IDocument document, int completionOffset)intgetRelevance()Gets the proposal's relevance.intgetReplacementLength()Gets the replacement length.intgetReplacementOffset()Gets the replacement offset.java.lang.StringgetReplacementString()Gets the replacement string.org.eclipse.swt.graphics.PointgetSelection(org.eclipse.jface.text.IDocument document)char[]getTriggerCharacters()booleanisValidFor(org.eclipse.jface.text.IDocument document, int offset)voidselected(org.eclipse.jface.text.ITextViewer viewer, boolean smartToggle)voidsetContextInformation(org.eclipse.jface.text.contentassist.IContextInformation contextInformation)Sets the context information.voidsetCursorPosition(int cursorPosition)Sets the cursor position relative to the insertion offset.voidsetImage(org.eclipse.swt.graphics.Image image)Sets the image.voidsetRelevance(int relevance)Sets the proposal's relevance.voidsetReplacementLength(int replacementLength)Sets the replacement length.voidsetReplacementOffset(int replacementOffset)Sets the replacement offset.voidsetReplacementString(java.lang.String replacementString)Sets the replacement string.voidsetTriggerCharacters(char[] triggerCharacters)Sets the trigger characters.protected booleanstartsWith(org.eclipse.jface.text.IDocument document, int offset, java.lang.String word)Returnstrueif a words starts with the code completion prefix in the document,falseotherwise.voidunselected(org.eclipse.jface.text.ITextViewer viewer)voidupdateReplacementLength(int length)voidupdateReplacementOffset(int newOffset)booleanvalidate(org.eclipse.jface.text.IDocument document, int offset, org.eclipse.jface.text.DocumentEvent event)
-
-
-
Constructor Detail
-
AtlCompletionProposal
public AtlCompletionProposal(java.lang.String replacementString, int replacementOffset, int replacementLength, org.eclipse.swt.graphics.Image image, java.lang.String displayString, int relevance, java.lang.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 documentreplacementOffset- the offset of the text to be replacedreplacementLength- the length of the text to be replacedimage- the image to display for this proposaldisplayString- the string to be displayed for the proposal If set tonull, the replacement string will be taken as display string.relevance- the relevance of the proposaladditionalProposalInfo- the additional informations
-
AtlCompletionProposal
public AtlCompletionProposal(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, java.lang.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 documentreplacementOffset- the offset of the text to be replacedreplacementLength- the length of the text to be replacedimage- the image to display for this proposaldisplayString- the string to be displayed for the proposalviewer- the text viewer for which this proposal is computed, may benullIf set tonull, the replacement string will be taken as display string.relevance- the relevance of the proposaladditionalProposalInfo- the additional informations
-
-
Method Detail
-
apply
public void apply(org.eclipse.jface.text.IDocument document)
- Specified by:
applyin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposal
-
apply
public void apply(org.eclipse.jface.text.IDocument document, char trigger, int offset)- Specified by:
applyin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposalExtension
-
apply
public void apply(org.eclipse.jface.text.ITextViewer viewer, char trigger, int stateMask, int offset)- Specified by:
applyin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposalExtension2
-
compareTo
public int compareTo(AtlCompletionProposal arg0)
- Specified by:
compareToin interfacejava.lang.Comparable<AtlCompletionProposal>
-
getAdditionalProposalInfo
public java.lang.String getAdditionalProposalInfo()
- Specified by:
getAdditionalProposalInfoin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposal
-
getContextInformation
public org.eclipse.jface.text.contentassist.IContextInformation getContextInformation()
- Specified by:
getContextInformationin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposal
-
getContextInformationPosition
public int getContextInformationPosition()
- Specified by:
getContextInformationPositionin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposalExtension
-
getDisplayString
public java.lang.String getDisplayString()
- Specified by:
getDisplayStringin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposal
-
getImage
public org.eclipse.swt.graphics.Image getImage()
- Specified by:
getImagein interfaceorg.eclipse.jface.text.contentassist.ICompletionProposal
-
getInformationControlCreator
public org.eclipse.jface.text.IInformationControlCreator getInformationControlCreator()
- Specified by:
getInformationControlCreatorin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposalExtension3
-
getPrefixCompletionStart
public int getPrefixCompletionStart(org.eclipse.jface.text.IDocument document, int completionOffset)- Specified by:
getPrefixCompletionStartin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposalExtension3
-
getPrefixCompletionText
public java.lang.CharSequence getPrefixCompletionText(org.eclipse.jface.text.IDocument document, int completionOffset)- Specified by:
getPrefixCompletionTextin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposalExtension3
-
getRelevance
public int getRelevance()
Gets the proposal's relevance.- Returns:
- Returns a int
-
getReplacementLength
public int getReplacementLength()
Gets the replacement length.- Returns:
- Returns a int
-
getReplacementOffset
public int getReplacementOffset()
Gets the replacement offset.- Returns:
- Returns a int
-
getReplacementString
public java.lang.String getReplacementString()
Gets the replacement string.- Returns:
- Returns a String
-
getSelection
public org.eclipse.swt.graphics.Point getSelection(org.eclipse.jface.text.IDocument document)
- Specified by:
getSelectionin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposal
-
getTriggerCharacters
public char[] getTriggerCharacters()
- Specified by:
getTriggerCharactersin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposalExtension
-
isValidFor
public boolean isValidFor(org.eclipse.jface.text.IDocument document, int offset)- Specified by:
isValidForin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposalExtension
-
selected
public void selected(org.eclipse.jface.text.ITextViewer viewer, boolean smartToggle)- Specified by:
selectedin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposalExtension2
-
setContextInformation
public void setContextInformation(org.eclipse.jface.text.contentassist.IContextInformation contextInformation)
Sets the context information.- Parameters:
contextInformation- The context information associated with this proposal
-
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
-
setImage
public void setImage(org.eclipse.swt.graphics.Image image)
Sets the image.- Parameters:
image- The image to set
-
setRelevance
public void setRelevance(int relevance)
Sets the proposal's relevance.- Parameters:
relevance- The relevance to set
-
setReplacementLength
public void setReplacementLength(int replacementLength)
Sets the replacement length.- Parameters:
replacementLength- The replacementLength to set
-
setReplacementOffset
public void setReplacementOffset(int replacementOffset)
Sets the replacement offset.- Parameters:
replacementOffset- The replacement offset to set
-
setReplacementString
public void setReplacementString(java.lang.String replacementString)
Sets the replacement string.- Parameters:
replacementString- The replacement string to set
-
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
-
startsWith
protected boolean startsWith(org.eclipse.jface.text.IDocument document, int offset, java.lang.String word)Returnstrueif a words starts with the code completion prefix in the document,falseotherwise.
-
unselected
public void unselected(org.eclipse.jface.text.ITextViewer viewer)
- Specified by:
unselectedin interfaceorg.eclipse.jface.text.contentassist.ICompletionProposalExtension2- See Also:
ICompletionProposalExtension2.unselected(org.eclipse.jface.text.ITextViewer)
-
updateReplacementLength
public void updateReplacementLength(int length)
- Parameters:
length-
-
updateReplacementOffset
public void updateReplacementOffset(int newOffset)
- Parameters:
newOffset-
-
validate
public boolean validate(org.eclipse.jface.text.IDocument document, int offset, org.eclipse.jface.text.DocumentEvent event)- Specified by:
validatein interfaceorg.eclipse.jface.text.contentassist.ICompletionProposalExtension2
-
-