4
votes

Whenever I'm just typing some code in Eclipse, and I click on the Error lightbulb on the gray ribbon area, my code just runs away from me, and I have to close the file and re-open it to see my code again. Can someone help me figure out how to STOP this? Thanks

4
Does it happen with XML files usually? - Erol
Happens on my XML files all the time. Its to do with the fact you generate it in the GUI Builder. It seems to display the wrong code in the xml.(Unless you highlight it all). Close/Reopen is the only way I know of to fix this. - IAmGroot
This was actually in a src file, someclass.java - Jon Wei

4 Answers

3
votes

I may have fixed this issue.

Going to the Eclipse settings, and to

Java > Editor

Uncheck the box "Only show the selected Java element."

This seems to fix the problem. enter image description here

1
votes

Please follow these steps (I am running eclipse on MAC) to fix XML problems. You later commented it was a java file but actually java files are okay with me.

  1. Open Eclipse
  2. Open menu eclipse->preference or file->preference (windows version I am guessing)
  3. In the left pane expand the following nodes XML->XML Files->Editor
  4. Please take a look @ the following image and make sure yours has the same settings and hit apply.
  5. The problem is gone but you cannot add blank lines in the XML files any more.

The following image shows the best configurations to fix this issue

0
votes

You could be accidentally invoking code folding.

Does your editor show you something like this?

Code folding

The red arrow (added for emphasis) points to a minus sign in a circle. When you hover over the area underneath the minus sign, a vertical bar is drawn from the minus sign to the bottom of the code block, of which the minus sign is next to the top line.

If you (perhaps accidentally) single-click on the minus sign or double-click on the vertical bar, then the whole block of code collapses and only the first line is shown. The minus sign changes to a plus sign. Clicking on the plus sign expands your code again.

0
votes

Under any condition you could just click on the java file under the name of class you created it appers like that Src Default package "Name" .java