title: Problems with duplicate filenames when creating via widget
body: <p>I've got a widget that allows the user to drag and drop an email message or a file into the widget to copy it to their file system. It's the FileExplorer project in OpenNTF, designed by people far more experienced than I am. I want to modify it to provide a new filename if the current filename already exists in the location they're dropping it on. With emails I'd hoped to be able to grab the sender and date, but I've been throwing errors when I try to access the file contents during a drag-and-drop of email.</p>
  
  <p>So, my issue is actually simple. I've got the 'if' to determine if the filename is taken, but I'm overwhelmed trying to figure out how to test multiple options for the filename (like numbering then 'file1.eml', 'file2.eml', 'file3.eml'). I tried, below, inserting the word DUPLICATE, but I'm having no joy.</p>
  
  <pre><code>try {
      if (source.isDirectory()) {
          File dirTarget = new File(fDest.getAbsoluteFile() + File.separator + source.getName());
          if (!dirTarget.exists()) {
              dirTarget.mkdir();
          }
          copyDir(monitor, source, dirTarget);
      }
      if (source.isFile()) {
          File dest = new File(fDest.getAbsolutePath() + File.separator + source.getName());
  
          if (dest.getAbsolutePath().compareTo(source.getAbsolutePath()) != 0) {
              copyFile(monitor, source, dest);
          } else {
              dest = new File(fDest.getAbsolutePath() + File.separator + "DUPLICATE" + File.separator + source.getName());
              copyFile(monitor, source, dest);
          }
      }
  } catch (IOException e) {
  }
  </code></pre>
  
  <p>For reference, the copyFile method's parameters are </p>
  
  <pre><code>private void copyFile(IProgressMonitor monitor, File fSource, File fTarget) throws IOException
  </code></pre>