Skip to main content
summaryrefslogtreecommitdiffstats
blob: 58281d8aedcff4b0791d8238589e494ba67df171 (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
/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.internal.ccvs.core.client.listeners;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.Policy;

/**
 * Instances of this interface can be passed to the <code>Command#execute</code> methods
 * and will receive notification when M or E messages are received from the server.
 */
public interface ICommandOutputListener {
	
	/*** Status to be returned when no error or warning occured ***/
	public static final IStatus OK = new CVSStatus(CVSStatus.OK, Policy.bind("ok")); //$NON-NLS-1$
	
	public static final String SERVER_PREFIX = "server: "; //$NON-NLS-1$
	public static final String SERVER_ABORTED_PREFIX = "[server aborted]: "; //$NON-NLS-1$
	public static final String RTAG_PREFIX = "rtag: "; //$NON-NLS-1$
	
	/**
	 * Invoked when a message line is received from the server.
	 * <p>
	 * Any status other than ICommandOutputListener.OK will be accumulated
	 * by the command and returned. The severity of the status matches those of
	 * IStatus and must indicate whether this is a warning, error, or informational 
	 * text.while the code should be one of the codes provided by CVSStatus.
	 * The status code must not be CVSStatus.SERVER_ERROR.
	 * </p>
	 * 
	 * @param line the line of message text sent by the server
	 * @param commandRoot the root directory of the command
	 * @param monitor the progress monitor
	 * @return a status indicating success or failure based on the text
	 */
	public IStatus messageLine(String line,
		ICVSRepositoryLocation location,
		ICVSFolder commandRoot,
		IProgressMonitor monitor);

	/**
	 * Invoked when an error line is received from the server.
	 * <p>
	 * Any status other than ICommandOutputListener.OK will be accumulated
	 * by the command and returned. The severity of the status matches those of
	 * IStatus and must indicate whether this is a warning, error, or informational 
	 * text.while the code should be one of the codes provided by CVSStatus.
	 * The status code must not be CVSStatus.SERVER_ERROR.
	 * </p>
	 * 
	 * @param line the line of error text sent by the server
	 * @param commandRoot the root directory of the command
	 * @param monitor the progress monitor
	 * @return a status indicating success or failure based on the text
	 */
	public IStatus errorLine(String line,
		ICVSRepositoryLocation location,
		ICVSFolder commandRoot,
		IProgressMonitor monitor);
}

Back to the top