1 6 package org.netbeans.jellytools.modules.editor; 7 8 import org.netbeans.jemmy.operators.*; 9 import org.netbeans.jemmy.util.NameComponentChooser; 10 11 16 public class Replace extends JDialogOperator { 17 18 20 public Replace() { 21 super(java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("replace-title")); 22 } 23 24 private JLabelOperator _lblFindWhat; 25 private JComboBoxOperator _cboFindWhat; 26 private JLabelOperator _lblReplaceWith; 27 private JComboBoxOperator _cboReplaceWith; 28 private JCheckBoxOperator _cbHighlightSearch; 29 private JCheckBoxOperator _cbIncrementalSearch; 30 private JCheckBoxOperator _cbMatchCase; 31 private JCheckBoxOperator _cbMatchWholeWordsOnly; 33 private JCheckBoxOperator _cbBackwardSearch; 34 private JCheckBoxOperator _cbWrapSearch; 35 private JCheckBoxOperator _cbRegularExpressions; 36 private JCheckBoxOperator _cbSearchSelection; 37 private JButtonOperator _btFind; 38 private JButtonOperator _btReplace; 39 private JButtonOperator _btReplaceAll; 40 private JButtonOperator _btClose; 41 private JButtonOperator _btHelp; 42 43 44 48 51 public JLabelOperator lblFindWhat() { 52 if (_lblFindWhat==null) { 53 _lblFindWhat = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-what")); 54 } 55 return _lblFindWhat; 56 } 57 58 61 public JComboBoxOperator cboFindWhat() { 62 if (_cboFindWhat==null) { 63 _cboFindWhat = new JComboBoxOperator(this); 64 } 65 return _cboFindWhat; 66 } 67 68 71 public JLabelOperator lblReplaceWith() { 72 if (_lblReplaceWith==null) { 73 _lblReplaceWith = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-replace-with")); 74 } 75 return _lblReplaceWith; 76 } 77 78 81 public JComboBoxOperator cboReplaceWith() { 82 if (_cboReplaceWith==null) { 83 _cboReplaceWith = new JComboBoxOperator(this, 1); 84 } 85 return _cboReplaceWith; 86 } 87 88 91 public JCheckBoxOperator cbHighlightSearch() { 92 if (_cbHighlightSearch==null) { 93 _cbHighlightSearch = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-highlight-search")); 94 } 95 return _cbHighlightSearch; 96 } 97 98 101 public JCheckBoxOperator cbIncrementalSearch() { 102 if (_cbIncrementalSearch==null) { 103 _cbIncrementalSearch = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-inc-search")); 104 } 105 return _cbIncrementalSearch; 106 } 107 108 111 public JCheckBoxOperator cbMatchCase() { 112 if (_cbMatchCase==null) { 113 _cbMatchCase = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-match-case")); 114 } 115 return _cbMatchCase; 116 } 117 118 121 public JCheckBoxOperator cbMatchWholeWordsOnly() { 122 if (_cbMatchWholeWordsOnly==null) { 123 _cbMatchWholeWordsOnly = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-whole-words")); 124 } 125 return _cbMatchWholeWordsOnly; 126 } 127 128 131 public JCheckBoxOperator cbBackwardSearch() { 132 if (_cbBackwardSearch==null) { 133 _cbBackwardSearch = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-backward-search")); 134 } 135 return _cbBackwardSearch; 136 } 137 138 141 public JCheckBoxOperator cbWrapSearch() { 142 if (_cbWrapSearch==null) { 143 _cbWrapSearch = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-wrap-search")); 144 } 145 return _cbWrapSearch; 146 } 147 148 151 public JCheckBoxOperator cbRegularExpressions() { 152 if (_cbRegularExpressions==null) { 153 _cbRegularExpressions = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-reg-exp")); 154 } 155 return _cbRegularExpressions; 156 } 157 158 161 public JCheckBoxOperator cbSearchSelection() { 162 if (_cbSearchSelection==null) { 163 _cbSearchSelection = new JCheckBoxOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-block-search")); 164 } 165 return _cbSearchSelection; 166 } 167 168 171 public JButtonOperator btFind() { 172 if (_btFind==null) { 173 _btFind = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-button-find")); 174 } 175 return _btFind; 176 } 177 178 181 public JButtonOperator btReplace() { 182 if (_btReplace==null) { 183 _btReplace = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-button-replace")); 184 } 185 return _btReplace; 186 } 187 188 191 public JButtonOperator btReplaceAll() { 192 if (_btReplaceAll==null) { 193 _btReplaceAll = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-button-replace-all")); 194 } 195 return _btReplaceAll; 196 } 197 198 201 public JButtonOperator btClose() { 202 if (_btClose==null) { 203 _btClose = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("find-button-cancel")); 204 } 205 return _btClose; 206 } 207 208 211 public JButtonOperator btHelp() { 212 if (_btHelp==null) { 213 _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help")); 214 } 215 return _btHelp; 216 } 217 218 219 223 226 public String getSelectedFindWhat() { 227 return cboFindWhat().getSelectedItem().toString(); 228 } 229 230 233 public void selectFindWhat(String item) { 234 cboFindWhat().selectItem(item); 235 } 236 237 240 public void typeFindWhat(String text) { 241 cboFindWhat().typeText(text); 242 } 243 244 247 public String getSelectedReplaceWith() { 248 return cboReplaceWith().getSelectedItem().toString(); 249 } 250 251 254 public void selectReplaceWith(String item) { 255 cboReplaceWith().selectItem(item); 256 } 257 258 261 public void typeReplaceWith(String text) { 262 cboReplaceWith().typeText(text); 263 } 264 265 268 public void checkHighlightSearch(boolean state) { 269 if (cbHighlightSearch().isSelected()!=state) { 270 cbHighlightSearch().push(); 271 } 272 } 273 274 277 public void checkIncrementalSearch(boolean state) { 278 if (cbIncrementalSearch().isSelected()!=state) { 279 cbIncrementalSearch().push(); 280 } 281 } 282 283 286 public void checkMatchCase(boolean state) { 287 if (cbMatchCase().isSelected()!=state) { 288 cbMatchCase().push(); 289 } 290 } 291 292 293 296 public void checkMatchWholeWordsOnly(boolean state) { 297 if (cbMatchWholeWordsOnly().isSelected()!=state) { 298 cbMatchWholeWordsOnly().push(); 299 } 300 } 301 302 305 public void checkBackwardSearch(boolean state) { 306 if (cbBackwardSearch().isSelected()!=state) { 307 cbBackwardSearch().push(); 308 } 309 } 310 311 314 public void checkWrapSearch(boolean state) { 315 if (cbWrapSearch().isSelected()!=state) { 316 cbWrapSearch().push(); 317 } 318 } 319 320 323 public void checkRegularExpressions(boolean state) { 324 if (cbRegularExpressions().isSelected()!=state) { 325 cbRegularExpressions().push(); 326 } 327 } 328 329 332 public void checkSearchSelection(boolean state) { 333 if (cbSearchSelection().isSelected()!=state) { 334 cbSearchSelection().push(); 335 } 336 } 337 338 340 public void find() { 341 btFind().push(); 342 } 343 344 346 public void replace() { 347 btReplace().push(); 348 } 349 350 352 public void replaceAll() { 353 btReplaceAll().push(); 354 } 355 356 358 public void close() { 359 btClose().push(); 360 } 361 362 364 public void help() { 365 btHelp().push(); 366 } 367 368 369 373 375 public void verify() { 376 lblFindWhat(); 377 cboFindWhat(); 378 lblReplaceWith(); 379 cboReplaceWith(); 380 cbHighlightSearch(); 381 cbIncrementalSearch(); 382 cbMatchCase(); 383 cbMatchWholeWordsOnly(); 384 cbBackwardSearch(); 385 cbWrapSearch(); 386 cbRegularExpressions(); 387 cbSearchSelection(); 388 btFind(); 389 btReplace(); 390 btReplaceAll(); 391 btClose(); 392 btHelp(); 393 } 394 395 398 public static void main(String args[]) { 399 new Replace().verify(); 400 System.out.println("Replace verification finished."); 401 } 402 } 403 404 | Popular Tags |