1 /*
2 Copyright (C) 2000 - 2007 Grid Systems, S.A.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2, as
6 published by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18 /*
19 * Project: KernelConfigurator
20 * Created on 09-mar-2004
21 *
22 * Copyright (c)2003 Grid Systems
23 */
24 package com.gridsystems.config.tools.console;
25
26 import com.gridsystems.config.Configurator;
27 import com.gridsystems.config.ConsoleConfiguratorView;
28 import com.gridsystems.config.app.UI;
29
30
31 /**
32 * Special ConsoleViewAction that performs a Discard on this configurator model
33 * and exits from the view.
34 *
35 * @author <a href="mailto:rruiz@gridsystems.com">Rodrigo Ruiz Aguayo</a>
36 * @version 1.0
37 */
38 public class DiscardAction implements ConsoleViewAction {
39 /**
40 * The configurator instance this instance is bound to.
41 */
42 private final Configurator configurator;
43
44 /**
45 * Creates a new instance.
46 *
47 * @param configurator The configurator instance this action is bound to
48 */
49 public DiscardAction(Configurator configurator) {
50 this.configurator = configurator;
51 }
52
53 /**
54 * {@inheritDoc}
55 */
56 public String getKeyMapping() {
57 return UI.getString("console.discard.key");
58 }
59
60 /**
61 * {@inheritDoc}
62 */
63 public boolean execute(ConsoleConfiguratorView view) {
64 this.configurator.discard();
65 return false;
66 }
67 }