Clover coverage report - PMD - 3.3
Coverage timestamp: Thu Sep 15 2005 17:59:57 EDT
file stats: LOC: 124   Methods: 3
NCLOC: 45   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ParseExceptionHandler.java 0% 0% 0% 0%
coverage
 1    package net.sourceforge.pmd.util.viewer.gui;
 2   
 3   
 4    import net.sourceforge.pmd.util.viewer.util.NLS;
 5   
 6    import javax.swing.*;
 7    import java.awt.BorderLayout;
 8    import java.awt.FlowLayout;
 9    import java.awt.event.ActionEvent;
 10    import java.awt.event.ActionListener;
 11   
 12   
 13    /**
 14    * handles parsing exceptions
 15    *
 16    * @author Boris Gruschko ( boris at gruschko.org )
 17    * @version $Id: ParseExceptionHandler.java,v 1.8 2005/09/02 19:36:22 tomcopeland Exp $
 18    */
 19   
 20    public class ParseExceptionHandler
 21   
 22    extends JDialog
 23   
 24    implements ActionListener {
 25   
 26    private Exception exc;
 27   
 28    private JTextArea errorArea;
 29   
 30    private JButton okBtn;
 31   
 32   
 33    /**
 34    * creates the dialog
 35    *
 36    * @param parent dialog's parent
 37    * @param exc exception to be handled
 38    */
 39   
 40  0 public ParseExceptionHandler(JFrame parent, Exception exc) {
 41   
 42  0 super(parent, NLS.nls("COMPILE_ERROR.DIALOG.TITLE"), true);
 43   
 44   
 45  0 this.exc = exc;
 46   
 47   
 48  0 init();
 49   
 50    }
 51   
 52   
 53  0 private void init() {
 54   
 55  0 errorArea = new JTextArea();
 56   
 57  0 errorArea.setEditable(false);
 58   
 59  0 errorArea.setText(exc.getMessage() + "\n");
 60   
 61   
 62  0 getContentPane().setLayout(new BorderLayout());
 63   
 64   
 65  0 JPanel messagePanel = new JPanel(new BorderLayout());
 66   
 67   
 68  0 messagePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(),
 69   
 70    BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
 71   
 72    NLS.nls("COMPILE_ERROR.PANEL.TITLE"))));
 73   
 74   
 75  0 messagePanel.add(new JScrollPane(errorArea), BorderLayout.CENTER);
 76   
 77   
 78  0 getContentPane().add(messagePanel, BorderLayout.CENTER);
 79   
 80   
 81  0 JPanel btnPane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
 82   
 83   
 84  0 okBtn = new JButton(NLS.nls("COMPILE_ERROR.OK_BUTTON.CAPTION"));
 85   
 86   
 87  0 okBtn.addActionListener(this);
 88   
 89   
 90  0 btnPane.add(okBtn);
 91   
 92   
 93  0 getRootPane().setDefaultButton(okBtn);
 94   
 95   
 96  0 getContentPane().add(btnPane, BorderLayout.SOUTH);
 97   
 98   
 99  0 pack();
 100   
 101   
 102  0 setLocationRelativeTo(getParent());
 103   
 104   
 105  0 setVisible(true);
 106   
 107    }
 108   
 109   
 110    /**
 111    * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
 112    */
 113   
 114  0 public void actionPerformed(ActionEvent e) {
 115   
 116  0 if (e.getSource() == okBtn) {
 117   
 118  0 dispose();
 119   
 120    }
 121   
 122    }
 123   
 124    }