private void checkAllSelectedGefaehrdungen() { List<Gefaehrdung> toCheck = new ArrayList<Gefaehrdung>(); for (GefaehrdungsUmsetzung associatedGefaehrdung : wizard.getAssociatedGefaehrdungen()) { for (Gefaehrdung gefaehrdung : wizard.getAllGefaehrdungen()) { if (gefaehrdung.getId().equals(associatedGefaehrdung.getId())) { toCheck.add(gefaehrdung); } } } Gefaehrdung[] checkarray = toCheck.toArray(new Gefaehrdung[toCheck.size()]); viewer.setCheckedElements(checkarray); }
/** Marks all checkboxes of Gefaehrdungen associated to the selected Baustein. */ private void assignBausteinGefaehrdungen() { try { LoadAssociatedGefaehrdungen command = new LoadAssociatedGefaehrdungen(wizard.getCnaElement()); command = ServiceFactory.lookupCommandService().executeCommand(command); List<GefaehrdungsUmsetzung> list = command.getAssociatedGefaehrdungen(); for (GefaehrdungsUmsetzung selectedGefaehrdung : list) { for (Gefaehrdung gefaehrdung : wizard.getAllGefaehrdungen()) { if (gefaehrdung.getId().equals(selectedGefaehrdung.getId())) { associateGefaehrdung(gefaehrdung, true); } } } } catch (CommandException e) { ExceptionUtil.log(e, ""); // $NON-NLS-1$ } }