Package org.fife.ui.autocomplete
Class ParameterizedCompletionInsertionInfo
- java.lang.Object
-
- org.fife.ui.autocomplete.ParameterizedCompletionInsertionInfo
-
public class ParameterizedCompletionInsertionInfo extends java.lang.Object
Describes a parameterized completion - what's being inserted, where the parameters are in the inserted text, etc.- Version:
- 1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ParameterizedCompletionInsertionInfo.ReplacementCopy
Information about a replacement.
-
Field Summary
Fields Modifier and Type Field Description private int
defaultEnd
private javax.swing.text.Position
maxOffs
private int
minOffs
private java.util.List<ParameterizedCompletionInsertionInfo.ReplacementCopy>
replacementCopies
private java.util.List<org.fife.ui.rsyntaxtextarea.DocumentRange>
replacementLocations
private int
selEnd
private int
selStart
private java.lang.String
textToInsert
-
Constructor Summary
Constructors Constructor Description ParameterizedCompletionInsertionInfo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addReplacementCopy(java.lang.String id, int start, int end)
Adds a copy of a replacement.void
addReplacementLocation(int start, int end)
Marks a region of the replacement text as representing a variable name or some other construct that the user should replace.int
getDefaultEndOffs()
javax.swing.text.Position
getMaxOffset()
Returns the maximum offset the caret can move to before being outside the text inserted for this completion.int
getMinOffset()
Returns the minimum offset the caret can move to before being outside the text inserted for this completion.ParameterizedCompletionInsertionInfo.ReplacementCopy
getReplacementCopy(int index)
Returns the specified replacement copy.int
getReplacementCopyCount()
int
getReplacementCount()
Returns the number of replacements in the completion.org.fife.ui.rsyntaxtextarea.DocumentRange
getReplacementLocation(int index)
Returns the starting- and ending-offsets of the replacement regions in the completion.int
getSelectionEnd()
Returns the offset that should be the end of the initially selected text when the completion is inserted (i.e., the end offset of the first replacement region).int
getSelectionStart()
Returns the offset that should be the start of the initially selected text when the completion is inserted (i.e., the start offset of the first replacement region).java.lang.String
getTextToInsert()
Returns the actual text to insert when the completion is selected.boolean
hasSelection()
Returns whether there is an initial selected region for the completion (i.e., whether the completion actually has any parameters).void
setCaretRange(int minOffs, javax.swing.text.Position maxOffs)
Sets the document range the caret can move around in before being outside the text inserted for the completion.void
setDefaultEndOffs(int end)
void
setInitialSelection(int selStart, int selEnd)
Sets the initially selected region for the completion.void
setTextToInsert(java.lang.String text)
Sets the text to insert for the completion.
-
-
-
Field Detail
-
minOffs
private int minOffs
-
maxOffs
private javax.swing.text.Position maxOffs
-
defaultEnd
private int defaultEnd
-
selStart
private int selStart
-
selEnd
private int selEnd
-
textToInsert
private java.lang.String textToInsert
-
replacementLocations
private java.util.List<org.fife.ui.rsyntaxtextarea.DocumentRange> replacementLocations
-
replacementCopies
private java.util.List<ParameterizedCompletionInsertionInfo.ReplacementCopy> replacementCopies
-
-
Method Detail
-
addReplacementCopy
public void addReplacementCopy(java.lang.String id, int start, int end)
Adds a copy of a replacement.- Parameters:
id
- The ID of the replacement copy, e.g. the text itself.start
- The start offset.end
- The end offset.
-
addReplacementLocation
public void addReplacementLocation(int start, int end)
Marks a region of the replacement text as representing a variable name or some other construct that the user should replace.- Parameters:
start
- The start offset.end
- The end offset.- See Also:
getReplacementCount()
,getReplacementLocation(int)
-
getDefaultEndOffs
public int getDefaultEndOffs()
-
getMaxOffset
public javax.swing.text.Position getMaxOffset()
Returns the maximum offset the caret can move to before being outside the text inserted for this completion.- Returns:
- The maximum offset.
- See Also:
getMinOffset()
-
getMinOffset
public int getMinOffset()
Returns the minimum offset the caret can move to before being outside the text inserted for this completion.- Returns:
- The minimum offset.
- See Also:
getMaxOffset()
-
getReplacementCopyCount
public int getReplacementCopyCount()
-
getReplacementCount
public int getReplacementCount()
Returns the number of replacements in the completion.- Returns:
- The number of replacements in the completion.
-
getReplacementCopy
public ParameterizedCompletionInsertionInfo.ReplacementCopy getReplacementCopy(int index)
Returns the specified replacement copy.- Parameters:
index
- The index of the replacement to retrieve.- Returns:
- The replacement.
- See Also:
getReplacementCopyCount()
,addReplacementCopy(String, int, int)
-
getReplacementLocation
public org.fife.ui.rsyntaxtextarea.DocumentRange getReplacementLocation(int index)
Returns the starting- and ending-offsets of the replacement regions in the completion.- Parameters:
index
- The replacement region.- Returns:
- The range in the document of that replacement region.
- See Also:
getReplacementCount()
-
getSelectionEnd
public int getSelectionEnd()
Returns the offset that should be the end of the initially selected text when the completion is inserted (i.e., the end offset of the first replacement region).- Returns:
- The end offset for the initial selection.
- See Also:
getSelectionStart()
-
getSelectionStart
public int getSelectionStart()
Returns the offset that should be the start of the initially selected text when the completion is inserted (i.e., the start offset of the first replacement region).- Returns:
- The start offset for the initial selection.
- See Also:
getSelectionEnd()
-
getTextToInsert
public java.lang.String getTextToInsert()
Returns the actual text to insert when the completion is selected.- Returns:
- The text to insert.
- See Also:
setTextToInsert(String)
-
hasSelection
public boolean hasSelection()
Returns whether there is an initial selected region for the completion (i.e., whether the completion actually has any parameters).- Returns:
- Whether there is a region to initially select for the completion.
-
setInitialSelection
public void setInitialSelection(int selStart, int selEnd)
Sets the initially selected region for the completion.- Parameters:
selStart
- The selection start.selEnd
- The selection end.- See Also:
getSelectionEnd()
,getSelectionStart()
-
setCaretRange
public void setCaretRange(int minOffs, javax.swing.text.Position maxOffs)
Sets the document range the caret can move around in before being outside the text inserted for the completion.- Parameters:
minOffs
- The minimum offset.maxOffs
- The maximum offset, that will track its location as the document is modified.- See Also:
getMinOffset()
,getMaxOffset()
-
setDefaultEndOffs
public void setDefaultEndOffs(int end)
-
setTextToInsert
public void setTextToInsert(java.lang.String text)
Sets the text to insert for the completion.- Parameters:
text
- The text to insert.- See Also:
getTextToInsert()
-
-