1 11 package org.eclipse.team.internal.ccvs.core; 12 13 14 import java.io.IOException ; 15 import java.lang.reflect.InvocationTargetException ; 16 17 import org.eclipse.core.resources.IResource; 18 import org.eclipse.core.runtime.*; 19 import org.eclipse.team.core.TeamException; 20 21 30 public class CVSException extends TeamException { 31 32 private static final long serialVersionUID = 1L; 33 34 public CVSException(CoreException e) { 35 super(e); 36 } 37 38 public CVSException(String message) { 39 this(new CVSStatus(IStatus.ERROR, message)); 40 } 41 42 public CVSException(IStatus status) { 43 super(status); 44 } 45 46 49 public static CVSException wrapException(IResource resource, String message, IOException e) { 50 return new CVSException(new CVSStatus(IStatus.ERROR, IO_FAILED, message, e, resource)); 51 } 52 53 56 public static CVSException wrapException(IResource resource, String message, CoreException e) { 57 return new CVSException(new CVSStatus(IStatus.ERROR, e.getStatus().getCode(), message, e, resource)); 58 } 59 60 63 public static CVSException wrapException(Exception e) { 64 Throwable t = e; 65 if (e instanceof InvocationTargetException ) { 66 Throwable target = ((InvocationTargetException ) e).getTargetException(); 67 if (target instanceof CVSException) { 68 return (CVSException) target; 69 } 70 t = target; 71 } 72 return new CVSException(new CVSStatus(IStatus.ERROR, UNABLE, t.getMessage() != null ? t.getMessage() : "", t, (IResource)null)); } 76 77 public static CVSException wrapException(CoreException e) { 78 if (e instanceof CVSException) { 79 return (CVSException)e; 80 } 81 return new CVSException(e); 82 } 83 } 84 | Popular Tags |