Search code examples
javaeclipseintellij-ideaorganizationcode-organization

How to organise the java files in the editor? Is there anyway like having regions in C#


I wanted to organise my class written in java. Currently i am using intellij and eclipse. Lot of fields variables and methods are there in my class. It looks lenghty. Is there any way to organise it.


Solution

  • In Netbeans you can use:

    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {
    }
    // </editor-fold>  
    

    In InteliJ:

    //region GeneratedCode                         
    private void initComponents() {
    }
    //endregion
    

    And for eclipse check here: http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/editor/ref-preferences-folding.htm