View Javadoc

1   /*
2    * Copyright (c) 2007 Creative Sphere Limited.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *
10   *   Creative Sphere - initial API and implementation
11   *
12   */
13  package org.abstracthorizon.aequo.action;
14  
15  import java.awt.event.ActionEvent;
16  import java.awt.event.KeyEvent;
17  
18  import javax.swing.Action;
19  import javax.swing.KeyStroke;
20  
21  /**
22   * Quit action.
23   *
24   * @author Daniel Sendula
25   */
26  public class ExitAction extends BaseAction {
27  
28      /**
29       * Constructor
30       */
31      public ExitAction() {
32          setName("Exit");
33          setDescription("Exit Aequo");
34          setMessage("Exit Aequo");
35          putValue(Action.MNEMONIC_KEY, KeyEvent.VK_X);
36          putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
37      }
38  
39      /**
40       * Executes:
41       * <code>
42       * System.exit(0)
43       * </code>
44       * @param e event
45       */
46      public void perform(ActionEvent e) {
47          System.exit(0);
48      }
49  }