Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Wiki Markup
{div:class=navigation}
{table:width=100%}
{tr}
{td:width=33%}{align:left}[Previous|Quick Popups] {span:class=sep}\| {span}{span:class=text}Quick Popups{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|Folding] {span:class=sep}\| {span}{span:class=text}Folding{span}{align} {td}
{tr}
{table}
{div}
Wiki Markup
{redirect:https://www.jetbrains.com/idea/help/refactoring-basicssource-code.html|delay=0}

Info
iconfalse

IntelliJ IDEA offers a comprehensive set of automated code refactorings that lead to significant productivity gains when used right. This tutorial will teach you how to do that, starting from the basic topics.

...

8. Essential refactoring shortcuts

  • Rename:

    Wiki Markup
    {span:class=shortcut}Shift{span}
    +
    Wiki Markup
    {span:class=shortcut}F6{span}

  • Copy a class or file:

    Wiki Markup
    {span:class=shortcut}F5{span}

  • Move a class or file:

    Wiki Markup
    {span:class=shortcut}F6{span}

  • Extract a constant:

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

  • Extract a variable:

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

  • Extract a method:

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

  • Extract a field:

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

  • Extract a parameter:

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

  • Inline a class or method:

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

  • Change signature:

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

9. Other useful refactorings

...

This is it for the refactoring basics. See the following tutorials for more advanced topics.

Wiki Markup
{div:class=navigation}
{table:width=100%}
{tr}
{td:width=33%}{align:left}[Previous|Quick Popups] {span:class=sep}\| {span}{span:class=text}Quick Popups{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|Folding] {span:class=sep}\| {span}{span:class=text}Folding{span}{align} {td}
{tr}
{table}
{div}