Eclipse doesn't seem to provide a function for this, and I haven't found a plugin that does this. But assuming that you have access to awk, you might find this little awk script helpful:
{
if (match($0,/([a-z|A-Z|0-9|_]+)\s+(([a-z|A-Z|0-9|_]+)\s*,\s*)+([a-z|A-Z|0-9|_]+);/)) {
match($0,/(\s*[a-z|A-Z|0-9|_]+)\s+([^;]*)/,components);
split(components[2],vars,",");
for(i in vars) {
gsub (/'[[:cntrl:]]|[[:space:]]|\x20/,"",vars[i])
print components[1],vars[i]";"
}
}
else {
print $0;
}
}
It will do the required job. Assuming you save it to the file script.awk you would call it like this
awk -f script.awk target_file.java
NOTE: you must direct the output to an alternate file or your source will be overwritten (emptied)
So if you want to process a number of files at one go you should do it like this (assuming a bash shell):
for f in *.java; do awk -f awk1.awk $f > $f.pr; done
For each java file this will create a new file with the ending .java.pr, and then you just move those over into files with a .java ending.
================== EDIT =================
Just want to add that there exist plug-ins for Eclipse that support bash/awk scripts over a selected region. See here:
http://eclipseexeditor.sourceforge.net/
(probably to old for newer versions of Eclipse)
and here also:
Bash script plugin for Eclipse?.
So, my script coupled with one of those plug-ins would presumably add the requested feature to Eclipse.