]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/ExceptionUtils.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.utils.ui / src / org / simantics / utils / ui / ExceptionUtils.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.utils.ui;
13
14 import org.simantics.utils.ui.dialogs.ShowError;
15
16
17 /**
18  * 
19  * @author Toni Kalajainen
20  */
21 public class ExceptionUtils {
22
23     public static void logWarning(String msg) {
24         Exception e = new Exception(msg);
25         ErrorLogger.getDefault().logWarning(msg, e);
26     }
27
28     public static void logWarning(String msg, Throwable e) {
29         e = new Exception(msg, e);
30         ErrorLogger.getDefault().logWarning(msg, e);
31     }
32
33     public static void logError(Throwable e) {
34         ErrorLogger.defaultLogError(e);
35     }
36
37     public static void logError(String msg, Throwable e) {
38         e = new Exception(msg, e);
39         ErrorLogger.getDefault().logError(msg, e);
40     }
41
42     public static void logAndShowError(Throwable e) {
43         ErrorLogger.defaultLogError(e);
44         ShowError.showError("Error", e.getMessage(),e);
45     }
46     
47     public static void logAndShowError(String message, Throwable e) {
48         ErrorLogger.defaultLogError(message,e);
49         ShowError.showError("Error", message,e);
50     }
51
52     public static void logAndShowError(String title, String message, Throwable e) {
53         ErrorLogger.defaultLogError(message,e);
54         ShowError.showError(title, message,e);
55     }
56
57     public static void showError(Throwable e) {
58          ShowError.showError("Error", e.getMessage(),e);
59     }
60     
61     public static void showError(String message, Throwable e) {
62                 ShowError.showError("Error", message,e);
63     }
64
65 }