01: /*
02: * $RCSfile: CloseProductAction.java,v $
03: * @modification $Date: 2001/09/28 19:31:19 $
04: * @version $Id: CloseProductAction.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.util.*;
13:
14: import java.io.File;
15:
16: import javax.swing.JOptionPane;
17:
18: /**
19: * This action handles closing of a product which is currently beeing
20: * edited .
21: *
22: * @see com.memoire.vainstall.builder.util.AbstractVAIBuilderAction
23: *
24: * @author Henrik Falk
25: * @version $Id: CloseProductAction.java,v 1.1 2001/09/28 19:31:19 hfalk Exp $
26: */
27: public class CloseProductAction extends AbstractVAIBuilderAction {
28:
29: /**
30: * Default constructor
31: */
32: public CloseProductAction() {
33: super ();
34: }
35:
36: /**
37: * Implements the runnit method
38: */
39: public void runnit() {
40:
41: // get the product which is active noe
42: VAIProductController productController = getController()
43: .getActiveProductController();
44:
45: // if not saved then ask the user to save
46: if (productController.isDirty() == true) {
47: int result = JOptionPane.showConfirmDialog(getController()
48: .getFrame(), VAGlobals.getResource(
49: "com.memoire.vainstall.builder.Language",
50: "CloseProductAction_WantToSave"), productController
51: .getModel().getProductName()
52: + VAGlobals.getResource(
53: "com.memoire.vainstall.builder.Language",
54: "CloseProductAction_Version")
55: + productController.getModel().getProductVersion(),
56: JOptionPane.YES_NO_OPTION,
57: JOptionPane.WARNING_MESSAGE);
58: if (result == JOptionPane.YES_OPTION) {
59: try {
60: productController.getModel().save();
61: } catch (VAIBuilderException exc) {
62: JOptionPane.showMessageDialog(getController()
63: .getFrame(), exc.getMessageAsHtml(),
64: VAGlobals.NAME, JOptionPane.ERROR_MESSAGE);
65: }
66: }
67: }
68:
69: // remove the product from the builder controller
70: String id = productController.getModel().getProductDirectory();
71: getController().removeProduct(id);
72: }
73:
74: }
|