01: /*****************************************************************************
02: * Java Plug-in Framework (JPF)
03: * Copyright (C) 2004-2007 Dmitry Olshansky
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: *****************************************************************************/package org.java.plugin.boot;
19:
20: import java.util.LinkedList;
21: import java.util.List;
22:
23: import org.java.plugin.registry.IntegrityCheckReport;
24: import org.java.plugin.util.ResourceManager;
25:
26: /**
27: * Standard boot error handler for GUI applications. Uses Swing based dialogue
28: * to show error details to user and prompt for input.
29: *
30: * @version $Id$
31: */
32: public class BootErrorHandlerGui implements BootErrorHandler {
33: /**
34: * @see org.java.plugin.boot.BootErrorHandler#handleFatalError(
35: * java.lang.String)
36: */
37: public void handleFatalError(String message) {
38: ErrorDialog
39: .showError(null,
40: ResourceManager.getMessage(Boot.PACKAGE_NAME,
41: "errorDialogueHeaderFatal"), message); //$NON-NLS-1$
42: }
43:
44: /**
45: * @see org.java.plugin.boot.BootErrorHandler#handleFatalError(
46: * java.lang.String, java.lang.Throwable)
47: */
48: public void handleFatalError(String message, Throwable t) {
49: ErrorDialog.showError(null,
50: ResourceManager.getMessage(Boot.PACKAGE_NAME,
51: "errorDialogueHeaderFatal"), message, t); //$NON-NLS-1$
52: }
53:
54: /**
55: * @see org.java.plugin.boot.BootErrorHandler#handleError(java.lang.String,
56: * java.lang.Exception)
57: */
58: public boolean handleError(String message, Exception e) {
59: return ErrorDialog.showWarning(null, ResourceManager
60: .getMessage(Boot.PACKAGE_NAME,
61: "errorDialogueHeaderNonFatal"), message, e); //$NON-NLS-1$
62: }
63:
64: /**
65: * @see org.java.plugin.boot.BootErrorHandler#handleError(java.lang.String,
66: * org.java.plugin.registry.IntegrityCheckReport)
67: */
68: public boolean handleError(String message,
69: IntegrityCheckReport report) {
70: List<String> items = new LinkedList<String>();
71: for (IntegrityCheckReport.ReportItem item : report.getItems()) {
72: if (item.getSeverity() != IntegrityCheckReport.Severity.ERROR) {
73: continue;
74: }
75: items.add(item.getMessage());
76: }
77: //items.add("see log file " + Boot.BOOT_ERROR_FILE_NAME + " for details");
78: return ErrorDialog.showWarning(null, ResourceManager
79: .getMessage(Boot.PACKAGE_NAME,
80: "errorDialogueHeaderNonFatal"), //$NON-NLS-1$
81: message, items);
82: }
83: }
|