Пример #1
0
  /**
   * Executes this command.
   *
   * @param client the client services object that provides any necessary services to this command,
   *     including the ability to actually process all the requests.
   */
  public void execute(ClientServices clientServices, EventManager eventManager)
      throws CommandException {
    this.clientServices = clientServices;
    try {
      clientServices.ensureConnection();

      super.execute(clientServices, eventManager);

      addArgumentRequest(isCheckThatUnedited(), "-c"); // NOI18N
      addArgumentRequest(isForceEvenIfEdited(), "-f"); // NOI18N

      // now add the request that indicates the working directory for the
      // command
      addRequestForWorkingDirectory(clientServices);
      addRequest(CommandRequest.NOOP);

      clientServices.processRequests(requests);
    } catch (AuthenticationException ex) {
      // TODO: handle case, where connection wasn't possible to establish
    } catch (CommandException ex) {
      throw ex;
    } catch (EOFException ex) {
      throw new CommandException(
          ex, CommandException.getLocalMessage("CommandException.EndOfFile", null)); // NOI18N
    } catch (Exception ex) {
      throw new CommandException(ex, ex.getLocalizedMessage());
    } finally {
      requests.clear();
      this.clientServices = null;
    }
  }