01: /*
02: * uDig - User Friendly Desktop Internet GIS client
03: * http://udig.refractions.net
04: * (C) 2004, Refractions Research Inc.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package net.refractions.udig.ui;
18:
19: import java.util.List;
20:
21: import net.refractions.udig.ui.internal.Messages;
22:
23: import org.eclipse.core.runtime.IStatus;
24: import org.eclipse.core.runtime.MultiStatus;
25: import org.eclipse.core.runtime.Status;
26: import org.eclipse.jface.dialogs.Dialog;
27: import org.eclipse.jface.dialogs.ErrorDialog;
28: import org.eclipse.swt.widgets.Display;
29:
30: public class ExceptionDisplayer {
31: public static void displayExceptions(
32: final List<Throwable> exceptions, final String message,
33: final String pluginID) {
34: final MultiStatus multi = new MultiStatus(pluginID, IStatus.OK,
35: message, null);
36: for (Throwable exception : exceptions) {
37: Status status = new Status(IStatus.ERROR, pluginID,
38: IStatus.ERROR, exception.getLocalizedMessage(),
39: exception);
40: multi.add(status);
41: }
42:
43: PlatformGIS.syncInDisplayThread(new Runnable() {
44: public void run() {
45: Dialog dialog = new ErrorDialog(
46: Display.getDefault().getActiveShell(),
47: Messages.ExceptionDisplayer_very_informative_error,
48: message, multi, IStatus.ERROR);
49: dialog.open();
50: }
51: });
52: }
53: }
|