diff options
Diffstat (limited to 'bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/MTHandler.java')
-rw-r--r-- | bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/MTHandler.java | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/MTHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/MTHandler.java deleted file mode 100644 index 6e7f20fc3..000000000 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/MTHandler.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * 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; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.internal.ccvs.core.CVSException; - -public class MTHandler extends ResponseHandler { - - private String nextLine; - private boolean isLineAvailable; - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ccvs.core.client.ResponseHandler#getInstance() - */ - ResponseHandler getInstance() { - return new MTHandler(); - } - - /** - * @see ResponseHandler#getResponseID() - */ - public String getResponseID() { - return "MT"; //$NON-NLS-1$ - } - - /** - * @see ResponseHandler#handle(Session, String, IProgressMonitor) - */ - public void handle(Session session, String argument, IProgressMonitor monitor) - throws CVSException { - - // If there was a line available from before, clear it - if (isLineAvailable()) { - startNextLine(); - } - - if (argument.charAt(0) == '+') { - // Reset any previously accumulated text - startNextLine(); - } else if (argument.charAt(0) == '-') { - // Mark the line as available in case there was no trailing newline - if (nextLine != null) { - isLineAvailable = true; - } - } else { - // Extract the tag and text from the line - String tag; - String text; - int spaceIndex = argument.indexOf(' '); - if (spaceIndex == -1) { - tag = argument; - text = null; - } else { - tag = argument.substring(0, spaceIndex); - text = argument.substring(spaceIndex + 1); - } - - // Accumulate the line and indicate if its available for use - if (tag.equals("newline")) { //$NON-NLS-1$ - isLineAvailable = true; - } else if (text != null) { - // Reset the previous line if required - if (isLineAvailable()) { - startNextLine(); - } - // Accumulate the line - if (nextLine == null) { - nextLine = text; - } else { - // The text from the sevrver contains spaces when appropriate so just append - nextLine = nextLine + text; - } - } - } - } - - /** - * Check if there is a line available. If there is, it should be fetched with - * getLine() immediatly before the next MT response is processed. - */ - public boolean isLineAvailable() { - return isLineAvailable; - } - - /** - * Get the available line. This purges the line from the handler - */ - public String getLine() { - return nextLine; - } - - private void startNextLine() { - isLineAvailable = false; - nextLine = null; - } -} |