[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tm-cvs-commit] moberhuber org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator VT100TerminalControl.java

Update of /cvsroot/tools/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator
In directory dev2:/tmp/cvs-serv23141/src/org/eclipse/tm/internal/terminal/emulator

Modified Files:
	VT100TerminalControl.java 
Log Message:
Bug 335021 - Middle mouse button copy/paste does not work with the terminal

Index: VT100TerminalControl.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** VT100TerminalControl.java	4 Dec 2008 19:37:11 -0000	1.27
--- VT100TerminalControl.java	25 Jan 2011 17:03:00 -0000	1.28
***************
*** 1,4 ****
  /*******************************************************************************
!  * Copyright (c) 2003, 2008 Wind River Systems, Inc. and others.
   * All rights reserved. This program and the accompanying materials
   * are made available under the terms of the Eclipse Public License v1.0
--- 1,4 ----
  /*******************************************************************************
!  * Copyright (c) 2003, 2011 Wind River Systems, Inc. and others.
   * All rights reserved. This program and the accompanying materials
   * are made available under the terms of the Eclipse Public License v1.0
***************
*** 26,29 ****
--- 26,30 ----
   * Martin Oberhuber (Wind River) - [240745] Pressing Ctrl+F1 in the Terminal should bring up context help
   * Michael Scharf (Wind River) - [240098] The cursor should not blink when the terminal is disconnected
+  * Anton Leherbauer (Wind River) - [335021] Middle mouse button copy/paste does not work with the terminal
   *******************************************************************************/
  package org.eclipse.tm.internal.terminal.emulator;
***************
*** 43,47 ****
--- 44,50 ----
  import org.eclipse.swt.SWT;
  import org.eclipse.swt.dnd.Clipboard;
+ import org.eclipse.swt.dnd.DND;
  import org.eclipse.swt.dnd.TextTransfer;
+ import org.eclipse.swt.dnd.Transfer;
  import org.eclipse.swt.events.FocusEvent;
  import org.eclipse.swt.events.FocusListener;
***************
*** 49,52 ****
--- 52,57 ----
  import org.eclipse.swt.events.KeyEvent;
  import org.eclipse.swt.events.KeyListener;
+ import org.eclipse.swt.events.MouseAdapter;
+ import org.eclipse.swt.events.MouseEvent;
  import org.eclipse.swt.graphics.Font;
  import org.eclipse.swt.layout.GridData;
***************
*** 174,178 ****
  	 */
  	public void copy() {
! 		getCtlText().copy();
  	}
  
--- 179,189 ----
  	 */
  	public void copy() {
! 		copy(DND.CLIPBOARD);
! 	}
! 
! 	private void copy(int clipboardType) {
! 		Object[] data = new Object[] { getSelection() };
! 		Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
! 		fClipboard.setContents(data, types, clipboardType);
  	}
  
***************
*** 181,187 ****
  	 */
  	public void paste() {
! 		TextTransfer textTransfer = TextTransfer.getInstance();
! 		String strText = (String) fClipboard.getContents(textTransfer);
! 		pasteString(strText);
  // TODO paste in another thread.... to avoid blocking
  //		new Thread() {
--- 192,196 ----
  	 */
  	public void paste() {
! 		paste(DND.CLIPBOARD);
  // TODO paste in another thread.... to avoid blocking
  //		new Thread() {
***************
*** 195,198 ****
--- 204,213 ----
  	}
  
+ 	private void paste(int clipboardType) {
+ 		TextTransfer textTransfer = TextTransfer.getInstance();
+ 		String strText = (String) fClipboard.getContents(textTransfer, clipboardType);
+ 		pasteString(strText);
+ 	}
+ 	
  	/**
  	 * @param strText the text to paste
***************
*** 585,589 ****
  			}
  		});
! 
  
  		fDisplay = getCtlText().getDisplay();
--- 600,611 ----
  			}
  		});
! 		fCtlText.addMouseListener(new MouseAdapter() {
! 			public void mouseUp(MouseEvent e) {
! 				// update selection used by middle mouse button paste
! 				if (e.button == 1 && getSelection().length() > 0) {
! 					copy(DND.SELECTION_CLIPBOARD);
! 				}
! 			}
! 		});
  
  		fDisplay = getCtlText().getDisplay();