Executes a "find" operation in the active editor. @param context The search context to use. The context shared between all of the find/replace dialogs will be used if this is null. This is here as a means for callers to override what search is performed to be differen
(SearchContext context)
| 141 | * @see #replaceNext(SearchContext) |
| 142 | */ |
| 143 | public void findNext(SearchContext context) { |
| 144 | |
| 145 | AbstractMainView mainView = rtext.getMainView(); |
| 146 | if (context == null) { |
| 147 | context = mainView.searchContext; |
| 148 | } |
| 149 | |
| 150 | // If the current text string is nothing (ie, they haven't searched |
| 151 | // yet), bring up Find dialog. |
| 152 | String searchString = mainView.searchContext.getSearchFor(); |
| 153 | if (searchString==null || searchString.isEmpty()) { |
| 154 | switch (searchingMode) { |
| 155 | case DIALOGS -> { |
| 156 | ensureSearchDialogsCreated(); |
| 157 | findDialog.setVisible(true); |
| 158 | } |
| 159 | case TOOLBARS -> { |
| 160 | ensureToolbarsCreated(); |
| 161 | rtext.getCollapsibleSectionPanel(). |
| 162 | showBottomComponent(findToolBar); |
| 163 | } |
| 164 | } |
| 165 | return; |
| 166 | } |
| 167 | |
| 168 | // Otherwise, repeat the last Find action. |
| 169 | RTextEditorPane textArea = mainView.getCurrentTextArea(); |
| 170 | |
| 171 | try { |
| 172 | handleSearchResult(context, SearchEngine.find(textArea, context)); |
| 173 | } catch (PatternSyntaxException pse) { |
| 174 | // There was a problem with the user's regex search string. |
| 175 | // Won't usually happen; should be caught earlier. |
| 176 | JOptionPane.showMessageDialog(rtext, |
| 177 | "Invalid regular expression:\n" + pse + |
| 178 | "\nPlease check your regular expression search string.", |
| 179 | "Error", JOptionPane.ERROR_MESSAGE); |
| 180 | } |
| 181 | |
| 182 | } |
| 183 | |
| 184 | |
| 185 | public Image getLookAndFeelContentAssistImage() { |
no test coverage detected