Author: scabanovich
Date: 2008-03-31 08:47:57 -0400 (Mon, 31 Mar 2008)
New Revision: 7205
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/XModelException.java
Log:
JBIDE-893
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/XModelException.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/XModelException.java 2008-03-31
12:28:27 UTC (rev 7204)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/XModelException.java 2008-03-31
12:47:57 UTC (rev 7205)
@@ -10,24 +10,43 @@
******************************************************************************/
package org.jboss.tools.common.model;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
+
/**
* @author Viacheslav Kabanovich
*/
-public class XModelException extends Exception {
+public class XModelException extends CoreException {
private static final long serialVersionUID = 1L;
- public XModelException() {}
+ public XModelException() {
+ super(createStatus(null, null));
+ }
public XModelException(String message) {
- super(message);
+ super(createStatus(message, null));
}
public XModelException(String message, Throwable cause) {
- super(message, cause);
+ super(createStatus(message, cause));
}
public XModelException(Throwable cause) {
- super(cause);
+ super(createStatus(null, cause));
}
+
+ static IStatus createStatus(String message, Throwable cause) {
+ return new Status(IStatus.ERROR, ModelPlugin.PLUGIN_ID, message, cause);
+
+ }
+
+ public static void rethrow(Throwable cause) throws CoreException {
+ if(cause instanceof XModelException) {
+ throw (XModelException)cause;
+ }
+ throw new XModelException(cause);
+ }
}
Show replies by date