try { fileList = ImageUtils.expandDirectories(fileList); } catch (IOException ioe) { Log.log(Log.LEVEL_ERROR, MODULE, "i/o exception listing dirs in a drop"); Log.logStack(Log.LEVEL_ERROR, MODULE); JOptionPane.showMessageDialog( null, GRI18n.getString(MODULE, "imgError"), GRI18n.getString(MODULE, "dragError"), JOptionPane.ERROR_MESSAGE); }
fileList = expandDirectories(fileList);
	public synchronized void drop(DropTargetDropEvent dropTargetDropEvent) {		Log.log(Log.LEVEL_TRACE, MODULE, "drop - dtde");		if (!isDragOK(dropTargetDropEvent)) {			Log.log(Log.LEVEL_TRACE, MODULE, "Refusing drop");			dropTargetDropEvent.rejectDrop();			return;		}		Log.log(Log.LEVEL_TRACE, MODULE, "Accepting drop");		try {			Transferable tr = dropTargetDropEvent.getTransferable();			dropTargetDropEvent.acceptDrop(					DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_REFERENCE);			//thanks John Zukowski			Point dropLocation = dropTargetDropEvent.getLocation();			int listIndex = snapIndex((int) dropLocation.getY());			//Log.log(Log.LEVEL_TRACE, MODULE, "listIndex: " + listIndex + " size: " + getModel().getSize());			boolean endOfList = (listIndex >= getModel().getSize());			if (tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {				List fileList = (List)						tr.getTransferData(DataFlavor.javaFileListFlavor);				/* recursively add contents of directories */				try {					fileList = ImageUtils.expandDirectories(fileList);				} catch (IOException ioe) {					Log.log(Log.LEVEL_ERROR, MODULE, "i/o exception listing dirs in a drop");					Log.logStack(Log.LEVEL_ERROR, MODULE);					JOptionPane.showMessageDialog(							null,							GRI18n.getString(MODULE, "imgError"),							GRI18n.getString(MODULE, "dragError"),							JOptionPane.ERROR_MESSAGE);				}				Log.log(Log.LEVEL_TRACE, MODULE, "Adding " + fileList.size() + " new files(s) to list at index " + listIndex);				GalleryRemote._().getCore().addPictures((File[]) fileList.toArray(new File[0]), listIndex, false);			} else {				List pictureList = (List)						tr.getTransferData(PictureSelection.flavors[0]);				Log.log(Log.LEVEL_TRACE, MODULE, "Adding " + pictureList.size() + " new pictures(s) to list at index " + listIndex);				GalleryRemote._().getCore().addPictures((Picture[]) pictureList.toArray(new Picture[0]), listIndex, true);			}			dropTargetDropEvent.getDropTargetContext().dropComplete(true);			if (endOfList && getModel().getSize() > 0) {				ensureIndexIsVisible(getModel().getSize() - 1);			}		} catch (IOException io) {			Log.logException(Log.LEVEL_ERROR, MODULE, io);			dropTargetDropEvent.getDropTargetContext().dropComplete(false);		} catch (UnsupportedFlavorException ufe) {			Log.logException(Log.LEVEL_ERROR, MODULE, ufe);			dropTargetDropEvent.getDropTargetContext().dropComplete(false);		}	}