This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 211098
Collapse All | Expand All

(-)a/api.search/src/org/netbeans/api/search/ui/ScopeOptionsController.java (+3 lines)
Lines 57-62 Link Here
57
import org.netbeans.modules.search.ui.CheckBoxWithButtonPanel;
57
import org.netbeans.modules.search.ui.CheckBoxWithButtonPanel;
58
import org.netbeans.modules.search.ui.FormLayoutHelper;
58
import org.netbeans.modules.search.ui.FormLayoutHelper;
59
import org.netbeans.modules.search.ui.UiUtils;
59
import org.netbeans.modules.search.ui.UiUtils;
60
import org.openide.util.NbBundle;
60
61
61
/**
62
/**
62
 * Component controller for setting search scope options.
63
 * Component controller for setting search scope options.
Lines 116-121 Link Here
116
    private void init() {
117
    private void init() {
117
        btnTestFileNamePattern = new JButton();
118
        btnTestFileNamePattern = new JButton();
118
        chkFileNameRegex = new JCheckBox();
119
        chkFileNameRegex = new JCheckBox();
120
        chkFileNameRegex.setToolTipText(UiUtils.getText(
121
                "BasicSearchForm.chkFileNameRegex.tooltip"));           //NOI18N
119
122
120
        if (!replacing) {
123
        if (!replacing) {
121
            chkArchives = new JCheckBox();
124
            chkArchives = new JCheckBox();
(-)a/api.search/src/org/netbeans/modules/search/BasicSearchForm.java (-8 / +74 lines)
Lines 46-53 Link Here
46
46
47
import java.awt.Color;
47
import java.awt.Color;
48
import java.awt.Component;
48
import java.awt.Component;
49
import java.awt.FlowLayout;
49
import java.awt.Dimension;
50
import java.awt.GridBagConstraints;
51
import java.awt.GridBagLayout;
52
import java.awt.Insets;
50
import java.awt.ItemSelectable;
53
import java.awt.ItemSelectable;
54
import java.awt.SystemColor;
51
import java.awt.event.ActionEvent;
55
import java.awt.event.ActionEvent;
52
import java.awt.event.ActionListener;
56
import java.awt.event.ActionListener;
53
import java.awt.event.ItemEvent;
57
import java.awt.event.ItemEvent;
Lines 58-63 Link Here
58
import java.util.List;
62
import java.util.List;
59
import java.util.logging.Logger;
63
import java.util.logging.Logger;
60
import javax.swing.*;
64
import javax.swing.*;
65
import javax.swing.border.EmptyBorder;
61
import javax.swing.event.ChangeEvent;
66
import javax.swing.event.ChangeEvent;
62
import javax.swing.event.ChangeListener;
67
import javax.swing.event.ChangeListener;
63
import javax.swing.text.JTextComponent;
68
import javax.swing.text.JTextComponent;
Lines 140-145 Link Here
140
        }
145
        }
141
        useCurrentlySelectedText();
146
        useCurrentlySelectedText();
142
        setSearchCriteriaValues();
147
        setSearchCriteriaValues();
148
        lblTextToFind.setVisible(!searchCriteria.isRegexp());
149
        lblFileNameHint.setVisible(!searchCriteria.isFileNameRegexp());
143
    }
150
    }
144
151
145
    /**
152
    /**
Lines 223-228 Link Here
223
        cboxTextToFind = ComponentUtils.adjustComboForSearchPattern(new JComboBox());
230
        cboxTextToFind = ComponentUtils.adjustComboForSearchPattern(new JComboBox());
224
        lblTextToFind.setLabelFor(cboxTextToFind.getComponent());
231
        lblTextToFind.setLabelFor(cboxTextToFind.getComponent());
225
        btnTestTextToFind = new JButton();
232
        btnTestTextToFind = new JButton();
233
        lblTextToFindHint = new JLabel();
234
        lblTextToFindHint.setForeground(SystemColor.controlDkShadow);
226
235
227
        if (searchAndReplace) {
236
        if (searchAndReplace) {
228
            lblReplacement = new JLabel();
237
            lblReplacement = new JLabel();
Lines 239-244 Link Here
239
        lblScope.setLabelFor(cboxScope.getComponent());
248
        lblScope.setLabelFor(cboxScope.getComponent());
240
249
241
        lblFileNamePattern = new JLabel();
250
        lblFileNamePattern = new JLabel();
251
        lblFileNameHint = new JLabel();
252
        lblFileNameHint.setForeground(SystemColor.controlDkShadow);
242
        cboxFileNamePattern = ComponentUtils.adjustComboForFileName(
253
        cboxFileNamePattern = ComponentUtils.adjustComboForFileName(
243
                new JComboBox());
254
                new JComboBox());
244
        lblFileNamePattern.setLabelFor(cboxFileNamePattern.getComponent());
255
        lblFileNamePattern.setLabelFor(cboxFileNamePattern.getComponent());
Lines 271-284 Link Here
271
282
272
        formPanel = new SearchFormPanel();
283
        formPanel = new SearchFormPanel();
273
        formPanel.addRow(lblTextToFind, cboxTextToFind.getComponent());
284
        formPanel.addRow(lblTextToFind, cboxTextToFind.getComponent());
285
        formPanel.addRow(new JLabel(), lblTextToFindHint);
274
        initContainingTextOptionsRow(searchAndReplace);
286
        initContainingTextOptionsRow(searchAndReplace);
275
        if (searchAndReplace) {
287
        if (searchAndReplace) {
276
            formPanel.addRow(lblReplacement, cboxReplacement);
288
            formPanel.addRow(lblReplacement, cboxReplacement);
277
        }
289
        }
290
        formPanel.addSeparator();
278
        formPanel.addRow(lblScope, cboxScope.getComponent());
291
        formPanel.addRow(lblScope, cboxScope.getComponent());
292
        formPanel.addSeparator();
279
        formPanel.addRow(lblFileNamePattern,
293
        formPanel.addRow(lblFileNamePattern,
280
                cboxFileNamePattern.getComponent());
294
                cboxFileNamePattern.getComponent());
295
        formPanel.addRow(new JLabel(), lblFileNameHint);
281
        initScopeOptionsRow(searchAndReplace);
296
        initScopeOptionsRow(searchAndReplace);
297
        formPanel.addEmptyLine();
282
    }
298
    }
283
299
284
    /**
300
    /**
Lines 299-309 Link Here
299
315
300
            formPanel.addRow(new JLabel(), jp);
316
            formPanel.addRow(new JLabel(), jp);
301
        } else {
317
        } else {
302
            jp.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
318
            jp.setLayout(new BoxLayout(jp, BoxLayout.LINE_AXIS));
303
            jp.add(chkCaseSensitive);
319
            jp.add(chkCaseSensitive);
304
            jp.add(chkWholeWords);
320
            jp.add(chkWholeWords);
305
            jp.add(new CheckBoxWithButtonPanel(chkRegexp, btnTestTextToFind));
321
            jp.add(new CheckBoxWithButtonPanel(chkRegexp, btnTestTextToFind));
306
            jp.setMaximumSize(jp.getPreferredSize());
307
            formPanel.addRow(new JLabel(), jp);
322
            formPanel.addRow(new JLabel(), jp);
308
        }
323
        }
309
    }
324
    }
Lines 424-429 Link Here
424
                        cboxFileNamePattern.getFileNamePattern());
439
                        cboxFileNamePattern.getFileNamePattern());
425
                searchCriteria.setFileNameRegexp(
440
                searchCriteria.setFileNameRegexp(
426
                        cboxFileNamePattern.isRegularExpression());
441
                        cboxFileNamePattern.isRegularExpression());
442
                lblFileNameHint.setVisible(
443
                        !cboxFileNamePattern.isRegularExpression());
427
            }
444
            }
428
        });
445
        });
429
446
Lines 625-630 Link Here
625
                    "BasicSearchForm.cboxTextToFind.tooltip");          //NOI18N
642
                    "BasicSearchForm.cboxTextToFind.tooltip");          //NOI18N
626
        }
643
        }
627
        cboxTextToFind.getComponent().setToolTipText(t);
644
        cboxTextToFind.getComponent().setToolTipText(t);
645
        lblTextToFindHint.setVisible(t != null);
628
    }
646
    }
629
647
630
    /**
648
    /**
Lines 708-716 Link Here
708
    private void setMnemonics(boolean searchAndReplace) {
726
    private void setMnemonics(boolean searchAndReplace) {
709
727
710
        lclz(lblTextToFind, "BasicSearchForm.lblTextToFind.text");      //NOI18N
728
        lclz(lblTextToFind, "BasicSearchForm.lblTextToFind.text");      //NOI18N
729
        lclz(lblTextToFindHint,
730
                "BasicSearchForm.cboxTextToFind.tooltip");              //NOI18N
711
        lclz(lblScope, "BasicSearchForm.lblScope.text");                //NOI18N
731
        lclz(lblScope, "BasicSearchForm.lblScope.text");                //NOI18N
712
        lclz(lblFileNamePattern,
732
        lclz(lblFileNamePattern,
713
                "BasicSearchForm.lblFileNamePattern.text");             //NOI18N
733
                "BasicSearchForm.lblFileNamePattern.text");             //NOI18N
734
        lclz(lblFileNameHint,
735
                "BasicSearchForm.cboxFileNamePattern.tooltip");         //NOI18N
714
        lclz(chkWholeWords, "BasicSearchForm.chkWholeWords.text");      //NOI18N
736
        lclz(chkWholeWords, "BasicSearchForm.chkWholeWords.text");      //NOI18N
715
        lclz(chkCaseSensitive, "BasicSearchForm.chkCaseSensitive.text");//NOI18N
737
        lclz(chkCaseSensitive, "BasicSearchForm.chkCaseSensitive.text");//NOI18N
716
        lclz(chkRegexp, "BasicSearchForm.chkRegexp.text");              //NOI18N
738
        lclz(chkRegexp, "BasicSearchForm.chkRegexp.text");              //NOI18N
Lines 751-758 Link Here
751
    protected SearchFormPanel formPanel;
773
    protected SearchFormPanel formPanel;
752
    private JButton btnTestTextToFind;
774
    private JButton btnTestTextToFind;
753
    private JLabel lblTextToFind;
775
    private JLabel lblTextToFind;
776
    private JLabel lblTextToFindHint;
754
    private ScopeController cboxScope;
777
    private ScopeController cboxScope;
755
    private JLabel lblFileNamePattern;    
778
    private JLabel lblFileNamePattern;    
779
    private JLabel lblFileNameHint;
756
    private JLabel lblScope;
780
    private JLabel lblScope;
757
    private JLabel lblReplacement;
781
    private JLabel lblReplacement;
758
    private Color errorTextColor, defaultTextColor;
782
    private Color errorTextColor, defaultTextColor;
Lines 766-783 Link Here
766
    private final class SearchFormPanel extends JPanel {
790
    private final class SearchFormPanel extends JPanel {
767
791
768
        private FormLayoutHelper flh;
792
        private FormLayoutHelper flh;
793
        private int row = 0;
769
794
770
        public SearchFormPanel() {
795
        public SearchFormPanel() {
771
            super();
796
            super();
772
            this.flh = new FormLayoutHelper(this,
797
            setLayout(new GridBagLayout());
773
                    FormLayoutHelper.DEFAULT_COLUMN,
798
            setBorder(new EmptyBorder(5, 5, 5, 5));
774
                    FormLayoutHelper.DEFAULT_COLUMN);
775
            flh.setAllGaps(true);
776
        }
799
        }
777
800
778
        public void addRow(JComponent label, JComponent component) {
801
        public void addRow(JComponent label, JComponent component) {
779
802
780
            flh.addRow(label, component);
803
            GridBagConstraints c = new GridBagConstraints();
804
            c.gridx = 0;
805
            c.anchor = GridBagConstraints.NORTHWEST;
806
            c.gridy = row;
807
            c.weightx = 0;
808
            c.weighty = 0;
809
            c.insets = new Insets(5, 5, 5, 5);
810
            add(label, c);
811
812
            c.gridx = 1;
813
            c.weightx = 1;
814
            c.fill = GridBagConstraints.HORIZONTAL;
815
            add(component, c);
816
817
            row++;
818
        }
819
820
        public void addSeparator() {
821
            GridBagConstraints c = new GridBagConstraints();
822
            c.gridx = 0;
823
            c.gridy = row;
824
            c.gridwidth = 2;
825
            c.weightx = 1;
826
            c.insets = new Insets(5, 5, 5, 5);
827
            c.fill = GridBagConstraints.HORIZONTAL;
828
            JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
829
            separator.setForeground(SystemColor.controlShadow);
830
            add(separator, c);
831
            row++;
832
        }
833
834
        public void addEmptyLine() {
835
            GridBagConstraints c = new GridBagConstraints();
836
            c.gridx = 0;
837
            c.gridy = row;
838
            c.gridwidth = 2;
839
            c.fill = GridBagConstraints.HORIZONTAL;
840
            c.weighty = 1;
841
            c.weightx = 0.1;
842
            JLabel emptyLabel = new JLabel();
843
            emptyLabel.setPreferredSize(new Dimension(0, 0));
844
            emptyLabel.setMinimumSize(new Dimension(0, 0));
845
            add(emptyLabel, c);
846
            row++;
781
        }
847
        }
782
    }
848
    }
783
849
(-)a/api.search/src/org/netbeans/modules/search/Bundle.properties (-2 / +3 lines)
Lines 214-224 Link Here
214
214
215
BasicSearchForm.lblReplacement.text=&Replace With\:
215
BasicSearchForm.lblReplacement.text=&Replace With\:
216
216
217
BasicSearchForm.lblScope.text=&Scope
217
BasicSearchForm.lblScope.text=&Scope:
218
218
219
BasicSearchForm.lblFileNamePattern.text=File Name &Patterns\:
219
BasicSearchForm.lblFileNamePattern.text=File Name &Patterns\:
220
220
221
BasicSearchForm.cboxFileNamePattern.tooltip=(Example\: *.java, FZP??.jsp, web/**/main/*.?htm?)
221
BasicSearchForm.cboxFileNamePattern.tooltip=(Example\: *.java, FZP??.jsp)
222
222
223
BasicSearchForm.cboxFileNamePattern.allFiles=(all files)
223
BasicSearchForm.cboxFileNamePattern.allFiles=(all files)
224
224
Lines 245-250 Link Here
245
BasicSearchForm.chkGenerated.text=Search in &Generated Sources
245
BasicSearchForm.chkGenerated.text=Search in &Generated Sources
246
246
247
BasicSearchForm.chkFileNameRegex.text=Regular E&xpression
247
BasicSearchForm.chkFileNameRegex.text=Regular E&xpression
248
BasicSearchForm.chkFileNameRegex.tooltip=Use regular expression for the file path
248
249
249
BasicSearchForm.btnTestTextToFind.text=test
250
BasicSearchForm.btnTestTextToFind.text=test
250
251

Return to bug 211098