package eg.projects;

//--Eadgyth--/
import eg.TaskRunner;
import eg.utils.Dialogs;
import eg.Projects.ProjectActionsUpdate;

/**
 * Represents a project to run a custom system command
 */
public final class GenericProject extends AbstractProject implements ProjectCommands {
   
   private final TaskRunner runner;
   
   boolean isCmd;

   public GenericProject(TaskRunner runner) {
      super(ProjectTypes.GENERIC, false, null);
      this.runner = runner;
   }

   @Override
   public void buildSettingsWindow() {
      inputOptions.addCustomCommandInput()
            .buildWindow();
   }

   @Override
   public void enable(ProjectActionsUpdate update) {
      update.enableRun(false);
   }

   /**
    * Not implemented
    */
   @Override
   protected void setCommandParameters() {
      isCmd = !customRunCmd().isEmpty();
   }
   
   @Override
   public void run() {
     if (isCmdDefined()) {
         runner.runSystemCommand(customRunCmd());
      }
   }
   
   //
   //--private--/
   //
   
   private boolean isCmdDefined() {
      boolean isCmd = !customRunCmd().isEmpty();
      if (!isCmd) {
         Dialogs.errorMessage(
            "A system command is not specified.", null);
      }
      return isCmd;
   }
}

@@ -269,19 +269,16 @@
 mands %7B%0A
-   
 %0A   priv
@@ -306,19 +306,16 @@
 runner;%0A
-   
 %0A   bool
@@ -690,44 +690,8 @@
  %7D%0A%0A
-   /**%0A    * Not implemented%0A    */%0A
    @
@@ -695,24 +695,24 @@
   @Override%0A
+
    protected
@@ -788,20 +788,17 @@
 );%0A   %7D%0A
-   
 %0A
+
    @Over
@@ -915,20 +915,17 @@
  %7D%0A   %7D%0A
-   
 %0A
+
    //%0A  
@@ -946,19 +946,16 @@
 /%0A   //%0A
-   
 %0A   priv

make a textual correction