Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 11 package org.eclipse.jdt.core; 12 13 import java.io.PrintStream ; 14 import java.io.PrintWriter ; 15 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.core.runtime.IStatus; 18 19 import org.eclipse.jdt.internal.core.JavaModelStatus; 20 21 34 public class JavaModelException extends CoreException { 35 36 private static final long serialVersionUID = -760398656505871287L; 38 CoreException nestedCoreException; 39 50 public JavaModelException(Throwable e, int code) { 51 this(new JavaModelStatus(code, e)); 52 } 53 60 public JavaModelException(CoreException exception) { 61 super(exception.getStatus()); 62 this.nestedCoreException = exception; 63 } 64 69 public JavaModelException(IJavaModelStatus status) { 70 super(status); 71 } 72 78 public Throwable getException() { 79 if (this.nestedCoreException == null) { 80 return getStatus().getException(); 81 } else { 82 return this.nestedCoreException; 83 } 84 } 85 91 public IJavaModelStatus getJavaModelStatus() { 92 IStatus status = this.getStatus(); 93 if (status instanceof IJavaModelStatus) { 94 return (IJavaModelStatus)status; 95 } else { 96 return new JavaModelStatus(this.nestedCoreException); 99 } 100 } 101 114 public boolean isDoesNotExist() { 115 IJavaModelStatus javaModelStatus = getJavaModelStatus(); 116 return javaModelStatus != null && javaModelStatus.isDoesNotExist(); 117 } 118 119 125 public void printStackTrace(PrintStream output) { 126 synchronized(output) { 127 super.printStackTrace(output); 128 Throwable throwable = getException(); 129 if (throwable != null) { 130 output.print("Caused by: "); throwable.printStackTrace(output); 132 } 133 } 134 } 135 136 142 public void printStackTrace(PrintWriter output) { 143 synchronized(output) { 144 super.printStackTrace(output); 145 Throwable throwable = getException(); 146 if (throwable != null) { 147 output.print("Caused by: "); throwable.printStackTrace(output); 149 } 150 } 151 } 152 156 public String toString() { 157 StringBuffer buffer= new StringBuffer (); 158 buffer.append("Java Model Exception: "); if (getException() != null) { 160 if (getException() instanceof CoreException) { 161 CoreException c= (CoreException)getException(); 162 buffer.append("Core Exception [code "); buffer.append(c.getStatus().getCode()); 164 buffer.append("] "); buffer.append(c.getStatus().getMessage()); 166 } else { 167 buffer.append(getException().toString()); 168 } 169 } else { 170 buffer.append(getStatus().toString()); 171 } 172 return buffer.toString(); 173 } 174 } 175
| Popular Tags
|