/** Copies primary and secondary files to new folder. * May ask for user confirmation before overwriting. * @param df the new folder * @return data object for the new primary * @throws IOException if there was a problem copying * @throws UserCancelException if the user cancelled the copy */ protected DataObject handleCopy (DataFolder df) throws IOException { FileObject fo; String suffix = existInFolder( getPrimaryEntry().getFile(), df.getPrimaryFile () ); if (suffix == null) throw new org.openide.util.UserCancelException(); Iterator it = secondaryEntries().iterator(); while (it.hasNext ()) { ((Entry)it.next()).copy (df.getPrimaryFile (), suffix); } //#33244 - copy primary file after the secondary ones fo = getPrimaryEntry ().copy (df.getPrimaryFile (), suffix); try { return createMultiObject (fo); } catch (DataObjectExistsException ex) { return ex.getDataObject (); } }