KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > JavaUIStatus


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.ui;
12
13 import org.eclipse.core.runtime.IStatus;
14 import org.eclipse.core.runtime.Status;
15
16 /**
17  * Convenience class for error exceptions thrown inside JavaUI plugin.
18  */

19 public class JavaUIStatus extends Status {
20
21     private JavaUIStatus(int severity, int code, String JavaDoc message, Throwable JavaDoc throwable) {
22         super(severity, JavaPlugin.getPluginId(), code, message, throwable);
23     }
24     
25     public static IStatus createError(int code, Throwable JavaDoc throwable) {
26         String JavaDoc message= throwable.getMessage();
27         if (message == null) {
28             message= throwable.getClass().getName();
29         }
30         return new JavaUIStatus(IStatus.ERROR, code, message, throwable);
31     }
32
33     public static IStatus createError(int code, String JavaDoc message, Throwable JavaDoc throwable) {
34         return new JavaUIStatus(IStatus.ERROR, code, message, throwable);
35     }
36     
37     public static IStatus createWarning(int code, String JavaDoc message, Throwable JavaDoc throwable) {
38         return new JavaUIStatus(IStatus.WARNING, code, message, throwable);
39     }
40
41     public static IStatus createInfo(int code, String JavaDoc message, Throwable JavaDoc throwable) {
42         return new JavaUIStatus(IStatus.INFO, code, message, throwable);
43     }
44 }
45
46
Popular Tags