package eg.projects;

import java.io.File;
import java.io.IOException;

//--Eadgyth--//
import eg.utils.FileUtils;

/**
 * Represents a project to write a webpage in HTML
 */
public final class HtmlActions extends ProjectConfig implements ProjectActions {
   
   public HtmlActions(String suffix) {
      super(suffix, false);
   }
   
  @Override
   public void createSettingsWin() {
      setWin = SettingsWin.projectRootWindow();
   }
   
   /**
    * {@inheritDoc}.
    * Creates the path for the html file to show it in a fil browser
    */
   @Override
   public boolean configureProject(String dir) {
      boolean success = super.configureProject(dir);
      return success;
   }

   /**
    * {@inheritDoc}.
    * Creates the path for the html file to show it in a fil browser
    */
   @Override
   public boolean retrieveProject(String dir) {
      boolean success = super.retrieveProject(dir);
      return success;
   }
   
   /**
    * {@inheritDoc}.
    * Shows the html file in the default file browser
    */
   @Override
   public void runProject(String filepath) {
      if (!filepath.endsWith(getSourceSuffix())) {
         eg.utils.Dialogs.warnMessage("No " + getSourceSuffix() + " file is selected");
         return;
      }
      File htmlFile = new File(filepath);
      try {
         if (java.awt.Desktop.isDesktopSupported()) {
            java.awt.Desktop.getDesktop().open(htmlFile);
         }
      }
      catch (IOException e) {
         FileUtils.logStack(e);
      }
   }
}

@@ -249,19 +249,16 @@
 tions %7B%0A
-   
 %0A   publ
@@ -322,19 +322,16 @@
 );%0A   %7D%0A
-   
 %0A  @Over
@@ -421,27 +421,24 @@
 dow();%0A   %7D%0A
-   
 %0A   /**%0A    
@@ -917,19 +917,16 @@
 s;%0A   %7D%0A
-   
 %0A   /**%0A
@@ -1061,24 +1061,66 @@
 filepath) %7B%0A
+      File htmlFile = new File(filepath);%0A
       if (!f
@@ -1200,58 +1200,81 @@
 age(
-%22No %22 + getSourceSuffix() + %22 file is selected
+%0A               htmlFile.getName() + %22 cannot be opened in a browser
 %22);%0A
+%0A
     
@@ -1298,50 +1298,8 @@
   %7D%0A
-      File htmlFile = new File(filepath);%0A
     
@@ -1462,16 +1462,76 @@
 ception 
+%7C IllegalArgumentException %7C UnsupportedOperationException  
 e) %7B%0A   

add exceptions to catch in runProject()