MakeArchiveAction.java :  » Source-Control » sourcejammer » org » sourcejammer » client » gui » action » Java Open Source

Java Open Source » Source Control » sourcejammer 
sourcejammer » org » sourcejammer » client » gui » action » MakeArchiveAction.java
/*
 *  Copyright (C) 2001, 2002 Robert MacGrogan
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 *
 * $Archive: SourceJammer$
 * $FileName: MakeArchiveAction.java$
 * $FileID: 4052$
 *
 * Last change:
 * $AuthorName: Rob MacGrogan$
 * $Date: 9/1/03 4:46 PM$
 * $Comment: Migrated show input box to MessageBoxUtil. Added
 *          ability to set type of each field in input box.$
 *
 * $KeyWordsOff: $
 */


package org.sourcejammer.client.gui.action;

import org.sourcejammer.client.DisplayTextLibrary;
import java.awt.event.ActionEvent;
import java.awt.Cursor;
import javax.swing.*;

import org.sourcejammer.client.gui.CommandCentral;
import org.sourcejammer.client.gui.GuiUtil;
import org.sourcejammer.client.gui.MessageBoxUtil;
import org.sourcejammer.util.AppConfig;

/**
 * Title:        SourceJammer v 0.1.0
 * Description:
 * Copyright:    Copyright (c) 2001
 * Company:
 * @author Robert MacGrogan
 * @version $Revision: 1.3 $
 */

public class MakeArchiveAction extends AbstractAction {

  public MakeArchiveAction() {
    super(DisplayTextLibrary.displayText(DisplayTextLibrary.ACT_MAKE_ARCHIVE));
  }
  public void actionPerformed(ActionEvent parm1) {
    try {
      CommandCentral oCommand = CommandCentral.getInstance();
      if (oCommand.isConnected()){
        String[] labels = {DisplayTextLibrary.displayText(DisplayTextLibrary.LBL_ARCH_NAME)};
        String[] values = MessageBoxUtil.displayInputBox(labels,
                                   DisplayTextLibrary.displayText(DisplayTextLibrary.LBL_MAKE_ARCHIVE),
                                   true,
                                   DisplayTextLibrary.displayText(DisplayTextLibrary.BTN_MAKE));
        if (values != null){
          oCommand.getRootAppFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
          oCommand.makeArchive(values[0], -1, null );
        }
      }
      else {
        String[] labels = {DisplayTextLibrary.displayText(DisplayTextLibrary.LBL_ARCH_NAME),
                                  DisplayTextLibrary.displayText(DisplayTextLibrary.LBL_SERVER_URL),
                                  DisplayTextLibrary.displayText(DisplayTextLibrary.LBL_USER),
                                  DisplayTextLibrary.displayText(DisplayTextLibrary.LBL_PASSWORD)};
        String[] values = MessageBoxUtil.displayInputBox(labels,
                                  DisplayTextLibrary.displayText(DisplayTextLibrary.LBL_MAKE_ARCHIVE),
                                  true,
                                  DisplayTextLibrary.displayText(DisplayTextLibrary.BTN_MAKE));
        if (values != null){
          String sArchName = values[0];
          String sURL = values[1];
          String sUserName = values[2];
          String sPassword = values[3];
          oCommand.makeArchiveDisconnected(sUserName, sPassword, sURL, sArchName, -1, null );
        }
      }
    }
    catch (Exception ex){
      MessageBoxUtil.displayErrorMessage(ex.getMessage(), true);
    }
    finally {
      CommandCentral.getInstance().getRootAppFrame().setCursor(Cursor.getDefaultCursor());
    }
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.