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  import org.abstracthorizon.aequo.gui.Start;
22  
23  /**
24   * New session action.
25   *
26   * @author Daniel Sendula
27   */
28  public class NewSessionAction extends BaseAction {
29  
30      /**
31       * Constructor
32       */
33      public NewSessionAction() {
34          setName("New Session...");
35          setMessage("New Session");
36          setDescription("New Session");
37          putValue(Action.MNEMONIC_KEY, KeyEvent.VK_N);
38          putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));
39      }
40  
41      /**
42       * Creates new session
43       * @param e event
44       */
45      public void perform(ActionEvent e) {
46          Start.startNewSession(getGlobalContext());
47      }
48  }