diff options
Diffstat (limited to 'bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/TemplateHandler.java')
-rw-r--r-- | bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/TemplateHandler.java | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/TemplateHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/TemplateHandler.java deleted file mode 100644 index 4469a4103..000000000 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/TemplateHandler.java +++ /dev/null @@ -1,108 +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 java.io.*; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.team.internal.ccvs.core.*; -import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; -import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter; - -/** - * @author Administrator - * - * To change this generated comment edit the template variable "typecomment": - * Window>Preferences>Java>Templates. - * To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -public class TemplateHandler extends ResponseHandler { - - /** - * @see org.eclipse.team.internal.ccvs.core.client.ResponseHandler#getResponseID() - */ - public String getResponseID() { - return "Template"; //$NON-NLS-1$ - } - - /** - * @see org.eclipse.team.internal.ccvs.core.client.ResponseHandler#handle(org.eclipse.team.internal.ccvs.core.client.Session, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) - */ - public void handle(Session session, String localDir, IProgressMonitor monitor) throws CVSException { - session.readLine(); /* read the remote dir which is not needed */ - ICVSFolder localFolder = getExistingFolder(session, localDir); - IContainer container = (IContainer)localFolder.getIResource(); - ICVSStorage templateFile = null; - if (container != null) { - try { - templateFile = CVSWorkspaceRoot.getCVSFileFor(SyncFileWriter.getTemplateFile(container)); - } catch (CVSException e) { - // Log the inability to create the template file - CVSProviderPlugin.log(new CVSStatus(IStatus.ERROR, "Could not write template file in " + container.getFullPath() + ": " + e.getMessage(), e)); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - if (container == null || templateFile == null) { - // Create a dummy storage handle to recieve the contents from the server - templateFile = new ICVSStorage() { - public String getName() { - return "Template"; //$NON-NLS-1$ - } - public void setContents( - InputStream stream, - int responseType, - boolean keepLocalHistory, - IProgressMonitor monitor) - throws CVSException { - - try { - // Transfer the contents - OutputStream out = new ByteArrayOutputStream(); - try { - byte[] buffer = new byte[1024]; - int read; - while ((read = stream.read(buffer)) >= 0) { - Policy.checkCanceled(monitor); - out.write(buffer, 0, read); - } - } finally { - out.close(); - } - } catch (IOException e) { - throw CVSException.wrapException(e); //$NON-NLS-1$ - } finally { - try { - stream.close(); - } catch (IOException e1) { - // Ignore close errors - } - } - } - public long getSize() { - return 0; - } - public InputStream getContents() throws CVSException { - return new ByteArrayInputStream(new byte[0]); - } - }; - } - try { - session.receiveFile(templateFile, false, UpdatedHandler.HANDLE_UPDATED, monitor); - } catch (CVSException e) { - if (!(templateFile instanceof ICVSFile && handleInvalidResourceName(session, (ICVSFile)templateFile, e))) { - throw e; - } - } - } - -} |