01: /*******************************************************************************
02: * Copyright (c) 2004, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jface.resource;
11:
12: /**
13: * Thrown when allocation of an SWT device resource fails
14: *
15: * @since 3.1
16: */
17: public class DeviceResourceException extends RuntimeException {
18:
19: private Throwable cause;
20:
21: /**
22: * All serializable objects should have a stable serialVersionUID
23: */
24: private static final long serialVersionUID = 11454598756198L;
25:
26: /**
27: * Creates a DeviceResourceException indicating an error attempting to
28: * create a resource and an embedded low-level exception describing the cause
29: *
30: * @param missingResource
31: * @param cause cause of the exception (or null if none)
32: */
33: public DeviceResourceException(
34: DeviceResourceDescriptor missingResource, Throwable cause) {
35: super ("Unable to create resource " + missingResource.toString()); //$NON-NLS-1$
36: // don't pass the cause to super, to allow compilation against JCL Foundation (bug 80059)
37: this .cause = cause;
38: }
39:
40: /**
41: * Creates a DeviceResourceException indicating an error attempting to
42: * create a resource
43: *
44: * @param missingResource
45: */
46: public DeviceResourceException(
47: 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 getCause() {
59: return cause;
60: }
61:
62: }
|