01: /*
02: * $RCSfile: NewProductAction.java,v $
03: * @modification $Date: 2001/09/28 19:31:19 $
04: * @version $Id: NewProductAction.java,v 1.1 2001/09/28 19:31:19 hfalk Exp $
05: *
06: */
07:
08: package com.memoire.vainstall.builder.action;
09:
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;
16:
17: import javax.swing.JOptionPane;
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(
48: getController().getFrame());
49: newProductWizard.initialize(getModel());
50: newProductWizard.setVisible(true);
51:
52: // waiting for
53: String result = newProductWizard.getAction();
54:
55: // return if cancel or escape
56: if (result.equals(VAGlobals.getResource(
57: "com.memoire.vainstall.builder.Language",
58: "Common_Cancel")) == true) {
59: return;
60: }
61:
62: // get info
63: String projectName = newProductWizard.getProductName();
64: String projectVersion = newProductWizard.getProductVersion();
65: String projectDirectory = newProductWizard
66: .getProductDirectory()
67: + File.separator + projectName + "_" + projectVersion;
68: String productType = newProductWizard.getProductType();
69:
70: VAIProductController productController = new VAIProductController();
71: try {
72: productController.createProject(projectName,
73: projectVersion, projectDirectory, productType);
74: } catch (VAIBuilderException exc) {
75: JOptionPane.showMessageDialog(getController().getFrame(),
76: exc.getMessageAsHtml(), VAGlobals.NAME,
77: JOptionPane.ERROR_MESSAGE);
78: return;
79: }
80: getController().addProduct(projectDirectory, productController);
81:
82: }
83:
84: }
|