Module platform

Class ParameterizedCompletionInsertionInfo

java.lang.Object
de.grogra.pf.ui.autocomplete.impl.ParameterizedCompletionInsertionInfo

public class ParameterizedCompletionInsertionInfo extends Object
Describes a parameterized completion - what's being inserted, where the parameters are in the inserted text, etc.
Version:
1.0
Author:
Robert Futrell
  • Constructor Details

    • ParameterizedCompletionInsertionInfo

      public ParameterizedCompletionInsertionInfo()
  • Method Details

    • addReplacementCopy

      public void addReplacementCopy(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:
    • getDefaultEndOffs

      public int getDefaultEndOffs()
    • getMaxOffset

      public 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

      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

      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:
    • getReplacementLocation

      public 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:
    • 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

      public String 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

      public 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.
      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

      public void setTextToInsert(String text)
      Sets the text to insert for the completion.
      Parameters:
      text - The text to insert.
      See Also: