/** Returns a list of all the top-level areas. */ public List<Area> findTopAreas() { List<Area> tops = new ArrayList<Area>(); Area first = null; Area last = null; for (Area area : findPlugins(Area.class)) { if (area.getParent() == null) { if (area.getTool() instanceof CmsTool) { String internalName = area.getInternalName(); if ("dashboard".equals(internalName)) { first = area; } else if ("admin".equals(internalName)) { last = area; } else { tops.add(area); } } else { tops.add(area); } } } if (first != null) { tops.add(0, first); } if (last != null) { tops.add(last); } return tops; }