Module platform
Class ParameterizedCompletionInsertionInfo
java.lang.Object
de.grogra.pf.ui.autocomplete.impl.ParameterizedCompletionInsertionInfo
Describes a parameterized completion - what's being inserted, where the
parameters are in the inserted text, etc.
- Version:
- 1.0
- Author:
- Robert Futrell
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Information about a replacement. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addReplacementCopy
(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
Returns the maximum offset the caret can move to before being outside the text inserted for this completion.int
Returns the minimum offset the caret can move to before being outside the text inserted for this completion.getReplacementCopy
(int index) Returns the specified replacement copy.int
int
Returns the number of replacements in the completion.getReplacementLocation
(int index) Returns the starting- and ending-offsets of the replacement regions in the completion.int
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
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 actual text to insert when the completion is selected.boolean
Returns whether there is an initial selected region for the completion (i.e., whether the completion actually has any parameters).void
setCaretRange
(int minOffs, 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
(String text) Sets the text to insert for the completion.
-
Constructor Details
-
ParameterizedCompletionInsertionInfo
public ParameterizedCompletionInsertionInfo()
-
-
Method Details
-
addReplacementCopy
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:
-
getDefaultEndOffs
public int getDefaultEndOffs() -
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
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:
-
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
Returns the specified replacement copy.- Parameters:
index
- The index of the replacement to retrieve.- Returns:
- The replacement.
- See Also:
-
getReplacementLocation
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:
-
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
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:
-
getTextToInsert
Returns the actual text to insert when the completion is selected.- Returns:
- The text to insert.
- See Also:
-
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:
-
setCaretRange
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:
-
setDefaultEndOffs
public void setDefaultEndOffs(int end) -
setTextToInsert
Sets the text to insert for the completion.- Parameters:
text
- The text to insert.- See Also:
-