views:

68

answers:

2

Is there any way in Eclipse to format a code that contains divs in the way Netbeans do it?

I mean, if you have this in Netbeans:

<div>
</div>
</div>
<div>

and you format it (Source > Format), it becomes this way:

<div>
    <div>
    </div>
</div>
A: 

Yes, you can if:

  • you have the WTP plugin (Web Tools Platform) installed
  • you have unselected the "Automatically remove End tags" option, then you have the formatting experience you want.

alt text

VonC
but im not using Java, jut PHP.
@user248959: WTP is not just for Java web server. If you need to edit xml files and format them accordingly, you need WTP.
VonC
A: 

The shortcut you'll need is: CTRL + SHIFT + F

That works for HTML, CSS, PHP, XML, JS and so on. But you need to have a PHP, HTML editor/plugin like Aptana, PDT or WTP.

Kau-Boy
Hi Kau-Boy, when i press that shortcut all the lines just go the the first column. When I go to "About Eclipse" i have this: Eclipse for PHP Developers.Build id: 20090920-1017.
Are you sure you opened the HTML file with the PDT HTML Editor? As I use Aptana I am not sure if the PDT editors supports formating but I would bet, that it does support it!
Kau-Boy