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

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 20:33:34

问题


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

Eclipse Setting for Picture-1

Picture - 2 (I want)


回答1:


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




回答2:


Ctrl + Shif + F, only formats code.For indent use ctrl+a and ctrl+i



来源:https://stackoverflow.com/questions/22139262/jsf-code-formatter-or-eclipse-xml-editor-each-tag-for-new-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!