1 19 20 package org.netbeans.test.subversion.operators; 21 22 import java.awt.Component ; 23 import java.awt.Container ; 24 import javax.swing.JComponent ; 25 import org.netbeans.jellytools.OutputTabOperator; 26 import org.netbeans.jellytools.TopComponentOperator; 27 import org.netbeans.jellytools.actions.Action; 28 import org.netbeans.jemmy.ComponentChooser; 29 import org.netbeans.jemmy.ComponentSearcher; 30 import org.netbeans.jemmy.operators.JButtonOperator; 31 import org.netbeans.jemmy.operators.JTabbedPaneOperator; 32 import org.netbeans.test.subversion.operators.actions.RefactoringAction; 33 34 public class RefactoringOperator extends TopComponentOperator { 35 36 private static final Action invokeAction = new RefactoringAction(); 37 private JButtonOperator _btDoRefactoring; 38 private JButtonOperator _btCancel; 39 40 public JButtonOperator btDoRefactoring() { 41 if (_btDoRefactoring == null) { 42 _btDoRefactoring = new JButtonOperator(this, "Refactor"); 43 } 44 return _btDoRefactoring; 45 } 46 47 public JButtonOperator btCancel() { 48 if (_btCancel == null) { 49 _btCancel = new JButtonOperator(this, "Cancel"); 50 } 51 return _btCancel; 52 } 53 54 public void doRefactoring() { 55 btDoRefactoring().pushNoBlock(); 56 } 57 58 public void cancel() { 59 btCancel().pushNoBlock(); 60 } 61 62 63 public RefactoringOperator() { 64 super(waitTopComponent(null, null, 0, renameChooser)); 65 } 66 67 72 public static RefactoringOperator invoke() { 73 invokeAction.perform(); 74 return new RefactoringOperator(); 75 } 76 77 91 92 101 102 109 110 111 112 116 117 121 122 126 127 131 132 136 137 141 142 146 147 151 152 156 157 161 162 165 private static final ComponentChooser renameChooser = new ComponentChooser() { 166 public boolean checkComponent(Component comp) { 167 return comp.getClass().getName().endsWith("RefactoringPanelContainer"); } 169 170 public String getDescription() { 171 return "component instanceof org.netbeans.refactoring.ui.RefactoringPanelContainer"; } 173 }; 174 } 175 | Popular Tags |