KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > resource > DeviceResourceException


1 /*******************************************************************************
2  * Copyright (c) 2004, 2006 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.jface.resource;
12
13
14 /**
15  * Thrown when allocation of an SWT device resource fails
16  *
17  * @since 3.1
18  */

19 public class DeviceResourceException extends RuntimeException JavaDoc {
20     
21     private Throwable JavaDoc cause;
22
23     /**
24      * All serializable objects should have a stable serialVersionUID
25      */

26     private static final long serialVersionUID = 11454598756198L;
27     
28     /**
29      * Creates a DeviceResourceException indicating an error attempting to
30      * create a resource and an embedded low-level exception describing the cause
31      *
32      * @param missingResource
33      * @param cause cause of the exception (or null if none)
34      */

35     public DeviceResourceException(DeviceResourceDescriptor missingResource, Throwable JavaDoc cause) {
36         super("Unable to create resource " + missingResource.toString()); //$NON-NLS-1$
37
// don't pass the cause to super, to allow compilation against JCL Foundation (bug 80059)
38
this.cause = cause;
39     }
40     
41     /**
42      * Creates a DeviceResourceException indicating an error attempting to
43      * create a resource
44      *
45      * @param missingResource
46      */

47     public DeviceResourceException(DeviceResourceDescriptor missingResource) {
48         this(missingResource, null);
49     }
50     
51     /**
52      * Returns the cause of this throwable or <code>null</code> if the
53      * cause is nonexistent or unknown.
54      *
55      * @return the cause or <code>null</code>
56      * @since 3.1
57      */

58     public Throwable JavaDoc getCause() {
59         return cause;
60     }
61     
62 }
63
Popular Tags