1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-26 10:25:32 +02:00

Re-expose setupTerminal in ITerminlaControl. Needed to move a terminal control between different parents

This commit is contained in:
Uwe Stieber 2012-02-07 07:32:42 +00:00
parent be3bf84586
commit 31b445ff17
4 changed files with 21 additions and 7 deletions

View file

@ -74,6 +74,8 @@ public class TerminalConnectorFactoryTest extends TestCase {
public void setTerminalTitle(String title) { public void setTerminalTitle(String title) {
} }
public void setupTerminal(Composite parent) {
}
} }
static class ConnectorMock extends TerminalConnectorImpl { static class ConnectorMock extends TerminalConnectorImpl {

View file

@ -74,6 +74,8 @@ public class TerminalConnectorTest extends TestCase {
public void setTerminalTitle(String title) { public void setTerminalTitle(String title) {
} }
public void setupTerminal(Composite parent) {
}
} }
static class ConnectorMock extends TerminalConnectorImpl { static class ConnectorMock extends TerminalConnectorImpl {

View file

@ -39,6 +39,7 @@ import java.io.OutputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.SocketException; import java.net.SocketException;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
@ -212,7 +213,7 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
String strText = (String) fClipboard.getContents(textTransfer, clipboardType); String strText = (String) fClipboard.getContents(textTransfer, clipboardType);
pasteString(strText); pasteString(strText);
} }
/** /**
* @param strText the text to paste * @param strText the text to paste
*/ */
@ -355,7 +356,7 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
getTerminalConnector().disconnect(); getTerminalConnector().disconnect();
} }
} }
//Ensure that a new Job can be started; then clean up old Job. //Ensure that a new Job can be started; then clean up old Job.
Job job; Job job;
synchronized(this) { synchronized(this) {
@ -545,9 +546,10 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl#setupTerminal() * @see org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl#setupTerminal(org.eclipse.swt.widgets.Composite)
*/ */
public void setupTerminal(Composite parent) { public void setupTerminal(Composite parent) {
Assert.isNotNull(parent);
fState=TerminalState.CLOSED; fState=TerminalState.CLOSED;
setupControls(parent); setupControls(parent);
setupListeners(); setupListeners();
@ -781,9 +783,9 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
event.doit = true; event.doit = true;
return; return;
} }
// Manage the Del key // Manage the Del key
if (event.keyCode == 0x000007f) if (event.keyCode == 0x000007f)
{ {
sendString("\u001b[3~"); //$NON-NLS-1$ sendString("\u001b[3~"); //$NON-NLS-1$
return; return;
@ -838,11 +840,11 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
case 0x1000008: // End key. case 0x1000008: // End key.
sendString("\u001b[F"); //$NON-NLS-1$ sendString("\u001b[F"); //$NON-NLS-1$
break; break;
case 0x1000009: // Insert. case 0x1000009: // Insert.
sendString("\u001b[2~"); //$NON-NLS-1$ sendString("\u001b[2~"); //$NON-NLS-1$
break; break;
case 0x100000a: // F1 key. case 0x100000a: // F1 key.
if ( (event.stateMask & SWT.CTRL)!=0 ) { if ( (event.stateMask & SWT.CTRL)!=0 ) {
//Allow Ctrl+F1 to act locally as well as on the remote, because it is //Allow Ctrl+F1 to act locally as well as on the remote, because it is

View file

@ -16,6 +16,7 @@ package org.eclipse.tm.internal.terminal.provisional.api;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
/** /**
@ -43,6 +44,13 @@ public interface ITerminalControl {
*/ */
void setState(TerminalState state); void setState(TerminalState state);
/**
* Setup the terminal control within the given parent composite.
*
* @param parent The parent composite. Must not be <code>null</code>.
*/
void setupTerminal(Composite parent);
/** /**
* A shell to show dialogs. * A shell to show dialogs.
* @return the shell in which the terminal is shown. * @return the shell in which the terminal is shown.