To reproduce, please try following:
- create Groovy sample project NetBeans Project Generators
- open NetBeansModule.groovy file, double click on "folder" on line 5 so it is selected
- invoke refactor from context menu (or press Ctrl+R)
"The Rename refactoring cannot be applied in this context"
If you just place cursor inside the variable (w/o the double clicking) or just invoke context menu directly, it works fine. Having variable selected is necessary to reproduce this. Also if I do the same in groovy file with class, it works again.
Product Version: NetBeans IDE 7.3 (Build 201302132200)
Java: 1.6.0_39; Java HotSpot(TM) Client VM 20.14-b01
Runtime: Java(TM) SE Runtime Environment 1.6.0_39-b04
System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)