public BaseDeployProgressObject undeploy(
     BaseTargetModuleID module, FileObject projDir, boolean completeImmediately) {
   command = "undeploy";
   this.setTargetModuleID(module);
   setCompleteImmediately(completeImmediately);
   setMode(getManager().getCurrentDeploymentMode());
   // BaseUtil.out("command = 'undeploy'");
   fireRunning(CommandType.UNDEPLOY, getManager().getDefaultTarget().getName());
   RP.post(this, 0, Thread.NORM_PRIORITY);
   return this;
 }
  public BaseDeployProgressObject deploy(BaseTargetModuleID module, boolean completeImmediately) {
    command = "deploy";
    this.setTargetModuleID(module);
    setCompleteImmediately(completeImmediately);
    setMode(getManager().getCurrentDeploymentMode());
    fireRunning(CommandType.DISTRIBUTE, getManager().getDefaultTarget().getName());
    // BaseUtil.out("BaseDeployProgressObject deploy module cp=" + module.getContextPath() );

    RP.post(this, 10, Thread.NORM_PRIORITY);
    return this;
  }
  public BaseDeployProgressObject redeploy(
      BaseTargetModuleID oldModule, BaseTargetModuleID newModule, boolean completeImmediately) {
    command = "redeploy";

    this.setOldTargetModuleID(oldModule);
    this.setTargetModuleID(newModule);
    setCompleteImmediately(completeImmediately);
    setMode(getManager().getCurrentDeploymentMode());
    fireRunning(CommandType.REDEPLOY, getManager().getDefaultTarget().getName());
    RP.post(this, 0, Thread.NORM_PRIORITY);
    return this;
  }
  public BaseDeployProgressObject redeploy(
      BaseTargetModuleID oldModule, boolean completeImmediately) {
    command = "redeploy";
    BaseTarget target = getManager().getDefaultTarget();
    FileObject projDir = FileUtil.toFileObject(new File(oldModule.getProjectDir()));

    String contextPath = WebModule.getWebModule(projDir).getContextPath();
    BaseTargetModuleID newModule =
        BaseTargetModuleID.getInstance(getManager(), target, contextPath, projDir.getPath());

    this.setOldTargetModuleID(oldModule);
    this.setTargetModuleID(newModule);
    setCompleteImmediately(completeImmediately);
    setMode(getManager().getCurrentDeploymentMode());
    fireRunning(CommandType.REDEPLOY, getManager().getDefaultTarget().getName());
    RP.post(this, 0, Thread.NORM_PRIORITY);
    return this;
  }
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      state.markModified();
      RP.schedule(
          new Runnable() {

            @Override
            public void run() {
              try {
                ProjectManager.getDefault().saveProject(DefaultPraxisProject.this);
              } catch (IOException ex) {
                Exceptions.printStackTrace(ex);
              }
            }
          },
          500,
          TimeUnit.MILLISECONDS);
    }