Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2005, 2007 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
package org.eclipse.team.internal.ccvs.ui.operations;
import  org.eclipse.swt.dnd.*;
public class ClipboardDiffOperation extends DiffOperation {
	public ClipboardDiffOperation(IWorkbenchPart partResourceMapping[] mappingsLocalOption[] optionsboolean isMultiPatchboolean includeFullPathInformationIPath patchRoot) {
		super(partmappingsoptionsisMultiPatchincludeFullPathInformationpatchRoot);
	}
	public void execute(IProgressMonitor monitorthrows CVSExceptionInterruptedException {
	    super.execute(monitor);
	    
	    if (.size() == 0 ||
	    	(! && !)) {
            reportEmptyDiff();
        } else {
            copyToClipboard();
        }
     }
	 private void copyToClipboard(final ByteArrayOutputStream baos) {
        getShell().getDisplay().syncExec(new Runnable() {
        	public void run() {
        		TextTransfer plainTextTransfer = TextTransfer.getInstance();
        		Clipboard clipboard = new Clipboard(getShell().getDisplay());		
        		clipboard.setContents(
        			new String[]{baos.toString()}, 
        			new Transfer[]{plainTextTransfer});	
        		clipboard.dispose();
        	}
        });
	 }
	/* (non-Javadoc)
	 * @see org.eclipse.team.internal.ccvs.ui.operations.DiffOperation#openStream()
	 */
	protected PrintStream openStream() {
		return new PrintStream();
	}
New to GrepCode? Check out our FAQ X