If I have a constant BAR in Foo, which I will use in a class C I\'ll have to write
Object o = Foo.BAR + \"...\";
which I can use Ctrl-Shift-M i
Regular expression was invented to solve problems like these! =)
you will need to write a small script (or use the IDE regex search/replace). The only problem is that if there are lots of classes that needs to be statically imported, then its just as much work. Otherwise, if its just one class like FOO.BLAH, then you can use a regex like
(\bFOO\.(\w+)\b) -> replace with group 2 ($2 or \2 or however your regex searcher does capture replaces).
you can try it here : http://www.gskinner.com/RegExr/ . Select the replace tab and type in $2
A problem might arise if you have expressions like this though:
FOO f = FOO.blah + "FOO.blah" , so watch out for that.
As for the import statement at the top of the file, eclipse has an auto import feature where it does autoimport on format, and it works as long as the name of the import is unique enough. Or, if you cant use it because the name is too common, you can just use a perl script to do the regex instead, and prepend the static imports.