KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $RCSfile: CloseProductAction.java,v $
3  * @modification $Date: 2001/09/28 19:31:19 $
4  * @version $Id: CloseProductAction.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.util.*;
13
14 import java.io.File JavaDoc;
15
16 import javax.swing.JOptionPane JavaDoc;
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().getActiveProductController();
43
44         // if not saved then ask the user to save
45
if (productController.isDirty() == true) {
46             int result = JOptionPane.showConfirmDialog(getController().getFrame(),
47                 VAGlobals.getResource("com.memoire.vainstall.builder.Language","CloseProductAction_WantToSave"),
48                 productController.getModel().getProductName()
49                     + VAGlobals.getResource("com.memoire.vainstall.builder.Language","CloseProductAction_Version")
50                     + productController.getModel().getProductVersion(),
51                 JOptionPane.YES_NO_OPTION,
52                 JOptionPane.WARNING_MESSAGE);
53             if (result == JOptionPane.YES_OPTION) {
54                 try {
55                     productController.getModel().save();
56                 } catch (VAIBuilderException exc) {
57                     JOptionPane.showMessageDialog(getController().getFrame(),
58                     exc.getMessageAsHtml(),
59                     VAGlobals.NAME,
60                     JOptionPane.ERROR_MESSAGE);
61                 }
62             }
63         }
64
65         // remove the product from the builder controller
66
String JavaDoc id = productController.getModel().getProductDirectory();
67         getController().removeProduct(id);
68     }
69
70 }
71
Popular Tags