Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSF Code formatter or Eclipse XML Editor, each tag for new line?

How to format JSF code in eclipse?

I already try as the following :

  • Format XML code in Eclipse

My XML Editor Configuration Setting is :

  • Line width 120
  • Split multiple attributes each on a new like Checked
  • Align final bracket in mulit-line element tags Checked
  • Clear all blank lines Checked

If I do Ctrl + Shif + F, eclipse format the code as below.

<tr>
    <td><h:outputText value="#{label['MANAGE_USER_TITLE']}"
            styleClass="table-title" /></td>

</tr>

My expectation format is, after Ctrl + Shif + F

<tr>        
    <td>
        <h:outputText value="#{label['MANAGE_USER_TITLE']}" styleClass="table-title" /> 
                ▲
                This line may be wrap base on line size.
    </td>
</tr>

How can I do for that? Is there any plugin? I already try HTML Tidy, I can only format HTML, not JSF code.

Update

Picture -1

enter image description here

Eclipse Setting for Picture-1

enter image description here

Picture - 2 (I want)

enter image description here

like image 467
Zaw Than oo Avatar asked Mar 03 '14 05:03

Zaw Than oo


People also ask

How do I change the XML format in Eclipse?

In Eclipse, you try to open Preferences, select XML, select XML Files and then select Editor to change the configuration of the indentation size when using space (Indent using spaces -> Indentation size). Sometimes, you will not be able to change the number in this box or press the + or – button.


1 Answers

Looking at the Settings panel that Maheshbabu Jammula posted, you can see an Inline Elements list. Just remove <tr> and <td> tags from the list and those tags will always land in a new line. Take Care!

Preferences > Web > HTML Files > Editor

enter image description here

like image 101
Kuba Avatar answered Oct 15 '22 06:10

Kuba