|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2003, 2008 Wind River Systems, Inc. and others. |
2 |
* Copyright (c) 2003, 2011 Wind River Systems, Inc. and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 25-30
Link Here
|
| 25 |
* Michael Scharf (Wind River) - [237398] Terminal get Invalid Thread Access when the title is set |
25 |
* Michael Scharf (Wind River) - [237398] Terminal get Invalid Thread Access when the title is set |
| 26 |
* Martin Oberhuber (Wind River) - [240745] Pressing Ctrl+F1 in the Terminal should bring up context help |
26 |
* Martin Oberhuber (Wind River) - [240745] Pressing Ctrl+F1 in the Terminal should bring up context help |
| 27 |
* Michael Scharf (Wind River) - [240098] The cursor should not blink when the terminal is disconnected |
27 |
* Michael Scharf (Wind River) - [240098] The cursor should not blink when the terminal is disconnected |
|
|
28 |
* Anton Leherbauer (Wind River) - [335021] Middle mouse button copy/paste does not work with the terminal |
| 28 |
*******************************************************************************/ |
29 |
*******************************************************************************/ |
| 29 |
package org.eclipse.tm.internal.terminal.emulator; |
30 |
package org.eclipse.tm.internal.terminal.emulator; |
| 30 |
|
31 |
|
|
Lines 42-53
Link Here
|
| 42 |
import org.eclipse.osgi.util.NLS; |
43 |
import org.eclipse.osgi.util.NLS; |
| 43 |
import org.eclipse.swt.SWT; |
44 |
import org.eclipse.swt.SWT; |
| 44 |
import org.eclipse.swt.dnd.Clipboard; |
45 |
import org.eclipse.swt.dnd.Clipboard; |
|
|
46 |
import org.eclipse.swt.dnd.DND; |
| 45 |
import org.eclipse.swt.dnd.TextTransfer; |
47 |
import org.eclipse.swt.dnd.TextTransfer; |
|
|
48 |
import org.eclipse.swt.dnd.Transfer; |
| 46 |
import org.eclipse.swt.events.FocusEvent; |
49 |
import org.eclipse.swt.events.FocusEvent; |
| 47 |
import org.eclipse.swt.events.FocusListener; |
50 |
import org.eclipse.swt.events.FocusListener; |
| 48 |
import org.eclipse.swt.events.KeyAdapter; |
51 |
import org.eclipse.swt.events.KeyAdapter; |
| 49 |
import org.eclipse.swt.events.KeyEvent; |
52 |
import org.eclipse.swt.events.KeyEvent; |
| 50 |
import org.eclipse.swt.events.KeyListener; |
53 |
import org.eclipse.swt.events.KeyListener; |
|
|
54 |
import org.eclipse.swt.events.MouseAdapter; |
| 55 |
import org.eclipse.swt.events.MouseEvent; |
| 51 |
import org.eclipse.swt.graphics.Font; |
56 |
import org.eclipse.swt.graphics.Font; |
| 52 |
import org.eclipse.swt.layout.GridData; |
57 |
import org.eclipse.swt.layout.GridData; |
| 53 |
import org.eclipse.swt.layout.GridLayout; |
58 |
import org.eclipse.swt.layout.GridLayout; |
|
Lines 173-188
Link Here
|
| 173 |
* @see org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl#copy() |
178 |
* @see org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl#copy() |
| 174 |
*/ |
179 |
*/ |
| 175 |
public void copy() { |
180 |
public void copy() { |
| 176 |
getCtlText().copy(); |
181 |
copy(DND.CLIPBOARD); |
|
|
182 |
} |
| 183 |
|
| 184 |
private void copy(int clipboardType) { |
| 185 |
Object[] data = new Object[] { getSelection() }; |
| 186 |
Transfer[] types = new Transfer[] { TextTransfer.getInstance() }; |
| 187 |
fClipboard.setContents(data, types, clipboardType); |
| 177 |
} |
188 |
} |
| 178 |
|
189 |
|
| 179 |
/* (non-Javadoc) |
190 |
/* (non-Javadoc) |
| 180 |
* @see org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl#paste() |
191 |
* @see org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl#paste() |
| 181 |
*/ |
192 |
*/ |
| 182 |
public void paste() { |
193 |
public void paste() { |
| 183 |
TextTransfer textTransfer = TextTransfer.getInstance(); |
194 |
paste(DND.CLIPBOARD); |
| 184 |
String strText = (String) fClipboard.getContents(textTransfer); |
|
|
| 185 |
pasteString(strText); |
| 186 |
// TODO paste in another thread.... to avoid blocking |
195 |
// TODO paste in another thread.... to avoid blocking |
| 187 |
// new Thread() { |
196 |
// new Thread() { |
| 188 |
// public void run() { |
197 |
// public void run() { |
|
Lines 194-199
Link Here
|
| 194 |
// }.start(); |
203 |
// }.start(); |
| 195 |
} |
204 |
} |
| 196 |
|
205 |
|
|
|
206 |
private void paste(int clipboardType) { |
| 207 |
TextTransfer textTransfer = TextTransfer.getInstance(); |
| 208 |
String strText = (String) fClipboard.getContents(textTransfer, clipboardType); |
| 209 |
pasteString(strText); |
| 210 |
} |
| 211 |
|
| 197 |
/** |
212 |
/** |
| 198 |
* @param strText the text to paste |
213 |
* @param strText the text to paste |
| 199 |
*/ |
214 |
*/ |
|
Lines 584-590
Link Here
|
| 584 |
fTerminalText.setDimensions(lines, columns); |
599 |
fTerminalText.setDimensions(lines, columns); |
| 585 |
} |
600 |
} |
| 586 |
}); |
601 |
}); |
| 587 |
|
602 |
fCtlText.addMouseListener(new MouseAdapter() { |
|
|
603 |
public void mouseUp(MouseEvent e) { |
| 604 |
// update selection used by middle mouse button paste |
| 605 |
if (e.button == 1 && getSelection().length() > 0) { |
| 606 |
copy(DND.SELECTION_CLIPBOARD); |
| 607 |
} |
| 608 |
} |
| 609 |
}); |
| 588 |
|
610 |
|
| 589 |
fDisplay = getCtlText().getDisplay(); |
611 |
fDisplay = getCtlText().getDisplay(); |
| 590 |
fClipboard = new Clipboard(fDisplay); |
612 |
fClipboard = new Clipboard(fDisplay); |