Archive
HowTo: Code folding in NetBeans IDE source code editor
As explained near the end of https://ui.netbeans.org/docs/ui/code_folding/cf_uispec.html, the NetBeans IDE source code editor supports custom code folding tags for any language, like below (here defining the code folding tag in a Java comment, obviously need to use specific comment syntax for the respective language).
// <editor-fold desc="isUserStudent"> —————————————-
public static boolean isUserStudent(PortletRequest request)
throws NamingException, PortletServiceUnavailableException, PumaException, SQLException
{
return isUserStudent(new DbAccess().getConnection(), request);
}public static boolean isUserStudent(Connection connection, PortletRequest request)
throws NamingException, PortletServiceUnavailableException, PumaException, SQLException
{
return !StringUtils.isNotPresent(getUserStudentId(connection, request));
}
public static boolean isUserStudent(int studentId, PortletRequest request)
throws NamingException, PortletServiceUnavailableException, PumaException, SQLException
{
return isUserStudent(studentId, new DbAccess().getConnection(), request);
}public static boolean isUserStudent(int studentId, Connection connection, PortletRequest request)
throws NamingException, PortletServiceUnavailableException, PumaException, SQLException
{
return (String.valueOf(studentId).equals(getUserStudentId(connection, request)));
}
public static String getUserStudentId(Connection connection, PortletRequest request)
throws NamingException, PortletServiceUnavailableException, PumaException, SQLException
{
return DbStudent.getStudentId(connection, Puma.getUserName(request));
}// </editor-fold>————————————————————-
This shows up in NetBeans like below when folded:
You can also optionally specify defaultstate="collapsed" at the code folding tag so that when the file is opened that region appears collapsed.