KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > lib > PropertiesEditorTestCase


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * File PropertiesEditorOperator.java
22  *
23  * Created on 24.9.02 18:18
24  *
25  * Description :
26  *
27  * This is operator used in autometed tests. Operator has been
28  * writed in Jelly2
29  *
30  */

31
32
33 package lib;
34
35
36 import java.io.File JavaDoc;
37 import java.util.*;
38 import javax.swing.*;
39 import org.netbeans.jellytools.*;
40 import org.netbeans.jellytools.actions.*;
41 import org.netbeans.jellytools.nodes.*;
42 import org.netbeans.jellytools.nodes.Node;
43 import org.netbeans.jellytools.properties.*;
44 import org.netbeans.jemmy.*;
45 import org.netbeans.jemmy.operators.*;
46 import org.netbeans.junit.NbTestCase;
47 import org.netbeans.junit.ide.ProjectSupport;
48
49
50 /** Class implementing all necessary methods for handling Property sheet in Editor window.
51  * This class is used for automated tests of properties module.
52  * @author Petr Felenda ( e-mail petr.felenda@sun.com )
53  * @version 1
54  */

55 public class PropertiesEditorTestCase extends JellyTestCase {
56     
57     protected static final String JavaDoc defaultProjectName = "properties_test";
58     private String JavaDoc projectName;
59     private String JavaDoc treeSubPackagePathToFile;
60     protected String JavaDoc treeSeparator = "|";
61     protected String JavaDoc menuSeparator = "#";
62     protected String JavaDoc defaultPackage = "<default package>";
63     protected final String JavaDoc WIZARD_CATEGORY = "Standard";
64     protected final String JavaDoc WIZARD_CATEGORY_FILE = "Other";
65     protected final String JavaDoc WIZARD_FILE_TYPE = "Properties File";
66     protected final String JavaDoc WIZARD_DEFAULT_PROPERTIES_FILE_NAME = "newproperties";
67     
68     /*
69      * declaration of members variables
70      */

71     private final String JavaDoc TITLE_ADD_LOCALE_DIALOG = "";//Bundle.getStringTrimmed("org.netbeans.modules.properties.Bundle", "CTL_NewLocaleTitle"); // String : New Locale
72
private final String JavaDoc TITLE_NEW_PROPERTY_DIALOG = "";//Bundle.getStringTrimmed("org.netbeans.modules.properties.Bundle", "CTL_NewPropertyTitle"); // String : New Property
73
private final String JavaDoc TITLE_HELP_DIALOG = "Help";
74     private final String JavaDoc TITLE_ERROR_DIALOG = "";//Bundle.getStringTrimmed("org.openide.Bundle", "NTF_ErrorTitle"); // String : Error
75
private final String JavaDoc TITLE_SAVE_QUESTION_DIALOG = "";//Bundle.getStringTrimmed("org.openide.text.Bundle", "LBL_SaveFile_Title"); // String : Question
76
private final String JavaDoc TITLE_QUESTION_DIALOG = "Question"; // String : Question
77
private final String JavaDoc TITLE_CUSTOMIZE_LOCALES_DIALOG = "";//Bundle.getStringTrimmed("org.netbeans.core.Bundle", "CTL_Customizer_dialog_title"); // String : Customizer Dialog
78
private final String JavaDoc TITLE_CUSTOMIZE_PROPERTIES_DIALOG = "";//Bundle.getStringTrimmed("org.netbeans.core.Bundle", "CTL_Customizer_dialog_title"); // The same string as last one
79
private final String JavaDoc TITLE_DIALOG_CONFIRM_OBJECT_DELETION = "";//Bundle.getStringTrimmed("org.openide.explorer.Bundle", "MSG_ConfirmDeleteObjectTitle"); // String : Confirm Object deletion
80
private final String JavaDoc TITLE_DELETE_MORE_LOCALES_CONFIRMATION_DIALOG = "";//Bundle.getStringTrimmed("org.openide.explorer.Bundle", "MSG_ConfirmDeleteObjectsTitle"); // String : Confirm Multiple Object Deletion
81
private final String JavaDoc TITLE_WELCOME = "";//Bundle.getStringTrimmed("org.netbeans.modules.welcome.Bundle", "LBL_Tab_Title"); // String Welcome
82
private final String JavaDoc TITLE_PROPERTIES_WINDOW_TABLE = "";//Bundle.getStringTrimmed("org.netbeans.core.Bundle", "CTL_FMT_GlobalProperties"); // String : Properties of
83
private final String JavaDoc TITLE_PROPERTIES_WINDOW_TAB = "";//Bundle.getStringTrimmed("org.openide.nodes.Bundle", "Properties"); // String : Properties
84

85     private final String JavaDoc BUTTON_NAME_NEW_PROPERTY = "";//Bundle.getStringTrimmed("org.netbeans.modules.properties.Bundle", "LBL_AddPropertyButton"); // String : New Property
86
private final String JavaDoc BUTTON_NAME_REMOVE_PROPERTY = "";//Bundle.getStringTrimmed("org.netbeans.modules.properties.Bundle", "LBL_RemovePropertyButton"); // String : Remove Property
87
private final String JavaDoc BUTTON_NAME_REMOVE_LOCALE = "";//Bundle.getStringTrimmed("org.netbeans.modules.properties.Bundle", "CTL_RemoveLocale"); // String : Remove Locale
88
private final String JavaDoc BUTTON_NAME_ADD_LOCALE = "";//Bundle.getStringTrimmed("org.netbeans.modules.properties.Bundle", "CTL_AddLocale"); // String : Add Locale
89
private final String JavaDoc BUTTON_NAME_ADD_KEY = "";//Bundle.getStringTrimmed("org.netbeans.modules.properties.Bundle", "CTL_AddKey"); // String : Add Key
90
private final String JavaDoc BUTTON_NAME_REMOVE_KEY = "";//Bundle.getStringTrimmed("org.netbeans.modules.properties.Bundle", "CTL_RemoveKey"); // String : Remove Key
91
private final String JavaDoc BUTTON_NAME_YES = "";//Bundle.getStringTrimmed("org.netbeans.core.Bundle", "YES_OPTION_CAPTION"); // String : Yes
92
private final String JavaDoc BUTTON_NAME_NO = "";//Bundle.getStringTrimmed("org.netbeans.core.Bundle", "NO_OPTION_CAPTION"); // String : No
93
private final String JavaDoc BUTTON_NAME_DISCARD = "Discard";
94     
95     private final String JavaDoc POPUP_MENU_ADD_LOCALE = "";//Bundle.getStringTrimmed("org.openide.actions.Bundle", "NewArg")+Bundle.getStringTrimmed("org.netbeans.modules.properties.Bundle", "LAB_NewLocaleAction"); // String : Add Locale...
96
private final String JavaDoc POPUP_MENU_CUSTOMIZE = "";//Bundle.getStringTrimmed("org.openide.actions.Bundle", "Customize"); // String : Customize
97
private final String JavaDoc POPUP_MENU_ADD_PROPERTY = "";//Bundle.getStringTrimmed("org.openide.actions.Bundle", "NewArg")+Bundle.getStringTrimmed("org.netbeans.modules.properties.Bundle", "LAB_NewPropertyAction"); // String : Add Property
98
private final String JavaDoc POPUP_MENU_DELETE_LOCALE = "";//Bundle.getStringTrimmed("org.openide.actions.Bundle", "Delete");; // String : Delete
99
private final String JavaDoc POPUP_MENU_EDIT = "";//Bundle.getStringTrimmed("org.openide.actions.Bundle", "Edit"); // String : Edit
100

101     private final String JavaDoc LABEL_KEY = "";//Bundle.getStringTrimmed("org.netbeans.modules.properties.Bundle", "LBL_KeyLabel"); // String : Key
102
private final String JavaDoc LABLE_VALUE = "";//Bundle.getStringTrimmed("org.netbeans.modules.properties.Bundle", "LBL_ValueLabel"); // String : Value
103
private final String JavaDoc RESOURCE_BUNDLE_COMMENT = " Sample ResourceBundle properties file\n\n";
104     
105     private final String JavaDoc EXCEPTION_TEXT = "Text typing";
106     
107     private final String JavaDoc WIZARD_TREE_STRING = "";//Bundle.getStringTrimmed("org.netbeans.modules.text.Bundle", "Templates/Other")+"|"+Bundle.getStringTrimmed("org.netbeans.modules.properties.Bundle", "Templates/Other/properties.properties"); // String : "Other|Properties File";
108

109     
110     /** This constructor only creates operator's object and then does nothing. */
111     public PropertiesEditorTestCase(String JavaDoc testMethodName) {
112         super(testMethodName);
113     }
114     
115     
116     
117     /** This method open project.
118      * 1) It is checked if the project is open
119      * before the project is opened.
120      * 2) open project
121      * 3) check if project is open
122      * @param projectName is name of the project stored in .../editor/test/qa-functional/data/ directory.
123      */

124     protected void openProject(String JavaDoc projectName) {
125         this.projectName = projectName;
126         File JavaDoc projectPath = new File JavaDoc(this.getDataDir() + "/projects/", projectName);
127         log("data dir = "+this.getDataDir().toString());
128         log("project path = "+projectPath.toString());
129         
130         /* 1. check if project is open */
131         ProjectsTabOperator pto = new ProjectsTabOperator();
132         pto.invoke();
133         log("treecount before = "+pto.tree().getChildCount(pto.tree().getRoot()));
134         int childCount = pto.tree().getChildCount(pto.tree().getRoot());
135         for ( int i=0; i < childCount; i++ ) {
136             String JavaDoc str = pto.tree().getChild(pto.tree().getRoot(),i).toString();
137             log("Found existed project in ProjectView: "+str);
138             if ( str.equals(projectName) ) {
139                 log("Project "+projectName+" is open, but shoud not be!");
140                 return;
141             }
142         }
143         
144         /* 2. open project */
145         Object JavaDoc prj= ProjectSupport.openProject(projectPath);
146         log("treecount after = "+pto.tree().getChildCount(pto.tree().getRoot()));
147         
148         /* 3. check the project name */
149         pto.invoke();
150         childCount = pto.tree().getChildCount(pto.tree().getRoot());
151         for ( int i=0; i < childCount; i++ ) {
152             String JavaDoc str = pto.tree().getChild(pto.tree().getRoot(),i).toString();
153             if ( str.equals(projectName) ) {
154                 log("Project "+projectName+" is open. (Ok)");
155                 return;
156             }
157         }
158         log("Project is not open, but should be!");
159         fail("Project is not open");
160     }
161     
162     
163     protected void openDefaultProject() {
164         openProject(defaultProjectName);
165     }
166     
167     
168     protected Node getDefaultPackageNode() {
169         ProjectsTabOperator pto = new ProjectsTabOperator();
170         pto.invoke();
171         ProjectRootNode prn = pto.getProjectRootNode(projectName);
172         prn.select();
173         Node node = new Node(prn,defaultPackage);
174         return node;
175     }
176     
177     protected Node getNode(String JavaDoc packageName) {
178         ProjectsTabOperator pto = new ProjectsTabOperator();
179         pto.invoke();
180         ProjectRootNode prn = pto.getProjectRootNode(projectName);
181         prn.select();
182         Node node = new Node(prn,"Source Packages"+treeSeparator+packageName);
183         return node;
184     }
185     
186     /** This method opens file in editor. There is used popup menu in explorer.<br>
187      * Usage :<br>
188      * FilesystemNode filesystemNode = new FilesystemNode(<br>
189      * System.getProperty("netbeans.user") + <br>
190      * File.separator + <br>
191      * "sampledir");<br>
192      * <br>
193      * openExistedPropertiesFile(filesystemNode.getPath()+"|"+"myFile");<br>
194      * @param filePath of existed file in explorer ( without extension )
195      */

196     // public void openExistedPropertiesFile(String filePath) {
197
public void openExistedPropertiesFile(String JavaDoc treeSubPackagePathToFile, String JavaDoc fileName) {
198         this.treeSubPackagePathToFile = "Source Packages"+this.treeSeparator+treeSubPackagePathToFile;
199         ProjectsTabOperator pto = new ProjectsTabOperator();
200         pto.invoke();
201         ProjectRootNode prn = pto.getProjectRootNode(projectName);
202         prn.select();
203         Node node = new Node(prn,treeSubPackagePathToFile+treeSeparator+fileName);
204         node.performPopupAction("Open");
205     }
206     
207     
208     /** This method opens file in editor. There is used popup menu in explorer for this action.
209      * @param filesystemNode of mounted directory ( without extension )
210      * @param filePath of file in explorer tree
211      */

212     public void openExistedPropetiesFileInClassicEditor(Node filesystemNode, String JavaDoc filePath) {
213         new EditAction().performPopup(new Node(filesystemNode,filePath));
214     }
215     
216     
217     /** It creates new property file. There is used popup menu from explorer.
218      * @param filesystemNode node of tree, where file will be created
219      * @param filePath of file without extension
220      */

221     public void createNewPropertiesFile(Node node) {
222         NewFileWizardOperator newWizard = NewFileWizardOperator.invoke(node, this.WIZARD_CATEGORY, this.WIZARD_FILE_TYPE);
223         newWizard.finish();
224     }
225     
226     
227     /** It clicks to the 'New property' button in properties editor ( table view ) */
228     public void propertiesEditorClickNewPropertyButton(String JavaDoc fileName) {
229         JButtonOperator jButtonOperator = new JButtonOperator(new TopComponentOperator(fileName),this.BUTTON_NAME_NEW_PROPERTY);
230         jButtonOperator.pushNoBlock();
231         new EventTool().waitNoEvent(250);
232         
233     }
234     
235     
236     /** This pushs 'Remove property' button in properties editor form. */
237     public void propertiesEditorClickRemovePropertyButton(String JavaDoc fileName) {
238         JButtonOperator jButtonOperator = new JButtonOperator(new TopComponentOperator(fileName),this.BUTTON_NAME_REMOVE_PROPERTY);
239         jButtonOperator.pushNoBlock();
240     }
241     
242     
243     /** This opens popup menu over tab in properties file and chooses close item from it. */
244     public void propertiesEditorCloseFromTabPane() throws Exception JavaDoc {
245         throw new Exception JavaDoc("Do not use this method. Not defined in Operator yet");
246     }
247     
248     
249     /** This deletes properties file from disk. There is used popup menu in Explorer.
250      * @param filesystemNode of tree, where file is stored ( without file name )
251      * @param filePath of file to delete
252      */

253     public void deletePropertiesFileFromExplorer(Node filesystemNode, String JavaDoc filePath) {
254         PropertiesNode propNode = new PropertiesNode(filesystemNode, filePath);
255         propNode.delete();
256         new NbDialogOperator(this.TITLE_DIALOG_CONFIRM_OBJECT_DELETION).yes();
257         
258     }
259     
260     
261     /** This closes properties file. There is used popup menu in Explorer.
262      * @param filesystemNode of tree, where file is stored ( without file name )
263      * @param filePath of file to delete
264      */

265     public void closePropertiesFile(String JavaDoc fileName) {
266         EditorOperator eo = new EditorOperator(fileName);
267         eo.close();
268     }
269     
270     /** This close all files in editor. This method should be called in teardown method
271      */

272     public void closeFiles() {
273         EditorOperator.closeDiscardAll();
274     }
275     
276     
277     /** This fill three textafields in 'New property' dialog.
278      * @param key which will be filled to appeared dialog 'New property'
279      * @param value of key, which will be filled to appeared dialog 'New property'
280      * @param comment of key, which will be filles to appeared dialog 'New property'
281      * @throws Exception is throws if appeared
282      */

283     public void newPropertyDialogFill(String JavaDoc fileName, String JavaDoc key, String JavaDoc value, String JavaDoc comment) throws Exception JavaDoc {
284         new EventTool().waitNoEvent(250);
285         boolean finished = false;
286         do {
287             NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_NEW_PROPERTY_DIALOG);
288             ContainerOperator containerOperator = new ContainerOperator(nbDialogOperator);
289             int limit = 0;
290             try {
291                 
292                 JTextFieldOperator jTextFieldOperator = null;
293                 if ( key != null ) {
294                     jTextFieldOperator = new JTextFieldOperator(containerOperator, 0);
295                     jTextFieldOperator.typeText(key);
296                 }
297                 if ( value != null ){
298                     jTextFieldOperator = new JTextFieldOperator(containerOperator, 1);
299                     jTextFieldOperator.typeText(value);
300                 }
301                 if ( comment != null ){
302                     jTextFieldOperator = new JTextFieldOperator(containerOperator, 2);
303                     jTextFieldOperator.typeText(comment);
304                 }
305                 
306                 finished = true;
307                 
308             } catch ( TimeoutExpiredException ex) {
309                 //if ( ex.getMessage().equals(this.EXCEPTION_TEXT) == false )
310
// throw new Exception(ex.getMessage());
311
// if problems occurs then use this code to wake up dialog anyway
312
// close the dialog and open it anyway
313
newPropertyDialogClickCancelButton();
314                 propertiesEditorClickNewPropertyButton(fileName);
315             }
316             
317             JButtonOperator bo = new JButtonOperator(containerOperator);
318             bo.requestFocus();
319             
320             if ( limit++ >= 3 )
321                 finished = true;
322             
323         } while ( finished == false );
324     }
325     
326     
327     /** This closes 'New property' dialog. There is used close button for this action in
328      * this dialog. ( dialog must be open )
329      */

330     public void newPropertyDialogClickCloseButton() {
331         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_NEW_PROPERTY_DIALOG);
332         //nbDialogOperator.btOK().requestFocus();
333
//nbDialogOperator.btOK().pushNoBlock();
334
nbDialogOperator.ok();
335         System.out.println(">> Ok button pushed");
336     }
337     
338     
339     /** This closes dialog as in previous method, but there is used no block action for closing dialog. */
340     public void newPropertyDialogClickOkButtonNoBlock() {
341         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_NEW_PROPERTY_DIALOG);
342         //nbDialogOperator.btOK().pushNoBlock();
343
nbDialogOperator.ok();
344     }
345     
346     
347     /** There will be found adequte key in property sheet and then will be checked value and comment. If kye will not found then method fail.
348      * @param key which will be compared with key in properties file
349      * @param value of key which will be compared with value in properties file
350      * @param comment of key witch will be compared with comment in propertiies file
351      * @param rowOfCheckedProperty is number of compared propererty in properties file (row position >=0)
352      * @param localeCount is count of locales in properties file, new file has 1 locale (default)
353      * @param rowCount is count of rows (properties) in properties file
354      * @throws Exception if an appeared
355      */

356     public void checkPropertiesInSheet(String JavaDoc fileName, String JavaDoc key, String JavaDoc value, String JavaDoc comment, int rowOfCheckedProperty, int localeCount, int rowCount) throws Exception JavaDoc {
357         
358         if ( key == null )
359             key = "";
360         if ( value == null )
361             value = "";
362         if ( comment == null )
363             comment = "";
364         
365         // Checking texfields ( Comment and Key ) under table.
366
// ==================================================
367

368         TopComponentOperator tco = new TopComponentOperator(fileName);
369         JTable jTable = JTableOperator.findJTable(tco.getContainer(ComponentSearcher.getTrueChooser("")),ComponentSearcher.getTrueChooser(""));
370         
371         if ( rowOfCheckedProperty == 1 ) {
372             // first row is not normal bacause there is comment of file in it + comment of the property
373
comment = this.RESOURCE_BUNDLE_COMMENT.concat(comment);
374         }
375         
376         // click to key field in table
377

378         // WA the next two rows are work around of jemmy because the action clickOnCell+waitEmpty is not
379
// WA the same as user event called from mouse, keyboard
380
new JTableOperator(jTable).clickOnCell(rowOfCheckedProperty-1 ,1);
381         new EventTool().waitNoEvent(500);
382         // END OF WA
383

384         new JTableOperator(jTable).clickOnCell(rowOfCheckedProperty-1 ,0);
385         
386         JTextArea jTextArea = JTextAreaOperator.findJTextArea(tco.getContainer(ComponentSearcher.getTrueChooser("")),ComponentSearcher.getTrueChooser(""),0);
387         
388         if ( jTextArea == null )
389             System.out.println("> Comment textarea is null");
390         else {
391             System.out.println("> Comment textarea is found.");
392             
393             if ( ! jTextArea.getText().equals(comment) ) {
394                 System.out.println("textarea == string : \""+jTextArea.getText()+"\" == \""+comment+"\"");
395                 throw new Exception JavaDoc("Comment is not equal to the specified string. (comparing in textarea under the table)");
396             } else
397                 System.out.println("> Comment is Ok in textarea under the table.");
398         }
399         
400         if ( rowCount == 0 ) {
401             // if label == key then compare key else comapre value
402
JLabel jLabel = JLabelOperator.findJLabel(tco.getContainer(ComponentSearcher.getTrueChooser("")),ComponentSearcher.getTrueChooser(""),1);
403             String JavaDoc label = jLabel.getText();
404             System.out.println("> label = "+label);
405             if ( this.LABEL_KEY.equals(label) ) {
406                 jTextArea = JTextAreaOperator.findJTextArea(tco.getContainer(ComponentSearcher.getTrueChooser("")),ComponentSearcher.getTrueChooser(""),1);
407                 if ( jTextArea == null )
408                     System.out.println("> Key textarea is null");
409                 else {
410                     System.out.println("> Key textarea is found.");
411                     if ( ! jTextArea.getText().equals(key) ) {
412                         System.out.println("textarea == string : "+jTextArea.getText()+" == "+key);
413                         throw new Exception JavaDoc("Key is not equal to the specified string. (comparing in textarea under the table)");
414                     } else
415                         System.out.println("> Key is Ok in textarea under the table.");
416                 }
417             } else if ( this.LABLE_VALUE.equals(label) ) {
418                 jTextArea = JTextAreaOperator.findJTextArea(tco.getContainer(ComponentSearcher.getTrueChooser("")),ComponentSearcher.getTrueChooser(""),1);
419                 if ( jTextArea == null )
420                     System.out.println("> Value textarea is null");
421                 else {
422                     System.out.println("> Value textarea is found.");
423                     if ( ! jTextArea.getText().equals(value) ) {
424                         System.out.println("textarea == string : "+jTextArea.getText()+" == "+value);
425                         throw new Exception JavaDoc("Value is not equal to the specified string. (comparing in textarea under the table)");
426                     } else
427                         System.out.println("> Value is Ok in textarea under the table.");
428                 }
429                 
430             } else
431                 throw new Exception JavaDoc("Label of Key or Value textarea is corrupted!");
432             
433             
434         } else {
435             System.out.println("More rows in table (rows>0)");
436             // comapre key and then compare value
437
System.out.println(">Click to row"+rowOfCheckedProperty);
438             // click to value field in table
439
new JTableOperator(jTable).clickOnCell(rowOfCheckedProperty-1,1);
440             
441             jTextArea = JTextAreaOperator.findJTextArea(tco.getContainer(ComponentSearcher.getTrueChooser("")),ComponentSearcher.getTrueChooser(""),1);
442             if ( jTextArea == null )
443                 System.out.println("> Value textarea is null");
444             else {
445                 System.out.println("> Value textarea is found.");
446                 if ( ! jTextArea.getText().equals(value) ) {
447                     System.out.println("textarea == string : "+jTextArea.getText()+" == "+value);
448                     throw new Exception JavaDoc("Value is not equal to the specified string. (comparing in textarea under the table)");
449                 } else
450                     System.out.println("> Value is Ok in textarea under the table.");
451             }
452             // click to key fild in table
453
new JTableOperator(jTable).clickOnCell(rowOfCheckedProperty-1 ,0);
454             
455             jTextArea = JTextAreaOperator.findJTextArea(tco.getContainer(ComponentSearcher.getTrueChooser("")),ComponentSearcher.getTrueChooser(""),1);
456             if ( jTextArea == null )
457                 System.out.println("> Key textarea is null");
458             else {
459                 System.out.println("> Key textarea is found.");
460                 if ( ! jTextArea.getText().equals(key) ) {
461                     System.out.println("textarea == string : "+jTextArea.getText()+" == "+key);
462                     throw new Exception JavaDoc("Key is not equal to the specified string. (comparing in textarea under the table)");
463                 } else
464                     System.out.println("> Key is Ok in textarea under the table.");
465             }
466             
467         }
468         
469         // Checking table
470

471         new EventTool().waitNoEvent(250);
472         
473         // find in table if any key which matchs to the parametr
474
int index = -1;
475         
476         if ( jTable != null ) {
477             
478             if ( jTable.getRowCount() == rowCount && rowCount == 0 ) {
479                 System.out.println("> There is no rows in table. (OK)");
480                 return;
481             } else
482                 if ( rowCount == 0 )
483                     System.out.println("> Table shouldn't have any row!(There is "+jTable.getRowCount()+" rows)");
484             
485             if ( key != null )
486                 for ( int ii = 0; ii < jTable.getModel().getRowCount(); ii++) {
487                 // check if is the key in properties file more times
488
new EventTool().waitNoEvent(250);
489                 if ( index >= 0 && jTable.getModel().getValueAt(ii,0).toString().equals(key) == true ) {
490                     throw new Exception JavaDoc("The added key is more times in properties sheet.");
491                 }
492                 
493                 if ( index == -1 && jTable.getModel().getValueAt(ii,0).toString().toString().equals(key) == true ) {
494                     index = ii;
495                     // check value of property if is equal to the value
496
if ( jTable.getModel().getValueAt(ii,1).toString().toString().equals(value) == false )
497                         throw new Exception JavaDoc("Value doesn't match. "+ ii +" - ("+ value + " not equals "+ jTable.getCellEditor(ii, 1).getCellEditorValue().toString() );
498                     // check comment
499
new JTableOperator(jTable).clickOnCell(ii,0);
500                     new EventTool().waitNoEvent(250);
501                     
502                     // check comment of property if is equal to the comment
503
if ( new JTextAreaOperator(new ContainerOperator(tco.getContainer(ComponentSearcher.getTrueChooser(""))),0).getText().equals(comment) == false )
504                         throw new Exception JavaDoc("Comment doesn't match. "+ ii +" : \n>"+ comment + "< not equals with : >"+ new JTextAreaOperator(new ContainerOperator(tco.getContainer(ComponentSearcher.getTrueChooser(""))),0).getText()+"<\n" );
505                     
506                     if ( ii+1 != rowOfCheckedProperty )
507                         throw new Exception JavaDoc("Property is not in the right row in property sheet.");
508                 }
509                 
510                 }
511             
512             if ( index < 0 && rowOfCheckedProperty >= 0)
513                 throw new Exception JavaDoc("Key not found in properties sheet");
514             
515             if ( localeCount >= 0 && localeCount != jTable.getModel().getColumnCount() - 1 ) {
516                 int locales = jTable.getModel().getColumnCount()-1;
517                 throw new Exception JavaDoc("Count of locales (columns-1) doesn't match. ("+ localeCount +"<>"+ locales +")");
518             }
519             
520             if ( rowCount >= 0 && rowCount != jTable.getModel().getRowCount() )
521                 throw new Exception JavaDoc("Count of properties (rows) doesn't match. ("+rowCount+"<>"+jTable.getModel().getRowCount()+")");
522             
523         } else
524             throw new Exception JavaDoc("Cann't find JTable in Editor Window");
525     }
526     
527     
528     /** This method check pleces of keys, values and comments in properties file (in
529      * text mode)
530      * @throws Exception if an appeared
531      */

532     public void checkPropertiesFileIntegrityInClassicEditor(String JavaDoc fileName) throws Exception JavaDoc {
533         // open properties file in classic editor and them chek spaces, comments, keys, values
534
// and their positions
535
EditorOperator eo = new EditorOperator(fileName);
536         String JavaDoc content = eo.getText();
537         StringTokenizer strT = new StringTokenizer(content,"\n",true);
538         String JavaDoc row = "";
539         try {
540             for ( int ii = 0; ii < strT.countTokens(); ii++ ) {
541                 // comment of file
542
if ( ii == 0 ) {
543                     row = strT.nextToken();
544                     
545                     if ( row.charAt(0) != '#' )
546                         throw new Exception JavaDoc("Structure of properties file has been corrupted");
547                     // end row
548
row = strT.nextToken();
549                     
550                     try {
551                         // free row or end of file
552
row = strT.nextToken();
553                     } catch ( NoSuchElementException ex ) {
554                         // no properties in file
555
return;
556                     }
557                     
558                 }
559                 
560                 // comment of property
561
row = strT.nextToken();
562                 
563                 // comment of property
564
if ( row.charAt(0) != '#' )
565                     throw new Exception JavaDoc("Structure of properties file has been corrupted");
566                 
567                 // end row
568
row = strT.nextToken();
569                 
570                 
571                 // key and value of property
572
row = strT.nextToken();
573                 StringTokenizer strT2 = new StringTokenizer(row);
574                 String JavaDoc key = strT2.nextToken("=\n");
575                 String JavaDoc value = strT2.nextToken("=\n");
576                 if ( key == null || value == null )
577                     throw new Exception JavaDoc("Structure of properties file has been corrupted");
578             }
579         } catch ( NoSuchElementException ex ) {
580             throw new Exception JavaDoc("Structure of properties file has been corrupted");
581         }
582         
583     }
584     
585     
586     /** It clicks on 'Help' button in 'New property' dialog. */
587     public void newPropertyDialogClickHelpButton() {
588         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_NEW_PROPERTY_DIALOG);
589         nbDialogOperator.help();
590     }
591     
592     
593     /** Closes 'Help' window. */
594     public void closeHelp() {
595         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_HELP_DIALOG);
596         nbDialogOperator.close();
597     }
598     
599     
600     /** Closes 'Error' dialog. This dialog appeared after property is added with existed key. (Key which
601      * exists in properties file)
602      */

603     public void errorDialogClickOkButton() {
604         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_ERROR_DIALOG);
605         nbDialogOperator.ok();
606     }
607     
608     
609     /** Closes 'New property' dialog. There is used 'Cancel' button. */
610     public void newPropertyDialogClickCancelButton() {
611         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_NEW_PROPERTY_DIALOG);
612         nbDialogOperator.cancel();
613     }
614     
615     
616     /** This selectes row in sheet of properties in properties editor.
617      * @param rowNumber is number of row in property sheet
618      * @throws Exception if an appeared
619      */

620     public void selectPropertiesFileItem(String JavaDoc fileName, int rowNumber) throws Exception JavaDoc {
621         TopComponentOperator tco = new TopComponentOperator(fileName);
622         
623         JTable jTable = JTableOperator.findJTable(tco.getContainer(ComponentSearcher.getTrueChooser("")),ComponentSearcher.getTrueChooser(""));
624         new EventTool().waitNoEvent(250);
625         // find in table if any key match to the parametr
626

627         if ( jTable != null ) {
628             JTableOperator jTableOperator = new JTableOperator(jTable);
629             jTableOperator.getTimeouts().setTimeout("JScrollBarOperator.WholeScrollTimeout", 240000);
630             jTableOperator.clickOnCell(rowNumber,1);
631             return;
632         }
633         throw new Exception JavaDoc("Info : Cannot select item id properties table.");
634     }
635     
636     
637     /** There will be counted rows in property sheet in properties editor.
638      * @return counts of rows in property sheet
639      *
640      * @throws Exception if an appeared
641      */

642     public int getPropertiesFileItemsCount(String JavaDoc fileName) throws Exception JavaDoc {
643         TopComponentOperator tco = new TopComponentOperator(fileName);
644         
645         JTable jTable = JTableOperator.findJTable(tco.getContainer(ComponentSearcher.getTrueChooser("")),ComponentSearcher.getTrueChooser(""));
646         new EventTool().waitNoEvent(250);
647         // find in table if any key match to the parametr
648

649         if ( jTable != null )
650             return jTable.getModel().getRowCount();
651         return -1;
652         
653     }
654     
655     
656     /** Clicks to button 'Ok' in Quiestion dialog. This dialog appeared after pushing 'Remove Property' button. */
657     public void questionDialogClickOkButton() {
658         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_SAVE_QUESTION_DIALOG);
659         nbDialogOperator.ok();
660     }
661     
662     public void questionDialogClickDiscardButton() {
663         QuestionDialogOperator qdo = new QuestionDialogOperator(TITLE_QUESTION_DIALOG);
664         JButtonOperator jbo = new JButtonOperator(qdo,BUTTON_NAME_DISCARD);
665         jbo.pushNoBlock();
666     }
667     
668     /** Clicks to 'Cancel' button in 'Question' dialog. This dialog appeared after pushing 'Remove Property' button in
669      * properties editor.
670      */

671     public void questionDialogClickCancelButton() {
672         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_SAVE_QUESTION_DIALOG);
673         nbDialogOperator.cancel();
674     }
675     
676     
677     /** Method createNewPropertiesFileToClassicEditor()
678      * @param filesystemNode is node of filesystem in which is file located in Explorer
679      * @param fileName is name of file
680      */

681     public void createNewPropertiesFileAndOpenInClassicEditor(Node node, String JavaDoc fileName) {
682         // create new file
683
NewFileWizardOperator newWizard = NewFileWizardOperator.invoke(node, this.WIZARD_CATEGORY, this.WIZARD_FILE_TYPE);
684         new NewFileNameLocationStepOperator().setName(fileName);
685         newWizard.finish();
686         
687         new EventTool().waitNoEvent(250);
688         
689         // close Properties Editor
690
TopComponentOperator tco = new TopComponentOperator(fileName);
691         tco.close();
692         // There is problem while writing tests becasuse we must have opened some source files.
693
//new EditorWindowOperator().close();
694
/*
695         JTabbedPaneOperator jTabbedPaneOperator = new EditorWindowOperator().tbpEditorTabbedPane();
696         if ( jTabbedPaneOperator != null && jTabbedPaneOperator.findPage(this.TITLE_WELCOME) < 0 ) {
697             CloseViewAction cva = new CloseViewAction();
698             //jTabbedPaneOperator.selectPage(fileName);
699             cva.performPopup(jTabbedPaneOperator);
700         } else {
701             // close whole editor becase there is no tabs in editor
702             new EditorWindowOperator().close();
703         }
704          */

705         // open classic editor from popup menu in Explorer window
706
//ExplorerOperator explorerOperator = new ExplorerOperator();
707
//RepositoryTabOperator eplorer = new RepositoryTabOperator();
708
ProjectsTabOperator pto = new ProjectsTabOperator();
709         pto.invoke();
710         ProjectRootNode prn = pto.getProjectRootNode(projectName);
711         prn.select();
712         String JavaDoc packageName = node.getPath();
713         new Node(prn, "Source Packages"+this.treeSeparator+packageName+this.treeSeparator+fileName).performPopupAction(this.POPUP_MENU_EDIT);
714         
715     }
716     
717     
718     /** Open 'Add Locale..' dialog and do nothing
719      * @param filesystemNode is node of filesystem in which is file located in Explorer
720      * @param filePath is path to file in tree in Explorer
721      */

722     public void openAddLocaleDialogFromExplorer(Node filesystemNode,String JavaDoc filePath) {
723         new ActionNoBlock(null,this.POPUP_MENU_ADD_LOCALE).performPopup(new Node(filesystemNode,filePath));
724     }
725     
726     
727     /** Fills values to 'Add Locale...' dialog. ( use null values if nothig to be filed )
728      * @param languageCode is Language Code e.g. cs, de, en or other staff
729      * @param countryCode is Country Code e.g. CZ, DE, US or other stuff
730      * @param variant is variant of locale, this should be empty or should will have value e.g. EURO
731      * @param filesystemNode is node of tree in explorer
732      * @param fileName is name of file
733      * @throws Exception if an appeared
734      */

735     public void addLocaleDialogFill(String JavaDoc languageCode, String JavaDoc countryCode, String JavaDoc variant, Node filesystemNode, String JavaDoc fileName) throws Exception JavaDoc {
736         new EventTool().waitNoEvent(250);
737         boolean finished = false;
738         do {
739             try {
740                 NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_ADD_LOCALE_DIALOG);
741                 //ContainerOperator containerOperator = new ContainerOperator(nbDialogOperator);
742
JComboBoxOperator jComboBoxOperator;
743                 jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
744                 if ( languageCode != null ) {
745                     jComboBoxOperator.typeText(languageCode);
746                 } else {
747                     jComboBoxOperator.typeText("");
748                 }
749                 jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
750                 if ( countryCode != null ){
751                     jComboBoxOperator.typeText(countryCode);
752                 } else {
753                     jComboBoxOperator.typeText("");
754                 }
755                 jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 2);
756                 if ( variant != null ){
757                     jComboBoxOperator.typeText(variant);
758                 } else {
759                     jComboBoxOperator.typeText("");
760                 }
761                 finished = true;
762                 System.out.println("Set languge: "+new JComboBoxOperator(nbDialogOperator, 0).getTextField().getText());
763                 System.out.println("Set country: "+new JComboBoxOperator(nbDialogOperator, 1).getTextField().getText());
764                 //nbDialogOperator.ge
765
} catch ( TimeoutExpiredException ex) {
766                 if ( ex.getMessage().equals(this.EXCEPTION_TEXT) == false )
767                     throw new Exception JavaDoc(ex.getMessage());
768                 // if problems occurs then use this code to wake up dialog anyway
769
// close the dialog and open it anyway
770
addLocaleDialogClickCancelButton();
771                 openAddLocaleDialogFromExplorer(filesystemNode, fileName);
772             }
773             
774         } while ( finished == false );
775         new EventTool().waitNoEvent(250);
776         
777     }
778     
779     
780     /** Clicks to 'Help' button in 'Add Locale...' dialog. */
781     public void addLocaleDialogClickHelpButton() {
782         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_ADD_LOCALE_DIALOG);
783         nbDialogOperator.help();
784     }
785     
786     
787     /** Clicks to 'Ok' button in 'Add Locale...' dialog. */
788     public void addLocaleDialogClickOkButtonNoBlock() {
789         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_ADD_LOCALE_DIALOG);
790         //nbDialogOperator.btOK().requestFocus();
791
//nbDialogOperator.btOK().pushNoBlock();
792
nbDialogOperator.ok();
793     }
794     
795     
796     /** Clicks to 'Cancel' button in 'Add Locale...' dialog. */
797     public void addLocaleDialogClickCancelButton() {
798         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_ADD_LOCALE_DIALOG);
799         nbDialogOperator.cancel();
800     }
801     
802     
803     /** Opens Customizer dialog.
804      * @param filesystemNode node of filesystem in tree in explorer
805      * @param path to the object you can customize
806      */

807     public void openCustomizeLocalesDialogFromExplorer(Node filesystemNode,String JavaDoc path) {
808         new ActionNoBlock(null,this.POPUP_MENU_CUSTOMIZE).performPopup(new Node(filesystemNode,path));
809     }
810     
811     
812     /** Clicks to 'Add Locale...' button in customizer. */
813     public void customizeLocalesDialogClickAddLocaleButton() {
814         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_CUSTOMIZE_LOCALES_DIALOG);
815         JButtonOperator jButtonOperator = new JButtonOperator( new ContainerOperator(nbDialogOperator),this.BUTTON_NAME_ADD_LOCALE);
816         jButtonOperator.pushNoBlock();
817     }
818     
819     
820     /** Clicks to 'Remove Locale' button in customizer. */
821     public void customizeLocalesDialogClickRemoveLocaleButton() {
822         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_CUSTOMIZE_LOCALES_DIALOG);
823         JButtonOperator jButtonOperator = new JButtonOperator( new ContainerOperator(nbDialogOperator),this.BUTTON_NAME_REMOVE_LOCALE);
824         jButtonOperator.pushNoBlock();
825     }
826     
827     
828     /** Clicks to 'Help' button in customizer. */
829     public void customizeLocalesDialogClickHelpButton() {
830         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_CUSTOMIZE_LOCALES_DIALOG);
831         //nbDialogOperator.btHelp().pushNoBlock();
832
nbDialogOperator.help();
833     }
834     
835     
836     /** Clicks to 'Close' button in customizer. */
837     public void customizeLocalesDialogClickCloseButton() {
838         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_CUSTOMIZE_LOCALES_DIALOG);
839         //nbDialogOperator.btClose().pushNoBlock();
840
nbDialogOperator.close();
841     }
842     
843     
844     /** Selects focus adequate to locale in customizer
845      * @param row of locale you wish to select
846      */

847     public void customizeLocalesDialogSelectLocale(int row) {
848         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_CUSTOMIZE_LOCALES_DIALOG);
849         JListOperator jListOperator = new JListOperator( new ContainerOperator(nbDialogOperator) );
850         jListOperator.selectItem(row-1);
851     }
852     
853     
854     /** This checks if has been selected 'Remove Locale' button.
855      * @return true if locale button has been selected
856      */

857     public boolean customizeLocalesDialogIsEnabledRemoveLocaleButton() {
858         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_CUSTOMIZE_LOCALES_DIALOG);
859         JButtonOperator jButtonOperator = new JButtonOperator( new ContainerOperator(nbDialogOperator),this.BUTTON_NAME_REMOVE_LOCALE);
860         return jButtonOperator.isEnabled();
861     }
862     
863     
864     /** Opens 'Add Property' dialog from explorer.
865      * @param filesystemNode is node of tree in explorer
866      * @param path of file in tree in explorer
867      */

868     public void openAddPropertyDialogFromExplorer(Node filesystemNode, String JavaDoc path) {
869         new ActionNoBlock(null,this.POPUP_MENU_ADD_PROPERTY).performPopup(new Node(filesystemNode,path));
870     }
871     
872     
873     public void openCustomizePropertiesDialogFromExplorer(Node fileNode, String JavaDoc path) {
874         new ActionNoBlock(null,this.POPUP_MENU_CUSTOMIZE).performPopup(new Node(fileNode,path));
875     }
876     
877     
878     public void customizePropertiesDialogClickHelpButton() {
879         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_CUSTOMIZE_PROPERTIES_DIALOG);
880         //nbDialogOperator.btHelp().pushNoBlock();
881
nbDialogOperator.help();
882     }
883     
884     
885     public void customizePropertiesDialogClickCloseButton() {
886         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_CUSTOMIZE_PROPERTIES_DIALOG);
887         //nbDialogOperator.btClose().pushNoBlock();
888
nbDialogOperator.close();
889     }
890     
891     
892     public void customizePropertiesDialogClickAddKeyButton() {
893         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_CUSTOMIZE_PROPERTIES_DIALOG);
894         JButtonOperator jButtonOperator = new JButtonOperator( new ContainerOperator(nbDialogOperator),this.BUTTON_NAME_ADD_KEY);
895         jButtonOperator.pushNoBlock();
896     }
897     
898     
899     public void customizePropertiesDialogClickRemovePropertyButton(){
900         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_CUSTOMIZE_PROPERTIES_DIALOG);
901         JButtonOperator jButtonOperator = new JButtonOperator( new ContainerOperator(nbDialogOperator),this.BUTTON_NAME_REMOVE_KEY);
902         jButtonOperator.requestFocus();
903         jButtonOperator.pushNoBlock();
904     }
905     
906     
907     public boolean customizePropertiesDialogIsEnableRemovePropertyButton() {
908         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_CUSTOMIZE_PROPERTIES_DIALOG);
909         JButtonOperator jButtonOperator = new JButtonOperator( new ContainerOperator(nbDialogOperator),this.BUTTON_NAME_REMOVE_KEY);
910         return jButtonOperator.isEnabled();
911         
912     }
913     
914     public void customizePropertiesDialogSelectProperty(int row) {
915         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_CUSTOMIZE_PROPERTIES_DIALOG);
916         JListOperator jListOperator = new JListOperator( new ContainerOperator(nbDialogOperator) );
917         jListOperator.selectItem(row-1);
918     }
919     
920     
921     public void deleteLocaleFromExplorer(Node fileNode, String JavaDoc path) {
922         new ActionNoBlock(null,this.POPUP_MENU_DELETE_LOCALE).performPopup(new Node(fileNode,path));
923     }
924     
925     
926     public void confirmationDeleteteLocaleDialogClickYes() {
927         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_DIALOG_CONFIRM_OBJECT_DELETION);
928         JButtonOperator jButtonOperator = new JButtonOperator( new ContainerOperator(nbDialogOperator),this.BUTTON_NAME_YES);
929         jButtonOperator.pushNoBlock();
930     }
931     
932     
933     public void confirmationDeleteteMoreLocalesDialogClickYes() {
934         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_DELETE_MORE_LOCALES_CONFIRMATION_DIALOG);
935         JButtonOperator jButtonOperator = new JButtonOperator( new ContainerOperator(nbDialogOperator),this.BUTTON_NAME_YES);
936         jButtonOperator.pushNoBlock();
937     }
938     
939     
940     public void confirmationDeleteteLocaleDialogClickNo() {
941         NbDialogOperator nbDialogOperator = new NbDialogOperator(this.TITLE_DIALOG_CONFIRM_OBJECT_DELETION);
942         JButtonOperator jButtonOperator = new JButtonOperator( new ContainerOperator(nbDialogOperator),this.BUTTON_NAME_NO);
943         jButtonOperator.pushNoBlock();
944     }
945     
946     
947     public int checkEditorTabCount() {
948         return -1;
949     }
950     
951     
952     public void deleteMoreLocalesInExplorer(String JavaDoc[] Languages, String JavaDoc[] Countres, String JavaDoc[] Varians, Node fileNode, String JavaDoc path_to_group) {
953         
954         Node[] nodes = new Node[Languages.length];
955         for ( int ii = 0; ii < Languages.length; ii++ ) {
956             String JavaDoc path = path_to_group.concat("|").concat(Languages[ii]).concat("_").concat(Countres[ii]);
957             System.out.println(">> path = "+ path);
958             nodes[ii] = new Node(fileNode, path);
959         }
960         new DeleteAction().performPopup(nodes);
961         
962     }
963     
964     
965     public void explorerSelectPath(String JavaDoc treePath, Node filesystemNode) {
966         Node node = new Node(filesystemNode,treePath);
967         node.select();
968     }
969     
970     
971     public void propertiesWindowChangeProperty(String JavaDoc objectName, String JavaDoc propertyName, String JavaDoc newValue) {
972         PropertySheetOperator.invoke();
973         PropertySheetOperator pso = new PropertySheetOperator(this.TITLE_PROPERTIES_WINDOW_TABLE.concat(objectName));
974         //PropertySheetTabOperator psto = new PropertySheetTabOperator(pso, this.TITLE_PROPERTIES_WINDOW_TAB);
975
StringProperty pr = new StringProperty(pso, propertyName);
976         pr.setValue(newValue);
977         new EventTool().waitNoEvent(250);
978 /* StringCustomEditorOperator stringCustomizerEditorOperator = pr.setinvokeCustomizer();
979         stringCustomizerEditorOperator.setStringValue(newValue);
980         new EventTool().waitNoEvent(250);
981         stringCustomizerEditorOperator.btOK().requestFocus();
982         new EventTool().waitNoEvent(250);
983         stringCustomizerEditorOperator.btOK().pushNoBlock();
984         new EventTool().waitNoEvent(250);*/

985     }
986     
987     
988     public void checkLocalesInExplorer(java.lang.String JavaDoc[] locales, Node filesystemNode, java.lang.String JavaDoc fileName) throws Exception JavaDoc {
989         new EventTool().waitNoEvent(300);
990         //org.openide.filesystems.FileSystem fileSytem = org.openide.filesystems.Repository.getDefault().findFileSystem(filesystemNode.getPath());
991
ProjectsTabOperator pto = new ProjectsTabOperator();
992         pto.invoke();
993         ProjectRootNode prn = pto.getProjectRootNode(projectName);
994         prn.select();
995         Node node = new Node(prn,"Source Packages"+this.treeSeparator+fileName);
996         String JavaDoc[] strs = node.getChildren();
997         if ( strs.length != locales.length ) {
998             throw new Exception JavaDoc("> There is bad count of locales in Explorer window. ("+strs.length+"<>"+locales.length+")");
999         }
1000        for ( int ii = 0 ; ii < locales.length; ii++)
1001            if ( strs[ii].compareTo(locales[ii]) != 0 )
1002                throw new Exception JavaDoc("> There is bad locale name in Explorer window. ("+strs[ii]+"<>"+locales[ii]+")");
1003        
1004    }
1005    
1006    
1007    public boolean existsFileInExplorer(String JavaDoc packageName, String JavaDoc fileName) {
1008        try {
1009            log("Testing name of file in Explorer : \""+fileName+"\"");
1010            ProjectsTabOperator pto = ProjectsTabOperator.invoke();
1011            //ProjectRootNode prn = pto.getProjectRootNode(projectName);
1012
//prn.select();
1013
//Node node = new Node(prn,treeSubPackagePathToFile+treeSeparator+fileName);
1014
SourcePackagesNode sourcePackagesNode = new SourcePackagesNode(defaultProjectName);
1015            log("source node:"+sourcePackagesNode.getPath());
1016            Node packageNode = new Node(sourcePackagesNode,packageName);
1017            log("package node:"+packageNode.getPath());
1018            Node fileNode = new Node(packageNode,fileName);
1019            
1020            log("Log: Found node "+fileNode.getText());
1021            return true;
1022        } catch (TimeoutExpiredException ex) {
1023            return false;
1024        }
1025    }
1026    
1027    public void requestFocusEditorPane(String JavaDoc nameOfTab) {
1028        TopComponentOperator tco = new TopComponentOperator(nameOfTab);
1029        tco.requestFocus();
1030        /*EditorWindowOperator ewo = new EditorWindowOperator();
1031        EditorOperator eo = ewo.getEditor(nameOfTab);
1032        eo.requestFocus();*/

1033    }
1034    
1035    public void tableViewClickTo(String JavaDoc fileName, int row, int column) {
1036        TopComponentOperator tco = new TopComponentOperator(fileName);
1037        JTable jTable = JTableOperator.findJTable(tco.getContainer(ComponentSearcher.getTrueChooser("")),ComponentSearcher.getTrueChooser(""));
1038        new JTableOperator(jTable).clickOnCell(row,column);
1039        
1040    }
1041    
1042    
1043    
1044    /** Check if file exists in Editor. This method compare the title name of
1045     * tab in editor window.
1046     */

1047    public boolean existsFileInEditor(String JavaDoc fileName) {
1048        try {
1049            log("Testing name of file in tab of Editor window : \""+fileName+"\"");
1050            EditorOperator ewo = new EditorOperator(fileName);
1051            ewo.close();
1052            return true;
1053        } catch (TimeoutExpiredException ex) {
1054            return false;
1055        }
1056        
1057    }
1058    
1059}
1060
1061
Popular Tags