@@ -3766,6 +3766,19 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
3766
3766
if (text != null ) findDialog .setSearchPattern (text );
3767
3767
findDialog .show (false );
3768
3768
});
3769
+ jmi = new JMenuItem ("Search Script for Selected Text" );
3770
+ popup .add (jmi );
3771
+ jmi .addActionListener (e -> {
3772
+ final String text = textArea .getSelectedText ();
3773
+ if (text == null ) {
3774
+ UIManager .getLookAndFeel ().provideErrorFeedback (textArea );
3775
+ } else {
3776
+ findDialog .setLocationRelativeTo (this );
3777
+ findDialog .setRestrictToConsole (false );
3778
+ if (text != null ) findDialog .setSearchPattern (text );
3779
+ findDialog .show (false );
3780
+ }
3781
+ });
3769
3782
popup .addSeparator ();
3770
3783
3771
3784
jmi = new JMenuItem ("Clear Selected Text..." );
@@ -3776,6 +3789,8 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
3776
3789
else
3777
3790
textArea .replaceSelection ("" );
3778
3791
});
3792
+ final DefaultHighlighter highlighter = (DefaultHighlighter )textArea .getHighlighter ();
3793
+ highlighter .setDrawsLayeredHighlights (false );
3779
3794
jmi = new JMenuItem ("Highlight Selected Text..." );
3780
3795
popup .add (jmi );
3781
3796
jmi .addActionListener (e -> {
@@ -3784,7 +3799,8 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
3784
3799
final DefaultHighlightPainter painter = new DefaultHighlighter .DefaultHighlightPainter (color );
3785
3800
textArea .getHighlighter ().addHighlight (textArea .getSelectionStart (), textArea .getSelectionEnd (), painter );
3786
3801
textArea .setCaretPosition (textArea .getSelectionEnd ());
3787
- } catch (BadLocationException ignored ) {
3802
+ textArea .getHighlighter ();
3803
+ } catch (final BadLocationException ignored ) {
3788
3804
UIManager .getLookAndFeel ().provideErrorFeedback (textArea );
3789
3805
}
3790
3806
});
0 commit comments