/** * Appends the given entry after the entry with the given id, but before the next separator. * * @param id the id of the entry to append after * @param entry the entry to add */ public void appendToSection(String id, PaletteEntry entry) { // find the entry with the given id boolean found = false; for (int i = 0; i < getChildren().size(); i++) { PaletteEntry currEntry = (PaletteEntry) getChildren().get(i); if (currEntry.getId().equals(id)) found = true; else if (found && currEntry instanceof PaletteSeparator) { add(i, entry); return; } } if (found) add(entry); else throw new IllegalArgumentException("Section not found: " + id); // $NON-NLS-1$ }