String imagename = file.getName();
try {
while (true) {
imagename = cutImage(imagename);
if (imagename != null) {
Family family = Family.instance;
Person currentPerson = family.getCurrentPerson();
String cpName = currentPerson.getValueView(Person.NAME);
String quest = "Soll das Portrait\r\n" + cpName + "\r\nzugeordnet werden?";
if (SwtUtilities.askYesNo(GUI.instance.shell, quest, "Portraitzuordnung")) {
currentPerson.addImage(imagename);
family.review();
}
else {
PersonChoiceShell pcs = new PersonChoiceShell(GUI.instance.shell, "Bild-Person festlegen",
"Bild zuordnen", null, 1, false, new File("images/" + imagename), true);
// int p = imagename.lastIndexOf('.');
// pcs.setStartString(imagename.substring(0, p).replace('_',
// ' '));
pcs.open();
Person person = pcs.personChoice;
if (person != null) {
person.addImage(imagename);
family.setCurrentPerson(person, 1);
}
else {
new File("images/" + imagename).delete();
break;
}