Source Code Cross Referenced for SWTError.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 error is thrown whenever an unrecoverable 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:         * throwable that caused the problem (if this information is
020:         * available (i.e. it may be null)).
021:         * <p>
022:         * SWTErrors are thrown when something fails internally which
023:         * either leaves SWT in an unknown state (eg. the o/s call to
024:         * remove an item from a list returns an error code) or when SWT
025:         * is left in a known-to-be-unrecoverable state (eg. it runs out
026:         * of callback resources). SWTErrors should not occur in typical
027:         * programs, although "high reliability" applications should
028:         * still catch them.
029:         * </p><p>
030:         * This class also provides support methods used by SWT to match
031:         * error codes to the appropriate exception class (SWTError, 
032:         * SWTException, or IllegalArgumentException) and to provide
033:         * human readable strings for SWT error codes.
034:         * </p>
035:         *
036:         * @see SWTException
037:         * @see SWT#error(int)
038:         */
039:
040:        public class SWTError extends Error {
041:            /**
042:             * The SWT error code, one of SWT.ERROR_*.
043:             */
044:            public int code;
045:
046:            /**
047:             * The underlying throwable that caused the problem,
048:             * or null if this information is not available.
049:             */
050:            public Throwable throwable;
051:
052:            static final long serialVersionUID = 3833467327105808433L;
053:
054:            /**
055:             * Constructs a new instance of this class with its 
056:             * stack trace filled in. The error code is set to an
057:             * unspecified value.
058:             */
059:            public SWTError() {
060:                this (SWT.ERROR_UNSPECIFIED);
061:            }
062:
063:            /**
064:             * Constructs a new instance of this class with its 
065:             * stack trace and message filled in. The error code is
066:             * set to an unspecified value.  Specifying <code>null</code>
067:             * as the message is equivalent to specifying an empty string.
068:             *
069:             * @param message the detail message for the exception
070:             */
071:            public SWTError(String message) {
072:                this (SWT.ERROR_UNSPECIFIED, message);
073:            }
074:
075:            /**
076:             * Constructs a new instance of this class with its 
077:             * stack trace and error code filled in.
078:             *
079:             * @param code the SWT error code
080:             */
081:            public SWTError(int code) {
082:                this (code, SWT.findErrorText(code));
083:            }
084:
085:            /**
086:             * Constructs a new instance of this class with its 
087:             * stack trace, error code and message filled in.
088:             * Specifying <code>null</code> as the message is
089:             * equivalent to specifying an empty string.
090:             * 
091:             * @param code the SWT error code
092:             * @param message the detail message for the exception
093:             */
094:            public SWTError(int code, String message) {
095:                super (message);
096:                this .code = code;
097:            }
098:
099:            /**
100:             * Returns the underlying throwable that caused the problem,
101:             * or null if this information is not available.
102:             * <p>
103:             * NOTE: This method overrides Throwable.getCause() that was
104:             * added to JDK1.4. It is necessary to override this method
105:             * in order for inherited printStackTrace() methods to work.
106:             * </p>
107:             * @return the underlying throwable
108:             * 
109:             * @since 3.1
110:             */
111:            public Throwable getCause() {
112:                return throwable;
113:            }
114:
115:            /**
116:             *  Returns the string describing this SWTError object.
117:             *  <p>
118:             *  It is combined with the message string of the Throwable
119:             *  which caused this SWTError (if this information is available).
120:             *  </p>
121:             *  @return the error message string of this SWTError object
122:             */
123:            public String getMessage() {
124:                if (throwable == null)
125:                    return super .getMessage();
126:                return super .getMessage() + " (" + throwable.toString() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
127:            }
128:
129:            /**
130:             * Outputs a printable representation of this error's
131:             * stack trace on the standard error stream.
132:             * <p>
133:             * Note: printStackTrace(PrintStream) and printStackTrace(PrintWriter)
134:             * are not provided in order to maintain compatibility with CLDC.
135:             * </p>
136:             */
137:            public void printStackTrace() {
138:                super .printStackTrace();
139:                if (Library.JAVA_VERSION < Library.JAVA_VERSION(1, 4, 0)
140:                        && throwable != null) {
141:                    System.err
142:                            .println("*** Stack trace of contained error ***"); //$NON-NLS-1$
143:                    throwable.printStackTrace();
144:                }
145:            }
146:
147:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.