⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wrapping.html

📁 This the README for the Eclipse Plug-in distribution of the Jalopy Java Source Code Formatter.
💻 HTML
📖 第 1 页 / 共 3 页
字号:
if ((condition1 &amp;&amp; condition2)    || (condition3 &amp;&amp; condition4)    || !(condition5 &amp;&amp; condition6)){    doSomethingAboutIt();}</pre></td></tr></table></div><p></p></li><li><p><a name="wrap-after"></a>Wrap after operators</p><a class="indexterm" name="d0e2942"></a><p>If enabled, lines will be wrapped after the operator.</p><div class="example"><a name="ex-wrap-after"></a><p class="title"><b>Example&nbsp;4.78.&nbsp;Wrap after operators</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">if ((condition1 &amp;&amp; condition2) ||    (condition3 &amp;&amp; condition4) ||    !(condition5 &amp;&amp; condition6)){    doSomethingAboutIt();}</pre></td></tr></table></div><p>If you happen to use Sun Brace styling, you might want to enable<a href="indentation.html#indentation-misc-continuation-if">continuation indentation</a>to let the statement body stand out.</p><p></p></li></ul></div></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="wrap-always"></a>4.3.4.2.&nbsp;Always</h4></div></div><div></div></div><p>Lets you choose the statements/expressions that are to be wrapped always.</p><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="wrap-always-pane"></a>4.3.4.2.1.&nbsp;Wrap always</h5></div></div><div></div></div><p>For certain cases, the need may arise to force line wrapping to achieve aconsistent, uniform look. If you enable any of the following switches, line wrappingwill occur for the specified cases no matter whether you have enabled generalline wrapping or not.</p><div class="itemizedlist"><ul type="disc"><li><p><a name="wrap-before-extends"></a>Before extends keyword</p><p>Forces a line break before the extends keyword of a class/interface declaration.</p><div class="example"><a name="ex-wrap-before-extends"></a><p class="title"><b>Example&nbsp;4.79.&nbsp;Class/Interface extends keyword</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">public interface Channel extends Puttable, Takable{    ...}</pre></td></tr></table></div><p></p><div class="example"><a name="ex-wrap-before-extends-wrapped"></a><p class="title"><b>Example&nbsp;4.80.&nbsp;Class/Interface extends keyword (wrapped)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">public interface Channel    extends Puttable, Takable{    ...}</pre></td></tr></table></div><p>You can control the space printed before the keyword with the<a href="indentation.html#indentation-sizes-extends">Extends Indent</a> setting.If you leave the switch disabled, the clause will be printed with<a href="indentation.html#indentation-sizes-general">standard indentation</a>.</p></li><li><p>After extends types</p><p>Forces a line wrap after each type name of the extended classes.</p><div class="example"><a name="ex-wrap-after-extends"></a><p class="title"><b>Example&nbsp;4.81.&nbsp;Class/Interface extends types</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">public interface Channel extends Puttable, Takable{    ...}</pre></td></tr></table></div><p></p><div class="example"><a name="ex-wrap-after-extends-wrapped"></a><p class="title"><b>Example&nbsp;4.82.&nbsp;Class/Interface extends types (wrapped)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">public interface Channel extends Puttable,                                 Takable{    ...}</pre></td></tr></table></div><p></p></li><li><p><a name="wrap-before-implements"></a>Before implements keyword</p><p>Forces a line break before the implements keyword of a class declaration.</p><div class="example"><a name="ex-wrap-before-implements"></a><p class="title"><b>Example&nbsp;4.83.&nbsp;implements keyword</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">public class SynchronizedBoolean implements Comparable, Cloneable{    ...}</pre></td></tr></table></div><p></p><div class="example"><a name="ex-wrap-before-implements-wrapped"></a><p class="title"><b>Example&nbsp;4.84.&nbsp;implements keyword (wrapped)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">public class SynchronizedBoolean    implements Comparable, Cloneable{    ...}</pre></td></tr></table></div><p>You can control the space printed before the keyword with the<a href="indentation.html#indentation-sizes-implements">Implements Indent</a> setting.If you leave the switch disabled, the clause will be printed with<a href="indentation.html#indentation-sizes-general">standard indentation</a>.</p></li><li><p><a name="wrap-after-implements"></a>After implements types</p><p>Forces a line wrap after each type name of the implemented classes.</p><div class="example"><a name="ex-wrap-implements-types"></a><p class="title"><b>Example&nbsp;4.85.&nbsp;Class implements types</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">public class SynchronizedBoolean implements Comparable, Cloneable{    ...}</pre></td></tr></table></div><p></p><div class="example"><a name="ex-wrap-implements-types-wrapped"></a><p class="title"><b>Example&nbsp;4.86.&nbsp;Class implements types (wrapped)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">public class SynchronizedBoolean implements Comparable,                                            Cloneable{    ...}</pre></td></tr></table></div><p></p></li><li><p><a name="wrap-before-throws"></a>Before throws keyword</p><p>Forces a line break before the throws keyword of a method/constructor declaration.</p><div class="example"><a name="ex-wrap-before-throws"></a><p class="title"><b>Example&nbsp;4.87.&nbsp;throws keyword</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">private File getDestinationFile(File dest, String packageName,                                String filename) throws IOException{    ...}</pre></td></tr></table></div><p></p><div class="example"><a name="ex-wrap-before-throws-wrapped"></a><p class="title"><b>Example&nbsp;4.88.&nbsp;throws keyword (wrapped)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">private File getDestinationFile(File dest, String packageName,                                String filename)                         throws IOException{    ...}</pre></td></tr></table></div><p>You can control the space printed before the keyword with the<a href="indentation.html#indentation-sizes-throws">Throws Indent</a> setting. If youleave the switch disabled, Jalopy tries to align the throws clause with themethod/constructor parameters as with the above example. If no alignment ispossible, the clause will be printed with<a href="indentation.html#indentation-sizes-general">standard indentation</a>.</p></li><li><p><a name="wrap-after-throws"></a>After throws types</p><p>Forces a line wrap after each type name of the throws clause of a method/constructor declaration.</p><div class="example"><a name="ex-wrap-after-throws-types"></a><p class="title"><b>Example&nbsp;4.89.&nbsp;throws types</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">private File getDestinationFile(File dest, String packageName,                                String filename)                         throws IOException, FooException{    ...}</pre></td></tr></table></div><p></p><div class="example"><a name="ex-wrap-after-throws-types-wrapped"></a><p class="title"><b>Example&nbsp;4.90.&nbsp;throws types (wrapped)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">private File getDestinationFile(File dest, String packageName,                                String filename)                         throws IOException,                                FooException{    ...}</pre></td></tr></table></div><p></p><div class="example"><a name="ex-wrap-after-throws-types-wrapped-standard"></a><p class="title"><b>Example&nbsp;4.91.&nbsp;throws types (standard indented)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">private static final File getDestinationFile(File dest, String packageName,                                             String filename)    throws IOException,          FooException{    ...}</pre></td></tr></table></div><p></p></li><li><p><a name="wrap-method-params"></a>Method Def parameters</p><a class="indexterm" name="d0e3103"></a><a class="indexterm" name="d0e3106"></a><p>Forces a line wrap after each parameter of a method or constructor declaration.</p><div class="example"><a name="ex-wrap-method-params"></a><p class="title"><b>Example&nbsp;4.92.&nbsp;Method declaration parameters</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">public static File create(File file, File directory, int backupLevel)                   throws IOException{    ...}</pre></td></tr></table></div><p></p><div class="example"><a name="ex-wrap-method-params-wrapped"></a><p class="title"><b>Example&nbsp;4.93.&nbsp;Method declaration parameters (wrapped)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">public static File create(File file,                          File directory,                          int backupLevel)                   throws IOException{    ...}</pre></td></tr></table></div></li><li><p><a name="wrap-call-chained"></a>Method Call chains</p><p>Forces a line wrap after each chained method call.</p><div class="example"><a name="ex-wrap-call-chained"></a><p class="title"><b>Example&nbsp;4.94.&nbsp;Chained Method Call</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">message.format(ERROR_SOURCE_ADDRESS).param (m_session.getAimName()).send();</pre></td></tr></table></div><p></p><div class="example"><a name="ex-wrap-call-chained-wrapped"></a><p class="title"><b>Example&nbsp;4.95.&nbsp;Chained Method Call (wrapped)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">message.format(ERROR_SOURCE_ADDRESS)       .param (m_session.getAimName())       .send();</pre></td></tr></table></div><p></p></li><li><p><a name="wrap-method-call-params"></a>Method Call parameters</p><p>Forces a line wrap after each parameter of a method call.</p><div class="example"><a name="ex-wrap-method-call"></a><p class="title"><b>Example&nbsp;4.96.&nbsp;Method call</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">doSomething();_userDatabase.addUser("Name", encryptPassword("password", _secretKey),                      "123 fake address");doSomethingElse();</pre></td></tr></table></div><p></p><div class="example"><a name="ex-wrap-method-call-wrapped"></a><p class="title"><b>Example&nbsp;4.97.&nbsp;Method call (wrapped)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">doSomething();_userDatabase.addUser("Name",                      encryptPassword("password",                                      _secretKey),                      "123 fake address");doSomethingElse();</pre></td></tr></table></div><p></p></li><li><p>Method Call parameters if nested</p><p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -