Lines 49-54
Link Here
|
49 |
import javax.swing.JButton; |
49 |
import javax.swing.JButton; |
50 |
import javax.swing.JCheckBox; |
50 |
import javax.swing.JCheckBox; |
51 |
import javax.swing.JPanel; |
51 |
import javax.swing.JPanel; |
|
|
52 |
import org.netbeans.api.annotations.common.NullUnknown; |
52 |
import org.netbeans.api.queries.SharabilityQuery; |
53 |
import org.netbeans.api.queries.SharabilityQuery; |
53 |
import org.netbeans.api.search.SearchScopeOptions; |
54 |
import org.netbeans.api.search.SearchScopeOptions; |
54 |
import org.netbeans.modules.search.BasicSearchProvider; |
55 |
import org.netbeans.modules.search.BasicSearchProvider; |
Lines 57-63
Link Here
|
57 |
import org.netbeans.modules.search.ui.CheckBoxWithButtonPanel; |
58 |
import org.netbeans.modules.search.ui.CheckBoxWithButtonPanel; |
58 |
import org.netbeans.modules.search.ui.FormLayoutHelper; |
59 |
import org.netbeans.modules.search.ui.FormLayoutHelper; |
59 |
import org.netbeans.modules.search.ui.UiUtils; |
60 |
import org.netbeans.modules.search.ui.UiUtils; |
60 |
import org.openide.util.NbBundle; |
|
|
61 |
|
61 |
|
62 |
/** |
62 |
/** |
63 |
* Component controller for setting search scope options. |
63 |
* Component controller for setting search scope options. |
Lines 78-83
Link Here
|
78 |
private JCheckBox chkArchives; |
78 |
private JCheckBox chkArchives; |
79 |
private JCheckBox chkGenerated; |
79 |
private JCheckBox chkGenerated; |
80 |
private ItemListener checkBoxListener; |
80 |
private ItemListener checkBoxListener; |
|
|
81 |
private JPanel fileNameComponent; |
81 |
|
82 |
|
82 |
/** |
83 |
/** |
83 |
* Create settings panel that can be used in search dialog. |
84 |
* Create settings panel that can be used in search dialog. |
Lines 89-96
Link Here
|
89 |
*/ |
90 |
*/ |
90 |
ScopeOptionsController(JPanel component, |
91 |
ScopeOptionsController(JPanel component, |
91 |
FileNameController fileNameComboBox, boolean replacing) { |
92 |
FileNameController fileNameComboBox, boolean replacing) { |
92 |
super(component); |
93 |
this(component, null, fileNameComboBox, replacing); |
93 |
this.fileNameComboBox = fileNameComboBox; |
94 |
} |
|
|
95 |
|
96 |
/** |
97 |
* Create two settings panels that can be used in search dialog. The first |
98 |
* panel will contain controls for setting search scope options, the second |
99 |
* panel controls for setting file name pattern options. |
100 |
* |
101 |
* @param scopeComponent Component to adjust for search scope setting. |
102 |
* @param fileNameComponent Component to adjust for file name settings. |
103 |
* @param fileNameController File name controller tath will be bound to the |
104 |
* regular-expression check box in the file name settings panel. |
105 |
* @param replacing Replace mode flag. |
106 |
* @since api.search/1.12 |
107 |
*/ |
108 |
ScopeOptionsController(JPanel scopeComponent, JPanel fileNameComponent, |
109 |
FileNameController fileNameController, boolean replacing) { |
110 |
super(scopeComponent); |
111 |
this.fileNameComponent = fileNameComponent; |
112 |
this.fileNameComboBox = fileNameController; |
94 |
this.replacing = replacing; |
113 |
this.replacing = replacing; |
95 |
init(); |
114 |
init(); |
96 |
} |
115 |
} |
Lines 149-172
Link Here
|
149 |
*/ |
168 |
*/ |
150 |
private void initScopeOptionsRow(boolean searchAndReplace) { |
169 |
private void initScopeOptionsRow(boolean searchAndReplace) { |
151 |
|
170 |
|
152 |
JPanel jp = new JPanel(); |
171 |
JPanel regexpPanel = new CheckBoxWithButtonPanel( |
153 |
if (searchAndReplace) { |
172 |
chkFileNameRegex, btnTestFileNamePattern); |
154 |
jp.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0)); |
173 |
if (fileNameComponent != null) { |
155 |
jp.add(ignoreListOptionPanel); |
174 |
fileNameComponent.setLayout( |
156 |
jp.add(new CheckBoxWithButtonPanel( |
175 |
new FlowLayout(FlowLayout.LEADING, 0, 0)); |
157 |
chkFileNameRegex, btnTestFileNamePattern)); |
176 |
fileNameComponent.add(ignoreListOptionPanel); |
158 |
jp.setMaximumSize(jp.getMinimumSize()); |
177 |
fileNameComponent.add(regexpPanel); |
|
|
178 |
if (!searchAndReplace) { |
179 |
component.add(chkArchives); |
180 |
component.add(chkGenerated); |
181 |
} |
159 |
} else { |
182 |
} else { |
160 |
FormLayoutHelper flh = new FormLayoutHelper(jp, |
183 |
JPanel jp = new JPanel(); |
161 |
FormLayoutHelper.DEFAULT_COLUMN, |
184 |
if (searchAndReplace) { |
162 |
FormLayoutHelper.DEFAULT_COLUMN); |
185 |
jp.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0)); |
163 |
flh.addRow(chkArchives, chkGenerated); |
186 |
jp.add(ignoreListOptionPanel); |
164 |
flh.addRow(ignoreListOptionPanel, |
187 |
jp.add(regexpPanel); |
165 |
new CheckBoxWithButtonPanel( |
188 |
jp.setMaximumSize(jp.getMinimumSize()); |
166 |
chkFileNameRegex, btnTestFileNamePattern)); |
189 |
} else { |
167 |
jp.setMaximumSize(jp.getMinimumSize()); |
190 |
FormLayoutHelper flh = new FormLayoutHelper(jp, |
|
|
191 |
FormLayoutHelper.DEFAULT_COLUMN, |
192 |
FormLayoutHelper.DEFAULT_COLUMN); |
193 |
flh.addRow(chkArchives, chkGenerated); |
194 |
flh.addRow(ignoreListOptionPanel, |
195 |
new CheckBoxWithButtonPanel( |
196 |
chkFileNameRegex, btnTestFileNamePattern)); |
197 |
jp.setMaximumSize(jp.getMinimumSize()); |
198 |
} |
199 |
component.add(jp); |
168 |
} |
200 |
} |
169 |
component.add(jp); |
|
|
170 |
} |
201 |
} |
171 |
|
202 |
|
172 |
private void initInteraction() { |
203 |
private void initInteraction() { |
Lines 340-345
Link Here
|
340 |
} |
371 |
} |
341 |
|
372 |
|
342 |
/** |
373 |
/** |
|
|
374 |
* Get the panel containing controls related to file name pattern settings. |
375 |
* This is only applicable if the controller was created using |
376 |
* {@link ComponentUtils#adjustPanelsForOptions(JPanel, JPanel, boolean, FileNameController)}. |
377 |
* |
378 |
* @return Panel containing controls related to file name pattern settings, |
379 |
* or null if there is a single panel for all settings. |
380 |
* @since api.search/1.12 |
381 |
*/ |
382 |
public @NullUnknown JPanel getFileNameComponent() { |
383 |
return fileNameComponent; |
384 |
} |
385 |
|
386 |
/** |
343 |
* Checkbox listener. |
387 |
* Checkbox listener. |
344 |
*/ |
388 |
*/ |
345 |
private final class CheckBoxListener implements ItemListener { |
389 |
private final class CheckBoxListener implements ItemListener { |