Package groovy.console.ui.text

# Class FindReplaceUtility

java.lang.Object
groovy.console.ui.text.FindReplaceUtility

public final class FindReplaceUtility extends Object
Shared find/replace dialog support for text components used by the console.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `CLOSE_ACTION_COMMAND`
  Action command for closing the dialog.
  `static final Action`
  `FIND_ACTION`
  Shared action that repeats a find against the active text component.
  `static final String`
  `FIND_ACTION_COMMAND`
  Action command for find operations.
  `static final String`
  `REPLACE_ACTION_COMMAND`
  Action command for single replace operations.
  `static final String`
  `REPLACE_ALL_ACTION_COMMAND`
  Action command for replace-all operations.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `addTextListener(TextListener tl)`
  Registers a listener for dialog text events.
  `static void`
  `dispose()`
  Disposes of the shared find/replace dialog.
  `static String`
  `getLastAction()`
  `static int`
  `getReplacementCount()`
  `static String`
  `getSearchText()`
  `static void`
  `registerTextComponent(JTextComponent textComponent)`
  Starts tracking the supplied text component for find/replace actions.
  `static void`
  `removeTextListener(TextListener tl)`
  Removes a listener for dialog text events.
  `static void`
  `showDialog()`
  Shows the find dialog for the active text component.
  `static void`
  `showDialog(boolean isReplace)`
  Shows either the find or replace dialog for the active text component.
  `static void`
  `unregisterTextComponent(JTextComponent textComponent)`
  Stops tracking the supplied text component for find/replace actions.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### FIND_ACTION_COMMAND

    public static final String FIND_ACTION_COMMAND
    Action command for find operations.
    See Also:
      - Constant Field Values

  - ### REPLACE_ACTION_COMMAND

    public static final String REPLACE_ACTION_COMMAND
    Action command for single replace operations.
    See Also:
      - Constant Field Values

  - ### REPLACE_ALL_ACTION_COMMAND

    public static final String REPLACE_ALL_ACTION_COMMAND
    Action command for replace-all operations.
    See Also:
      - Constant Field Values

  - ### CLOSE_ACTION_COMMAND

    public static final String CLOSE_ACTION_COMMAND
    Action command for closing the dialog.
    See Also:
      - Constant Field Values

  - ### FIND_ACTION

    public static final Action FIND_ACTION
    Shared action that repeats a find against the active text component.

- ## Method Details

  - ### addTextListener

    public static void addTextListener(TextListener tl)
    Registers a listener for dialog text events.
    Parameters:
      `tl` - the listener to add

  - ### getLastAction

    public static String getLastAction()
    Returns:
      the last action

  - ### getReplacementCount

    public static int getReplacementCount()
    Returns:
      the replacement count

  - ### getSearchText

    public static String getSearchText()
    Returns:
      the search text

  - ### registerTextComponent

    public static void registerTextComponent(JTextComponent textComponent)
    Starts tracking the supplied text component for find/replace actions.
    Parameters:
      `textComponent` - the text component to listen to

  - ### removeTextListener

    public static void removeTextListener(TextListener tl)
    Removes a listener for dialog text events.
    Parameters:
      `tl` - the listener to remove

  - ### showDialog

    public static void showDialog()
    Shows the find dialog for the active text component.

  - ### showDialog

    public static void showDialog(boolean isReplace)
    Shows either the find or replace dialog for the active text component.
    Parameters:
      `isReplace` - show a replace dialog rather than a find dialog if true

  - ### unregisterTextComponent

    public static void unregisterTextComponent(JTextComponent textComponent)
    Stops tracking the supplied text component for find/replace actions.
    Parameters:
      `textComponent` - the text component to stop listening to

  - ### dispose

    public static void dispose()
    Disposes of the shared find/replace dialog.