Coverage Report - org.jtheque.core.managers.view.impl.actions.core.ExitAction
 
Classes in this File Line Coverage Branch Coverage Complexity
ExitAction
0 %
0/6
N/A
1
 
 1  
 package org.jtheque.core.managers.view.impl.actions.core;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jtheque.core.managers.Managers;
 20  
 import org.jtheque.core.managers.core.Core;
 21  
 import org.jtheque.core.managers.resource.IResourceManager;
 22  
 import org.jtheque.core.managers.resource.ImageType;
 23  
 import org.jtheque.core.managers.view.impl.actions.JThequeAction;
 24  
 
 25  
 import javax.swing.Action;
 26  
 import javax.swing.KeyStroke;
 27  
 import java.awt.Toolkit;
 28  
 import java.awt.event.ActionEvent;
 29  
 import java.awt.event.KeyEvent;
 30  
 
 31  
 /**
 32  
  * An action to exit of the application.
 33  
  *
 34  
  * @author Baptiste Wicht
 35  
  */
 36  
 public final class ExitAction extends JThequeAction {
 37  
     /**
 38  
      * Construct a new ExitAction.
 39  
      */
 40  
     public ExitAction() {
 41  0
         super("menu.exit", Managers.getCore().getApplication().getName());
 42  
 
 43  0
         putValue(Action.ACCELERATOR_KEY,
 44  
                 KeyStroke.getKeyStroke(KeyEvent.VK_E, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
 45  
 
 46  0
         setIcon(Managers.getManager(IResourceManager.class).getIcon(Core.IMAGES_BASE_NAME, "exit", ImageType.PNG));
 47  0
     }
 48  
 
 49  
     @Override
 50  
     public void actionPerformed(ActionEvent arg0) {
 51  0
         Managers.getCore().getLifeCycleManager().exit();
 52  0
     }
 53  
 }