/**
 * Copyright 2014 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Eclipse Public License version 1.0, available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.jboss.forge.addon.ui;

import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.net.URI;

import org.jboss.forge.addon.ui.UIDesktop;

/**
 * Default implementation of {@link UIDesktop}
 * 
 * @author <a href="ggastald@redhat.com">George Gastaldi</a>
 */
public class DefaultUIDesktop implements UIDesktop
{
   private final Desktop desktop;

   public DefaultUIDesktop()
   {
      this.desktop = Desktop.getDesktop();
   }

   public DefaultUIDesktop(Desktop desktop)
   {
      this.desktop = desktop;
   }

   @Override
   public void open(File file) throws IOException
   {
      desktop.open(file);
   }

   @Override
   public void edit(File file) throws IOException
   {
      desktop.edit(file);
   }

   @Override
   public void print(File file) throws IOException
   {
      desktop.print(file);
   }

   @Override
   public void browse(URI uri) throws IOException
   {
      desktop.browse(uri);
   }

   @Override
   public void mail() throws IOException
   {
      desktop.mail();
   }

   @Override
   public void mail(URI mailtoURI) throws IOException
   {
      desktop.mail(mailtoURI);
   }
}

@@ -528,211 +528,8 @@
 p%0A%7B%0A
-   private final Desktop desktop;%0A%0A   public DefaultUIDesktop()%0A   %7B%0A      this.desktop = Desktop.getDesktop();%0A   %7D%0A%0A   public DefaultUIDesktop(Desktop desktop)%0A   %7B%0A      this.desktop = desktop;%0A   %7D%0A%0A
    @
@@ -529,32 +529,32 @@
 %0A%7B%0A   @Override%0A
+
    public void o
@@ -598,23 +598,28 @@
 %7B%0A      
-d
+getD
 esktop
+()
 .open(fi
@@ -703,23 +703,28 @@
 %7B%0A      
-d
+getD
 esktop
+()
 .edit(fi
@@ -809,23 +809,28 @@
 %7B%0A      
-d
+getD
 esktop
+()
 .print(f
@@ -915,23 +915,28 @@
 %7B%0A      
-d
+getD
 esktop
+()
 .browse(
@@ -1008,31 +1008,36 @@
 %0A   %7B%0A      
-d
+getD
 esktop
+()
 .mail();%0A   
@@ -1121,15 +1121,20 @@
     
-d
+getD
 esktop
+()
 .mai
@@ -1152,10 +1152,91 @@
 );%0A   %7D%0A
+%0A   protected Desktop getDesktop()%0A   %7B%0A      return Desktop.getDesktop();%0A   %7D%0A%0A
 %7D%0A

Update DefaultUIDesktop.java