Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
div
classnavigation
HTML Table
width100%
Table Row (tr)
Table Cell (td)
width33%
Align
alignleft
Previous
span
classsep
|
span
classtext
Refactoring Basics
Table Cell (td)
width33%
Align
aligncenter
Top
span
classsep
|
span
classtext
Quick Start
Table Cell (td)
width33%
Align
alignright
Next
span
classsep
|
span
classtext
Find Usages

...

Wiki Markup
{div:class=navigation}
{table:width=100%}
{tr}
{td:width=33%}{align:left}[Previous|Refactoring Basics] {span:class=sep}\| {span}{span:class=text}Refactoring Basics{span}{align}{td}
{td:width=33%}{align:center}[Top|Quick Start] {span:class=sep}\| {span}{span:class=text}Quick Start{span}{align} {td}
{td:width=33%}{align:right}[Next|Find Usages] {span:class=sep}\| {span}{span:class=text}Find Usages{span}{align} {td}
{tr}
{table}
{div}

Wiki Markup
{redirect:https://www.jetbrains.com/idea/help/folding-and-expanding-code-blocks.html

...

|delay

...

=0}

Info
iconfalse

Folding helps you keep your code neat and readable, by automatically collapsing the boilerplate or by replacing it with more relevant statements.

You can see the original code behind the folded regions by placing the caret on it, or by moving the mouse over the collapsed pieces of code. Additionally you can always expand or collapse the folded blocks at the caret by calling the Toggle folding action via the shortcut

span
classshortcut
Ctrl
+
span
classshortcut
.
(
span
classshortcut
Cmd
+ .
span
classshortcut
Wiki Markup
{span:class=shortcut}Ctrl{span}
+
Wiki Markup
{span:class=shortcut}.{span}
(
Wiki Markup
{span:class=shortcut}Cmd{span}
+
Wiki Markup
{span:class=shortcut}.{span}
for Mac).

1. Generics

A very basic example of code folding is when the editor replaces parameter types in generics with the diamond operator added in Java 7. The code itself remains the same but it looks shorter and clearer.

...

You can always change the default behavior of code folding for particular statements via

span
classshortcut
Settings
span
classshortcut
Editor
Code Folding
span
classshortcut
Wiki Markup
{span:class=shortcut}Settings{span}
Wiki Markup
{span:class=shortcut}Editor{span}
Wiki Markup
{span:class=shortcut}Code Folding{span}
.

4. Other useful actions

  • Expand All via

    ...

    classshortcut

    ...

    span
    classshortcut
    Ctrl

    ...

    span
    classshortcut
    +

    ...

    span
    classshortcut
    Shift

    ...

    span
    classshortcut
    Cmd

    ...

    classshortcut

    ...

    • Wiki Markup
      {span:class=shortcut}Shift{span}
      +
      Wiki Markup
      {span:class=shortcut}Ctrl{span}
      +
      Wiki Markup
      {span:class=shortcut}+{span}
      (
      Wiki Markup
      {span:class=shortcut}Shift{span}
      +
      Wiki Markup
      {span:class=shortcut}Cmd{span}
      +
      Wiki Markup
      {span:class=shortcut}+{span}
      for Mac) automatically expands all collapsed blocks in the opened file.
    div
    classnavigation
    HTML Table
    width100%
    Table Row (tr)
    Table Cell (td)
    width33%
    Align
    alignleft
    Previous
    span
    classsep
    |
    span
    classtext
    Refactoring Basics
    Table Cell (td)
    width33%
    Align
    aligncenter
    Top
    span
    classsep
    |
    span
    classtext
    Quick Start
    Table Cell (td)
    width33%
    Align
    alignright
    Next
    span
    classsep
    |
    span
    classtext
    Find Usages Wiki Markup
    {div:class=navigation}
    {table:width=100%}
    {tr}
    {td:width=33%}{align:left}[Previous|Refactoring Basics] {span:class=sep}\| {span}{span:class=text}Refactoring Basics{span}{align}{td}
    {td:width=33%}{align:center}[Top|Quick Start] {span:class=sep}\| {span}{span:class=text}Quick Start{span}{align} {td}
    {td:width=33%}{align:right}[Next|Find Usages] {span:class=sep}\| {span}{span:class=text}Find Usages{span}{align} {td}
    {tr}
    {table}
    {div}