Source Code Cross Referenced for SWTException.java in  » IDE-Eclipse » swt » org » eclipse » swt » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » swt » org.eclipse.swt 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2005 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.swt;
011:
012:        import org.eclipse.swt.internal.*;
013:
014:        /**
015:         * This runtime exception is thrown whenever a recoverable error
016:         * occurs internally in SWT. The message text and error code 
017:         * provide a further description of the problem. The exception
018:         * has a <code>throwable</code> field which holds the underlying
019:         * exception that caused the problem (if this information is
020:         * available (i.e. it may be null)).
021:         * <p>
022:         * SWTExceptions are thrown when something fails internally,
023:         * but SWT is left in a known stable state (eg. a widget call
024:         * was made from a non-u/i thread, or there is failure while
025:         * reading an Image because the source file was corrupt).
026:         * </p>
027:         *
028:         * @see SWTError
029:         */
030:
031:        public class SWTException extends RuntimeException {
032:            /**
033:             * The SWT error code, one of SWT.ERROR_*.
034:             */
035:            public int code;
036:
037:            /**
038:             * The underlying throwable that caused the problem,
039:             * or null if this information is not available.
040:             */
041:            public Throwable throwable;
042:
043:            static final long serialVersionUID = 3257282552304842547L;
044:
045:            /**
046:             * Constructs a new instance of this class with its 
047:             * stack trace filled in. The error code is set to an
048:             * unspecified value.
049:             */
050:            public SWTException() {
051:                this (SWT.ERROR_UNSPECIFIED);
052:            }
053:
054:            /**
055:             * Constructs a new instance of this class with its 
056:             * stack trace and message filled in. The error code is
057:             * set to an unspecified value.  Specifying <code>null</code>
058:             * as the message is equivalent to specifying an empty string.
059:             *
060:             * @param message the detail message for the exception
061:             */
062:            public SWTException(String message) {
063:                this (SWT.ERROR_UNSPECIFIED, message);
064:            }
065:
066:            /**
067:             * Constructs a new instance of this class with its 
068:             * stack trace and error code filled in.
069:             *
070:             * @param code the SWT error code
071:             */
072:            public SWTException(int code) {
073:                this (code, SWT.findErrorText(code));
074:            }
075:
076:            /**
077:             * Constructs a new instance of this class with its 
078:             * stack trace, error code and message filled in.
079:             * Specifying <code>null</code> as the message is
080:             * equivalent to specifying an empty string.
081:             *
082:             * @param code the SWT error code
083:             * @param message the detail message for the exception
084:             */
085:            public SWTException(int code, String message) {
086:                super (message);
087:                this .code = code;
088:            }
089:
090:            /**
091:             * Returns the underlying throwable that caused the problem,
092:             * or null if this information is not available.
093:             * <p>
094:             * NOTE: This method overrides Throwable.getCause() that was
095:             * added to JDK1.4. It is necessary to override this method
096:             * in order for inherited printStackTrace() methods to work.
097:             * </p>
098:             * @return the underlying throwable
099:             * 
100:             * @since 3.1
101:             */
102:            public Throwable getCause() {
103:                return throwable;
104:            }
105:
106:            /**
107:             *  Returns the string describing this SWTException object.
108:             *  <p>
109:             *  It is combined with the message string of the Throwable
110:             *  which caused this SWTException (if this information is available).
111:             *  </p>
112:             *  @return the error message string of this SWTException object
113:             */
114:            public String getMessage() {
115:                if (throwable == null)
116:                    return super .getMessage();
117:                return super .getMessage() + " (" + throwable.toString() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
118:            }
119:
120:            /**
121:             * Outputs a printable representation of this exception's
122:             * stack trace on the standard error stream.
123:             * <p>
124:             * Note: printStackTrace(PrintStream) and printStackTrace(PrintWriter)
125:             * are not provided in order to maintain compatibility with CLDC.
126:             * </p>
127:             */
128:            public void printStackTrace() {
129:                super .printStackTrace();
130:                if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 4, 0)
131:                        && throwable != null) {
132:                    System.err
133:                            .println("*** Stack trace of contained exception ***"); //$NON-NLS-1$
134:                    throwable.printStackTrace();
135:                }
136:            }
137:
138:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.