KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > memoire > vainstall > builder > action > NewProductAction


1 /*
2  * $RCSfile: NewProductAction.java,v $
3  * @modification $Date: 2001/09/28 19:31:19 $
4  * @version $Id: NewProductAction.java,v 1.1 2001/09/28 19:31:19 hfalk Exp $
5  *
6  */

7
8 package com.memoire.vainstall.builder.action;
9
10 import com.memoire.vainstall.VAGlobals;
11 import com.memoire.vainstall.builder.*;
12 import com.memoire.vainstall.builder.gui.*;
13 import com.memoire.vainstall.builder.util.*;
14
15 import java.io.File JavaDoc;
16
17 import javax.swing.JOptionPane JavaDoc;
18
19 /**
20  * This action creates a new installer project.
21  *
22  * First a wizard are shown which prompts for the product name and version
23  * and the root directory whwre the project files are put.
24  * Then a project are beeing created and shown in the builder.
25  *
26  * @see com.memoire.vainstall.builder.gui.NewProductWizard
27  * @see com.memoire.vainstall.builder.util.AbstractVAIBuilderAction
28  *
29  * @author Henrik Falk
30  * @version $Id: NewProductAction.java,v 1.1 2001/09/28 19:31:19 hfalk Exp $
31  */

32 public class NewProductAction extends AbstractVAIBuilderAction {
33
34     /**
35      * Default constructor
36      */

37     public NewProductAction() {
38         super();
39     }
40
41     /**
42      * Implements the runnit method
43      */

44     public void runnit() {
45
46         // Show smartguide
47
NewProductWizard newProductWizard = new NewProductWizard(getController().getFrame());
48         newProductWizard.initialize(getModel());
49         newProductWizard.setVisible(true);
50
51         // waiting for
52
String JavaDoc result = newProductWizard.getAction();
53
54         // return if cancel or escape
55
if(result.equals(VAGlobals.getResource("com.memoire.vainstall.builder.Language","Common_Cancel")) == true) {
56             return;
57         }
58
59         // get info
60
String JavaDoc projectName = newProductWizard.getProductName();
61         String JavaDoc projectVersion = newProductWizard.getProductVersion();
62         String JavaDoc projectDirectory = newProductWizard.getProductDirectory()
63                                   + File.separator
64                                   + projectName
65                                   + "_"
66                                   + projectVersion;
67         String JavaDoc productType = newProductWizard.getProductType();
68
69         VAIProductController productController = new VAIProductController();
70         try {
71             productController.createProject(projectName, projectVersion, projectDirectory, productType);
72         } catch (VAIBuilderException exc) {
73             JOptionPane.showMessageDialog(getController().getFrame(),
74                 exc.getMessageAsHtml(),
75                 VAGlobals.NAME,
76                 JOptionPane.ERROR_MESSAGE);
77             return;
78         }
79         getController().addProduct(projectDirectory,productController);
80
81     }
82
83 }
84
Popular Tags