Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT FRAMES NO FRAMES |

file stats: | LOC: | 67 |  | Methods: | 3
| NCLOC: | 43 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL
ParseExceptionHandler.java | 0% | 0% | 0% | 0% |

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.10 2006/02/10 14:15:31 tomcopeland Exp $
18 |  | */
19 |  |
20 |  | public class ParseExceptionHandler extends JDialog implements ActionListener {
21 |  | private Exception exc;
22 |  | private JTextArea errorArea;
23 |  | private JButton okBtn;
24 |  |
25 |  | /**
26 |  | * creates the dialog
27 |  | *
28 |  | * @param parent dialog's parent
29 |  | * @param exc exception to be handled
30 |  | */
31 | 0 | public ParseExceptionHandler(JFrame parent, Exception exc) {
32 | 0 | super(parent, NLS.nls("COMPILE_ERROR.DIALOG.TITLE"), true);
33 | 0 | this.exc = exc;
34 | 0 | init();
35 |  | }
36 |  |
37 | 0 | private void init() {
38 | 0 | errorArea = new JTextArea();
39 | 0 | errorArea.setEditable(false);
40 | 0 | errorArea.setText(exc.getMessage() + "\n");
41 | 0 | getContentPane().setLayout(new BorderLayout());
42 | 0 | JPanel messagePanel = new JPanel(new BorderLayout());
43 | 0 | messagePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(),
44 |  | BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
45 |  | NLS.nls("COMPILE_ERROR.PANEL.TITLE"))));
46 | 0 | messagePanel.add(new JScrollPane(errorArea), BorderLayout.CENTER);
47 | 0 | getContentPane().add(messagePanel, BorderLayout.CENTER);
48 | 0 | JPanel btnPane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
49 | 0 | okBtn = new JButton(NLS.nls("COMPILE_ERROR.OK_BUTTON.CAPTION"));
50 | 0 | okBtn.addActionListener(this);
51 | 0 | btnPane.add(okBtn);
52 | 0 | getRootPane().setDefaultButton(okBtn);
53 | 0 | getContentPane().add(btnPane, BorderLayout.SOUTH);
54 | 0 | pack();
55 | 0 | setLocationRelativeTo(getParent());
56 | 0 | setVisible(true);
57 |  | }
58 |  |
59 |  | /**
60 |  | * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
61 |  | */
62 | 0 | public void actionPerformed(ActionEvent e) {
63 | 0 | if (e.getSource() == okBtn) {
64 | 0 | dispose();
65 |  | }
66 |  | }
67 |  | }