20 package net.sf.gridarta.textedit.textarea.actions;
22 import java.awt.event.ActionEvent;
23 import java.awt.event.ActionListener;
24 import javax.swing.JOptionPane;
29 import net.
sf.japi.swing.action.ActionBuilder;
30 import net.
sf.japi.swing.action.ActionBuilderFactory;
31 import org.jetbrains.annotations.NotNull;
37 public class Find implements ActionListener {
43 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
57 if (text != null && !text.isEmpty()) {
68 if (textToFind.isEmpty()) {
72 final int startPos = textArea.getCaretPosition();
73 final String text = textArea.getText();
74 final int foundIndex = text.indexOf(textToFind, startPos + 1);
75 if (foundIndex == -1) {
80 textArea.select(foundIndex, foundIndex + textToFind.length());
void find(@NotNull final JEditTextArea textArea)
Find the next occurrence of textToFind.
Action listener for "find".
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
An input handler converts the user's key strokes into concrete actions.
Base package of all Gridarta classes.
This package contains the classes for the script editor used within the editor to create and modify P...
Actions used by the script editor.
String textToFind
The text that was previously selected.
String getSelectedText()
Returns the selected text, or null if no selection is active.
This package contains the other part of the script editor.
void setType(@NotNull final FindType type)
Set the operation to perform.
static JEditTextArea getTextArea(final EventObject evt)
Returns the text area that fired the specified event.
Utility class for ActionBuilder related functions.
void actionPerformed(final ActionEvent e)
static final FindAgain FIND_AGAIN
The "find again" action listener.
static final ActionBuilder ACTION_BUILDER
Action Builder.
jEdit's text area component.