Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PluginMessage |
|
| 1.0;1 |
1 | /* | |
2 | * Created on Aug 3, 2007 by wyatt | |
3 | */ | |
4 | package org.homeunix.thecave.buddi.plugin.api.exception; | |
5 | ||
6 | import javax.swing.JOptionPane; | |
7 | ||
8 | ||
9 | /** | |
10 | * The exception thrown when you need to notify the user of something. This is generally | |
11 | * an error, but can be good as well ("Plugin Completed Successfully"). | |
12 | * | |
13 | * I suppose that to be completely correct, I should make two versions of this: one | |
14 | * solely an error (implemented via an Exception class), and the other an object | |
15 | * which can be returned. However, throwing this should still work fine, so we may as well | |
16 | * just do it this way, as it is simpler from the plugin implementor's side. | |
17 | * | |
18 | * @author wyatt | |
19 | * | |
20 | */ | |
21 | public class PluginMessage extends Exception { | |
22 | public static final long serialVersionUID = 0; | |
23 | ||
24 | private final String longMessage; | |
25 | private final String title; | |
26 | private final int type; | |
27 | ||
28 | public PluginMessage(String message) { | |
29 | 0 | this(message, null, "", JOptionPane.PLAIN_MESSAGE); |
30 | 0 | } |
31 | ||
32 | public PluginMessage(String message, String longMessage, String title, int type) { | |
33 | 0 | super(message); |
34 | ||
35 | 0 | this.longMessage = longMessage; |
36 | 0 | this.title = title; |
37 | 0 | this.type = type; |
38 | 0 | } |
39 | ||
40 | public String getTitle() { | |
41 | 0 | return title; |
42 | } | |
43 | ||
44 | public int getType() { | |
45 | 0 | return type; |
46 | } | |
47 | ||
48 | public String getLongMessage(){ | |
49 | 0 | return longMessage; |
50 | } | |
51 | } |