Eclipse, How to activate Folding in XML file?

eclipse, folding, xml

Solution

Eclipse Mars (4.5.1)

XML file having the .xml extension

Just edit / open the file and the folding option will be available:

But if you disable and then enable the folding from right click on the left side bar:

there is a bug: folding won't be available.

Workaround: change the tab to another file and then come again to the previous tab. The icons will be back.

XML file having a different extension (E.g.: .xaml)

You can try to open the file using the XML Editor from the right click:

and if it fails, just add the file extension to the XML (Illformed) from Window > Preferences > General > Content Types:

Problem

I have problem with folding when I'm writing code in XML. Actually, when I'm writing Java code there is no problem and I can expand/collapse my codes. However, in XML there is no folding icon although it is active. In side bar (line number), I right click then I select `Folding > Enable Folding` the width of bar becomes wider but I can't see folding icon. My background of screen is black is it possible this color covers folding icon? I don't think it because of this because when I click those area nothing happens.

Original source