1 19 20 package org.netbeans.jellytools.modules.java; 21 22 import java.awt.Container ; 23 import javax.swing.JDialog ; 24 import javax.swing.JLabel ; 25 import org.netbeans.jellytools.Bundle; 26 import org.netbeans.jellytools.NbDialogOperator; 27 import org.netbeans.jemmy.operators.JDialogOperator; 28 import org.netbeans.jemmy.operators.JLabelOperator; 29 import org.netbeans.jemmy.operators.JTableOperator; 30 31 37 public class FixImportsOperator extends NbDialogOperator { 38 39 40 public FixImportsOperator() { 41 super(waitFixImportDialog()); 42 } 43 44 private JLabelOperator _lblHtmlTheFollowingClassNamesWereFoundInMoreThanOnePackageSelectTheFullyQualifiedNameToUseInTheImportStatementHtml; 45 private JTableOperator _tabHtmlTheFollowingClassNamesWereFoundInMoreThanOnePackageSelectTheFullyQualifiedNameToUseInTheImportStatementHtml; 46 private static final String INTRO_LABEL = Bundle.getString("org.netbeans.modules.editor.java.Bundle", "FixDupImportStmts_IntroLbl"); 48 private static final String TITLE = "Fix All Imports"; 51 54 private static JDialog waitFixImportDialog() { 55 JDialogOperator candidate = new JDialogOperator(TITLE); 56 JLabel introLabel = JLabelOperator.findJLabel((Container )candidate.getSource(), INTRO_LABEL, true, true); 57 if(introLabel == null) { 58 candidate.waitClosed(); 59 candidate = new JDialogOperator(TITLE); 60 } 61 return (JDialog )candidate.getSource(); 62 } 63 64 68 71 public JLabelOperator lblHtmlTheFollowingClassNamesWereFoundInMoreThanOnePackageSelectTheFullyQualifiedNameToUseInTheImportStatementHtml() { 72 if (_lblHtmlTheFollowingClassNamesWereFoundInMoreThanOnePackageSelectTheFullyQualifiedNameToUseInTheImportStatementHtml==null) { 73 _lblHtmlTheFollowingClassNamesWereFoundInMoreThanOnePackageSelectTheFullyQualifiedNameToUseInTheImportStatementHtml = new JLabelOperator(this, INTRO_LABEL); 74 } 75 return _lblHtmlTheFollowingClassNamesWereFoundInMoreThanOnePackageSelectTheFullyQualifiedNameToUseInTheImportStatementHtml; 76 } 77 78 81 public JTableOperator tabHtmlTheFollowingClassNamesWereFoundInMoreThanOnePackageSelectTheFullyQualifiedNameToUseInTheImportStatementHtml() { 82 if (_tabHtmlTheFollowingClassNamesWereFoundInMoreThanOnePackageSelectTheFullyQualifiedNameToUseInTheImportStatementHtml==null) { 83 _tabHtmlTheFollowingClassNamesWereFoundInMoreThanOnePackageSelectTheFullyQualifiedNameToUseInTheImportStatementHtml = new JTableOperator(this); 84 } 85 return _tabHtmlTheFollowingClassNamesWereFoundInMoreThanOnePackageSelectTheFullyQualifiedNameToUseInTheImportStatementHtml; 86 } 87 88 89 93 95 public void verify() { 96 lblHtmlTheFollowingClassNamesWereFoundInMoreThanOnePackageSelectTheFullyQualifiedNameToUseInTheImportStatementHtml(); 97 tabHtmlTheFollowingClassNamesWereFoundInMoreThanOnePackageSelectTheFullyQualifiedNameToUseInTheImportStatementHtml(); 98 btOK(); 99 btCancel(); 100 } 101 102 105 public static void main(String args[]) { 106 new FixImportsOperator().verify(); 107 System.out.println("FixImports verification finished."); 108 } 109 } 110 111 | Popular Tags |