KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > core > client > listeners > TagListener


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.team.internal.ccvs.core.client.listeners;
12
13  
14 import org.eclipse.core.runtime.IProgressMonitor;
15 import org.eclipse.core.runtime.IStatus;
16 import org.eclipse.team.internal.ccvs.core.CVSStatus;
17 import org.eclipse.team.internal.ccvs.core.ICVSFolder;
18 import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
19 import org.eclipse.team.internal.ccvs.core.client.CommandOutputListener;
20
21 public class TagListener extends CommandOutputListener {
22
23     /*
24      * @see ICommandOutputListener#messageLine(String, ICVSFolder, IProgressMonitor)
25      */

26     public IStatus messageLine(
27         String JavaDoc line,
28         ICVSRepositoryLocation location,
29         ICVSFolder commandRoot,
30         IProgressMonitor monitor) {
31         
32         // Received a warning in the form:
33
// W folder/file : v1 already exists on version 1.2 : NOT MOVING tag to version 1.3
34
// Indicate this as an error since no tagging was done
35
if(line.length() >= 2 && line.charAt(0) == 'W' && line.charAt(1) == ' ') {
36             return new CVSStatus(IStatus.ERROR, CVSStatus.TAG_ALREADY_EXISTS, line.substring(2), commandRoot);
37         }
38             
39         return OK;
40     }
41
42     /*
43      * @see ICommandOutputListener#errorLine(String, ICVSFolder, IProgressMonitor)
44      */

45     public IStatus errorLine(
46         String JavaDoc line,
47         ICVSRepositoryLocation location,
48         ICVSFolder commandRoot,
49         IProgressMonitor monitor) {
50             
51         // Ignore the lines: Tagging folder1/folder2
52
String JavaDoc serverMessage = getServerMessage(line, location);
53         if ((serverMessage != null) && serverMessage.startsWith("Tagging")) { //$NON-NLS-1$
54
return OK;
55         }
56         String JavaDoc rtagMessage = getServerRTagMessage(line, location);
57         if(rtagMessage != null && rtagMessage.startsWith("Tagging") ) { //$NON-NLS-1$
58
return OK;
59         }
60             
61         return super.errorLine(line, location, commandRoot, monitor);
62     }
63     
64 }
65
Popular Tags