views:

75

answers:

1

I've written up a GUI test using SWTBot to test the Extract Method refactoring. I use editor.selectRange() to select a statement to extract into a method. But, when I run the unit test, the Extract Method refactoring menu item is disabled. Thus, SWTBot fails to invoke the refactoring.

The whole project containing the above unit test is available at github.

A: 

Maybe you must flush any pending events to enable the menu. Add this loop before you try to click on the menu:

while(Display.getDefault().readAndDispatch());
Aaron Digulla