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 |
updateTextToFindInfo(); |
149 |
updateFileNamePatternInfo(); |
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 |
updateFileNamePatternInfo(); |
427 |
} |
443 |
} |
428 |
}); |
444 |
}); |
429 |
|
445 |
|
Lines 496-501
Link Here
|
496 |
&& cboxFileNamePattern.getComponent().getItemCount() != 0) { |
512 |
&& cboxFileNamePattern.getComponent().getItemCount() != 0) { |
497 |
cboxFileNamePattern.getComponent().setSelectedIndex(0); |
513 |
cboxFileNamePattern.getComponent().setSelectedIndex(0); |
498 |
} |
514 |
} |
|
|
515 |
cboxFileNamePattern.setRegularExpression(memory.isFilePathRegex()); |
499 |
if (cboxReplacement != null && cboxReplacement.getItemCount() != 0) { |
516 |
if (cboxReplacement != null && cboxReplacement.getItemCount() != 0) { |
500 |
cboxReplacement.setSelectedIndex(0); |
517 |
cboxReplacement.setSelectedIndex(0); |
501 |
} |
518 |
} |
Lines 608-614
Link Here
|
608 |
if (cboxReplacement != null){ |
625 |
if (cboxReplacement != null){ |
609 |
updateReplacePatternColor(); |
626 |
updateReplacePatternColor(); |
610 |
} |
627 |
} |
611 |
setTextToFindToolTip(); |
628 |
updateTextToFindInfo(); |
612 |
} else if (toggle == chkPreserveCase) { |
629 |
} else if (toggle == chkPreserveCase) { |
613 |
searchCriteria.setPreserveCase(selected); |
630 |
searchCriteria.setPreserveCase(selected); |
614 |
} else { |
631 |
} else { |
Lines 616-630
Link Here
|
616 |
} |
633 |
} |
617 |
} |
634 |
} |
618 |
|
635 |
|
619 |
private void setTextToFindToolTip() { |
636 |
private void updateTextToFindInfo() { |
620 |
String t; |
637 |
String bungleKey = (searchCriteria.isRegexp()) |
621 |
if (searchCriteria.isRegexp()) { |
638 |
? "BasicSearchForm.cboxTextToFind.info.re" //NOI18N |
622 |
t = null; |
639 |
: "BasicSearchForm.cboxTextToFind.info"; //NOI18N |
623 |
} else { |
640 |
String text = UiUtils.getText(bungleKey); |
624 |
t = UiUtils.getText( |
641 |
cboxTextToFind.getComponent().setToolTipText(text); |
625 |
"BasicSearchForm.cboxTextToFind.tooltip"); //NOI18N |
642 |
lblTextToFindHint.setText(text); |
626 |
} |
643 |
} |
627 |
cboxTextToFind.getComponent().setToolTipText(t); |
644 |
|
|
|
645 |
private void updateFileNamePatternInfo() { |
646 |
lblFileNameHint.setText(UiUtils.getFileNamePatternsExample( |
647 |
cboxFileNamePattern.isRegularExpression())); |
628 |
} |
648 |
} |
629 |
|
649 |
|
630 |
/** |
650 |
/** |
Lines 726-732
Link Here
|
726 |
} else { |
746 |
} else { |
727 |
|
747 |
|
728 |
} |
748 |
} |
729 |
setTextToFindToolTip(); |
749 |
updateTextToFindInfo(); |
730 |
} |
750 |
} |
731 |
|
751 |
|
732 |
private void lclz(AbstractButton ab, String msg) { |
752 |
private void lclz(AbstractButton ab, String msg) { |
Lines 751-758
Link Here
|
751 |
protected SearchFormPanel formPanel; |
771 |
protected SearchFormPanel formPanel; |
752 |
private JButton btnTestTextToFind; |
772 |
private JButton btnTestTextToFind; |
753 |
private JLabel lblTextToFind; |
773 |
private JLabel lblTextToFind; |
|
|
774 |
private JLabel lblTextToFindHint; |
754 |
private ScopeController cboxScope; |
775 |
private ScopeController cboxScope; |
755 |
private JLabel lblFileNamePattern; |
776 |
private JLabel lblFileNamePattern; |
|
|
777 |
private JLabel lblFileNameHint; |
756 |
private JLabel lblScope; |
778 |
private JLabel lblScope; |
757 |
private JLabel lblReplacement; |
779 |
private JLabel lblReplacement; |
758 |
private Color errorTextColor, defaultTextColor; |
780 |
private Color errorTextColor, defaultTextColor; |
Lines 766-783
Link Here
|
766 |
private final class SearchFormPanel extends JPanel { |
788 |
private final class SearchFormPanel extends JPanel { |
767 |
|
789 |
|
768 |
private FormLayoutHelper flh; |
790 |
private FormLayoutHelper flh; |
|
|
791 |
private int row = 0; |
769 |
|
792 |
|
770 |
public SearchFormPanel() { |
793 |
public SearchFormPanel() { |
771 |
super(); |
794 |
super(); |
772 |
this.flh = new FormLayoutHelper(this, |
795 |
setLayout(new GridBagLayout()); |
773 |
FormLayoutHelper.DEFAULT_COLUMN, |
796 |
setBorder(new EmptyBorder(5, 5, 5, 5)); |
774 |
FormLayoutHelper.DEFAULT_COLUMN); |
|
|
775 |
flh.setAllGaps(true); |
776 |
} |
797 |
} |
777 |
|
798 |
|
778 |
public void addRow(JComponent label, JComponent component) { |
799 |
public void addRow(JComponent label, JComponent component) { |
779 |
|
800 |
|
780 |
flh.addRow(label, component); |
801 |
GridBagConstraints c = new GridBagConstraints(); |
|
|
802 |
c.gridx = 0; |
803 |
c.anchor = GridBagConstraints.NORTHWEST; |
804 |
c.gridy = row; |
805 |
c.weightx = 0; |
806 |
c.weighty = 0; |
807 |
c.insets = new Insets(5, 5, 5, 5); |
808 |
add(label, c); |
809 |
|
810 |
c.gridx = 1; |
811 |
c.weightx = 1; |
812 |
c.fill = GridBagConstraints.HORIZONTAL; |
813 |
add(component, c); |
814 |
|
815 |
row++; |
816 |
} |
817 |
|
818 |
public void addSeparator() { |
819 |
GridBagConstraints c = new GridBagConstraints(); |
820 |
c.gridx = 0; |
821 |
c.gridy = row; |
822 |
c.gridwidth = 2; |
823 |
c.weightx = 1; |
824 |
c.insets = new Insets(5, 5, 5, 5); |
825 |
c.fill = GridBagConstraints.HORIZONTAL; |
826 |
JSeparator separator = new JSeparator(JSeparator.HORIZONTAL); |
827 |
separator.setForeground(SystemColor.controlShadow); |
828 |
add(separator, c); |
829 |
row++; |
830 |
} |
831 |
|
832 |
public void addEmptyLine() { |
833 |
GridBagConstraints c = new GridBagConstraints(); |
834 |
c.gridx = 0; |
835 |
c.gridy = row; |
836 |
c.gridwidth = 2; |
837 |
c.fill = GridBagConstraints.HORIZONTAL; |
838 |
c.weighty = 1; |
839 |
c.weightx = 0.1; |
840 |
JLabel emptyLabel = new JLabel(); |
841 |
emptyLabel.setPreferredSize(new Dimension(0, 0)); |
842 |
emptyLabel.setMinimumSize(new Dimension(0, 0)); |
843 |
add(emptyLabel, c); |
844 |
row++; |
781 |
} |
845 |
} |
782 |
} |
846 |
} |
783 |
|
847 |
|