Skip to main content
summaryrefslogtreecommitdiffstats
blob: a63157e399f1ee36fcafbb58c7a1593a55116a3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package org.eclipse.team.internal.ccvs.core;

/*
 * (c) Copyright IBM Corp. 2000, 2001.
 * All Rights Reserved.
 */

import java.io.IOException;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.team.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.connection.ResourceStatus;

/**
 * This is an exception that is thrown by the cvs-adaptor
 * for vcm
 * 
 * @see CoreExcpetion
 */

public class CVSException extends TeamException {
	
	public CVSException(
		int severity,
		int code,
		IPath path,
		String message,
		Throwable exception) {
		super(new ResourceStatus(severity, code, path, message, exception));
	}
	public CVSException(
		int severity,
		int code,
		IPath path,
		String message) {
		this(severity, code, path, message, null);
	}
	public CVSException(
		int severity,
		int code,
		IPath path,
		Throwable exception) {
		this(severity, code, path, null, exception);
	}
	public CVSException(
		int severity,
		int code,
		String message,
		Exception e) {
		super(new Status(severity, CVSProviderPlugin.ID, code, message, null));
	}
	public CVSException(
		int severity,
		int code,
		String message) {
		this(severity, code, message, null);
	}

	public CVSException(
		int severity,
		int code,
		Exception e) {
		super(new Status(severity, CVSProviderPlugin.ID, code, null, e));

	}

	public CVSException(String message) {
		super(new Status(IStatus.ERROR, CVSProviderPlugin.ID, UNABLE, message, null));
	}

	public CVSException(String message, IPath path) {
		this(message, path, null);
	}
	
	public CVSException(String message, Exception e) {
		this(IStatus.ERROR, UNABLE, message, e);
	}

	public CVSException(String message, IPath path, Throwable throwable) {
		this(new ResourceStatus(IStatus.ERROR, path, message, throwable));
	}
	public CVSException(IStatus status) {
		super(status);
	}
	
	/*
	 * Static helper methods for creating exceptions
	 */
	public static CVSException wrapException(IResource resource, String message,IOException e) {
		// NOTE: we should record the resource somehow
		// We should also inlcude the IO message
		return new CVSException(new Status(
				IStatus.ERROR,
				CVSProviderPlugin.ID,
				IO_FAILED,
				message,
				e));
	}
	/*
	 * Static helper methods for creating exceptions
	 */
	public static CVSException wrapException(IResource resource, String message, CoreException e) {
		return new CVSException(new Status(
				IStatus.ERROR,
				CVSProviderPlugin.ID,
				UNABLE,
				message,
				e));
	}
	/*
	 * Static helper methods for creating exceptions
	 */
	public static CVSException wrapException(Exception e) {
		return new CVSException(new Status(
				IStatus.ERROR,
				CVSProviderPlugin.ID,
				UNABLE,
				e.getMessage() != null ? e.getMessage() : "",  //$NON-NLS-1$
				e));
	}
}

Back to the top