Skip to content

Commit dea797e

Browse files
author
GWA
committed
Feature: Find function in cell data popup and Object tree's text detail tabs:
The "Mark all" toggle button now writes the number of occurrences to SQuirreL's message panel.
1 parent 4530521 commit dea797e

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

sql12/core/doc/changes.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Not yet released, available in our GIT repository, snapshots and future releases
66

77
Enhancements:
88

9+
Find function in cell data popup and Object tree's text detail tabs:
10+
The "Mark all" toggle button now writes the number of occurrences to SQuirreL's message panel.
11+
912
Introduced Java 23 compatibility.
1013

1114
https://github.com/squirrel-sql-client/squirrel-sql-code/issues/47

sql12/core/src/net/sourceforge/squirrel_sql/fw/gui/textfind/I18NStrings.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ TextFindCtrl.last.occurrence.reached=Last occurrence reached. Next search will r
1212
TextFindMode.contains=Contains
1313
TextFindMode.contains.ignore.case=Contains ignore case
1414
TextFindMode.contains.regexp=Contains regular expression
15+
16+
TextFindCtrl.mark.count=Marked {0} occurrences

sql12/core/src/net/sourceforge/squirrel_sql/fw/gui/textfind/TextFindCtrl.java

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
package net.sourceforge.squirrel_sql.fw.gui.textfind;
22

3+
import java.awt.BorderLayout;
4+
import java.awt.Color;
5+
import java.awt.event.ActionEvent;
6+
import java.awt.event.InputEvent;
7+
import java.awt.event.KeyEvent;
8+
import javax.swing.AbstractAction;
9+
import javax.swing.Action;
10+
import javax.swing.ButtonGroup;
11+
import javax.swing.JComponent;
12+
import javax.swing.JPanel;
13+
import javax.swing.JPopupMenu;
14+
import javax.swing.JRadioButtonMenuItem;
15+
import javax.swing.JScrollPane;
16+
import javax.swing.KeyStroke;
17+
import javax.swing.text.BadLocationException;
18+
import javax.swing.text.DefaultHighlighter;
19+
import javax.swing.text.JTextComponent;
20+
321
import net.sourceforge.squirrel_sql.client.Main;
422
import net.sourceforge.squirrel_sql.fw.gui.EditableComboBoxHandler;
523
import net.sourceforge.squirrel_sql.fw.props.Props;
@@ -8,15 +26,6 @@
826
import net.sourceforge.squirrel_sql.fw.util.StringUtilities;
927
import net.sourceforge.squirrel_sql.fw.util.Utilities;
1028

11-
import javax.swing.*;
12-
import javax.swing.text.BadLocationException;
13-
import javax.swing.text.DefaultHighlighter;
14-
import javax.swing.text.JTextComponent;
15-
import java.awt.*;
16-
import java.awt.event.ActionEvent;
17-
import java.awt.event.InputEvent;
18-
import java.awt.event.KeyEvent;
19-
2029
public class TextFindCtrl
2130
{
2231
public static final String PREF_KEY_TEXT_FIND_PREF_PREFIX = "TextFindCtrl.PREF_KEY_TEXT_FIND_PREF_PREFIX";
@@ -197,9 +206,11 @@ private void onToggleMarkAll()
197206
MatchBounds matchBounds =
198207
TextFinder.findNthOccurrence(_textComponentToSearch.getText(), _editableComboBoxHandler.getItem(), nextOccurrenceToFind, getSelectedFindMode());
199208

209+
int matchCount = 0;
200210
boolean firstMatch = true;
201211
while (null != matchBounds)
202212
{
213+
++matchCount;
203214
//////////////////////////////////////////////////////////////////////
204215
// Scrolls correctly and does not interfere with highlighting.
205216
if (firstMatch)
@@ -217,6 +228,8 @@ private void onToggleMarkAll()
217228
matchBounds =
218229
TextFinder.findNthOccurrence(_textComponentToSearch.getText(), _editableComboBoxHandler.getItem(), nextOccurrenceToFind, getSelectedFindMode());
219230
}
231+
232+
Main.getApplication().getMessageHandler().showMessage(s_stringMgr.getString("TextFindCtrl.mark.count", matchCount));
220233
}
221234
catch (BadLocationException e)
222235
{

0 commit comments

Comments
 (0)