Coverage Report - org.homeunix.thecave.buddi.view.menu.items.PanelMenuEntry
 
Classes in this File Line Coverage Branch Coverage Complexity
PanelMenuEntry
0%
0/12
N/A
2
 
 1  
 package org.homeunix.thecave.buddi.view.menu.items;
 2  
 
 3  
 import java.awt.event.ActionEvent;
 4  
 import java.util.logging.Level;
 5  
 import java.util.logging.Logger;
 6  
 
 7  
 import org.homeunix.thecave.buddi.plugin.api.BuddiPanelPlugin;
 8  
 import org.homeunix.thecave.buddi.plugin.api.util.TextFormatter;
 9  
 import org.homeunix.thecave.buddi.view.MainFrame;
 10  
 
 11  
 import ca.digitalcave.moss.swing.MossMenuItem;
 12  
 
 13  
 /**
 14  
  *
 15  
  * @author mpeccorini
 16  
  */
 17  
 public class PanelMenuEntry extends MossMenuItem {
 18  
 
 19  
         public static final long serialVersionUID = 0;
 20  
         private final BuddiPanelPlugin plugin;
 21  
 
 22  
         public PanelMenuEntry(MainFrame parentFrame, BuddiPanelPlugin plugin) {
 23  0
                 super(parentFrame, TextFormatter.getTranslation(plugin.getTabLabelKey()));
 24  0
                 this.plugin = plugin;
 25  0
         }
 26  
 
 27  
         @Override
 28  
         public void actionPerformed(ActionEvent e) {
 29  
                 try {
 30  0
                         BuddiPanelPlugin newPlugin = plugin.getClass().newInstance();
 31  0
                         newPlugin.setParentFrame((MainFrame)getFrame());
 32  0
                         ((MainFrame)getFrame()).addPanel(TextFormatter.getTranslation(newPlugin.getTabLabelKey()), newPlugin);
 33  0
                 } catch (InstantiationException ex) {
 34  0
                         Logger.getLogger(PanelMenuEntry.class.getName()).log(Level.SEVERE, null, ex);
 35  0
                 } catch (IllegalAccessException ex) {
 36  0
                         Logger.getLogger(PanelMenuEntry.class.getName()).log(Level.SEVERE, null, ex);
 37  0
                 }
 38  0
         }
 39  
 
 40  
 }