01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: /*
09: * Created on 18.03.2005
10: */
11: package de.uka.ilkd.key.gui.notification.actions;
12:
13: import java.awt.Component;
14:
15: import javax.swing.JOptionPane;
16:
17: import de.uka.ilkd.key.gui.notification.events.GeneralFailureEvent;
18: import de.uka.ilkd.key.gui.notification.events.NotificationEvent;
19:
20: /**
21: * Displays a string in a {@link javax.swing.JOptionPane} error message window.
22: * @author bubel
23: */
24: public class GeneralFailureJTextPaneDisplay extends ShowDisplayPane {
25:
26: /**
27: * generates an action used for displaying text
28: */
29: public GeneralFailureJTextPaneDisplay(Component parentComponent) {
30: super (parentComponent);
31:
32: }
33:
34: /* (non-Javadoc)
35: * @see de.uka.ilkd.key.gui.notification.NotificationAction#execute(de.uka.ilkd.key.gui.notification.events.NotificationEvent)
36: */
37: public boolean execute(NotificationEvent event) {
38: if (event instanceof GeneralFailureEvent) {
39: setMessage(((GeneralFailureEvent) event).getErrorMessage());
40: } else {
41: setMessage("An unknown error has occured.");
42: }
43: JOptionPane.showMessageDialog(parentComponent, getMessage(),
44: "Error", JOptionPane.ERROR_MESSAGE);
45: return true;
46: }
47: }
|