Coverage Report - org.jtheque.core.managers.view.impl.actions.module.InstallModuleAction
 
Classes in this File Line Coverage Branch Coverage Complexity
InstallModuleAction
0 %
0/8
0 %
0/2
1.5
 
 1  
 package org.jtheque.core.managers.view.impl.actions.module;
 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.module.IModuleManager;
 21  
 import org.jtheque.core.managers.view.able.IViewManager;
 22  
 import org.jtheque.core.managers.view.impl.actions.JThequeAction;
 23  
 import org.jtheque.utils.io.SimpleFilter;
 24  
 
 25  
 import java.awt.event.ActionEvent;
 26  
 import java.io.File;
 27  
 
 28  
 /**
 29  
  * An action to install a module.
 30  
  *
 31  
  * @author Baptiste Wicht
 32  
  */
 33  
 public final class InstallModuleAction extends JThequeAction {
 34  
     /**
 35  
      * Construct a new InstallModuleAction.
 36  
      */
 37  
     public InstallModuleAction() {
 38  0
         super("modules.actions.new");
 39  0
     }
 40  
 
 41  
     @Override
 42  
     public void actionPerformed(ActionEvent e) {
 43  0
         File file = new File(Managers.getManager(IViewManager.class).chooseFile(new SimpleFilter("JAR File (*.jar)", "jar")));
 44  
 
 45  0
         boolean installed = Managers.getManager(IModuleManager.class).installModule(file);
 46  
 
 47  0
         if (installed) {
 48  0
             Managers.getManager(IViewManager.class).displayI18nText("message.module.installed");
 49  
         } else {
 50  0
             Managers.getManager(IViewManager.class).displayI18nText("error.module.not.installed");
 51  
         }
 52  0
     }
 53  
 }