diff --git a/bundles/ch.elexis.molemax/src/ch/elexis/molemax/views2/ImageViewAll.java b/bundles/ch.elexis.molemax/src/ch/elexis/molemax/views2/ImageViewAll.java index 0036e483af..c21df03ae3 100644 --- a/bundles/ch.elexis.molemax/src/ch/elexis/molemax/views2/ImageViewAll.java +++ b/bundles/ch.elexis.molemax/src/ch/elexis/molemax/views2/ImageViewAll.java @@ -337,20 +337,18 @@ public void drop(DropTargetEvent event) { } } GalleryItem parentGroup = gallery.getItem(new Point(event.x, event.y)); + GalleryItem newItem; if (parentGroup != null && parentGroup.getParentItem() == null) { - GalleryItem newItem = new GalleryItem(parentGroup, SWT.NONE); - newItem.setImage(image); - newItem.setData(targetPath); - createdImages.add(image); - lastAddedItem = newItem; + newItem = new GalleryItem(parentGroup, SWT.NONE); } else { - GalleryItem newItem = new GalleryItem(gallery, SWT.NONE); - newItem.setImage(image); - newItem.setData(targetPath); - createdImages.add(image); - lastAddedItem = newItem; + newItem = new GalleryItem(gallery, SWT.NONE); } - } finally { + newItem.setImage(image); + newItem.setData(targetPath); + createdImages.add(image); + lastAddedItem = newItem; + } catch (Exception e) { + LoggerFactory.getLogger(getClass()).warn("Error processing image file", e); if (image != null && !image.isDisposed()) { image.dispose(); } @@ -358,22 +356,17 @@ public void drop(DropTargetEvent event) { } updateGalleryForPatient(aktuellerPatient); for (GalleryItem group : gallery.getItems()) { - if (group.getText().equals(groupName)) { - group.setExpanded(true); - } else { - group.setExpanded(false); - } + group.setExpanded(group.getText().equals(groupName)); } if (lastAddedItem != null && Arrays.asList(gallery.getItems()).contains(lastAddedItem)) { gallery.setSelection(new GalleryItem[] { lastAddedItem }); } - } else { } } else { String sourcePath = (String) event.data; GalleryItem targetGroup = gallery.getItem(new Point(event.x, event.y)); if (targetGroup != null) { - } + } } } });