Class 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
    • 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
    • Constructor Detail

      • ParameterizedCompletionInsertionInfo

        public ParameterizedCompletionInsertionInfo()
    • 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.
      • 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()