Reputation: 121
I am facing a very stupid problem lately. I was working on a project and there is a particular file I was editing. In the beginning my eclipse formatter was working. But now its not working. If I open some other file from the same project, it works there, but for this particular file it does not work. Is there any key strokes that I have pressed which has made eclipse turned off? How can I get the formatter back for my file? Please help. This problem is driving me crazy..
I am working on Java file. All other things are working on it like warnings, errors. Its just that I was editing my code in the file, initially my formatter was working. And then I made more changes and pressed Ctrl+Shift+F, it dint work. its not working since then for me on that file. its working fine on other files of same project. also if I copy my code and paste in other file of same project and do Ctrl+Shift+F it does not work there as well, so I am guessing that may be I accidentally pressed some short-cut to turn off eclipse on that code. How can I restore that?
Upvotes: 3
Views: 2218
Reputation: 9375
It can't be a shortcut, since you've replicated the same issue with the same content in another file. Look for a misplaced curly brace { or /**
Also, the static analyzer findbugs may be able to pinpoint this issue. You can use the Java applet first to see if it will catch it, but then I recommend you install its Eclipse plugin so that findbugs is always available to you.
It's located here: http://findbugs.sourceforge.net/demo.html
Just click on the link located in the first paragraph: run findbugs That will download a findbugs.jnlp file, then you just need to double-click on that file to run the applet (since you obviously already have Java on your computer).
Upvotes: 0
Reputation: 15525
As you told some of the following things are not the case:
CTRL-SHIFT-L
to get the preferences for keyboard shortcuts, and search there for formatting.So the reason should be the code itself. What the formatter has to do is the following:
If the formatter has no chance to get an AST, it will just abort. Make a short experiment to see if that is the reason:
I cannot think of any other reason, so I wanted to try that answer. Hope it helps :-)
Upvotes: 3