How to quickly create editor fold?

I've found it and it's simple :)

http://wiki.netbeans.org/SurroundWithCodeFolding


The previous solutions didn't work for me (maybe because I'm on a mac) so here's how I did it:

  1. Go to IntelliJ IDEA > Preferences > Editor > Live templates
  2. Click the + button on the top right, enter your template name and the following code:
// <editor-fold defaultstate="collapsed" desc="$DESCRIPTION$">
$SELECTION$$END$
// </editor-fold>
  1. In the description tab, enter "Code folding", click "Define" (next to "No applicable context yet") and select "Java" (or you can be more specific if you want), check the "Reformat according to style" checkbox and click Ok Now, if you select multiple lines of text in the editor, press
    ++T (CTRL+ALT+T in Windows) and select the "Code folding" template, enter a description and you're done.

It is now the default behavior in Netbeans 7.3.1.

Just select the lines and click Surround with ... as below snapshoot.

enter image description here


In Netbeans, you can type 'fcom' and press 'TAB'.

More shortcuts here

Tags:

Netbeans