mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 16:55:38 +02:00
initial version
This commit is contained in:
parent
560621cc1d
commit
9cf56ceee9
12 changed files with 609 additions and 0 deletions
7
terminal/org.eclipse.tm.terminal.ssh/.classpath
Normal file
7
terminal/org.eclipse.tm.terminal.ssh/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
34
terminal/org.eclipse.tm.terminal.ssh/.project
Normal file
34
terminal/org.eclipse.tm.terminal.ssh/.project
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.eclipse.tm.terminal.ssh</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>net.sourceforge.metrics.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>net.sourceforge.metrics.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
12
terminal/org.eclipse.tm.terminal.ssh/META-INF/MANIFEST.MF
Normal file
12
terminal/org.eclipse.tm.terminal.ssh/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,12 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Terminal ssh
|
||||
Bundle-SymbolicName: org.eclipse.tm.terminal.ssh;singleton:=true
|
||||
Bundle-Version: 0.0.9
|
||||
Bundle-Vendor: Eclipse.org
|
||||
Bundle-Localization: plugin
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
org.eclipse.tm.terminal,
|
||||
com.jcraft.jsch
|
||||
Eclipse-LazyStart: false
|
5
terminal/org.eclipse.tm.terminal.ssh/build.properties
Normal file
5
terminal/org.eclipse.tm.terminal.ssh/build.properties
Normal file
|
@ -0,0 +1,5 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
9
terminal/org.eclipse.tm.terminal.ssh/plugin.xml
Normal file
9
terminal/org.eclipse.tm.terminal.ssh/plugin.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.2"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="org.eclipse.tm.terminal.terminalConnector">
|
||||
<connector class="org.eclipse.tm.terminal.ssh.SshConnector"/>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
|
@ -0,0 +1,25 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 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
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Michael Scharf (Wind River) - initial implementation
|
||||
*
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.terminal.ssh;
|
||||
|
||||
import org.eclipse.tm.terminal.ISettingsStore;
|
||||
|
||||
public interface ISshSettings {
|
||||
String getHost();
|
||||
String getUser();
|
||||
String getPassword();
|
||||
int getTimeout();
|
||||
int getPort();
|
||||
String getStatusString(String strConnected);
|
||||
void load(ISettingsStore store);
|
||||
void save(ISettingsStore store);
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 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
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Michael Scharf (Wind River) - initial implementation
|
||||
*
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.terminal.ssh;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PipedInputStream;
|
||||
import java.io.PipedOutputStream;
|
||||
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.tm.terminal.ITerminalControl;
|
||||
import org.eclipse.tm.terminal.Logger;
|
||||
import org.eclipse.tm.terminal.TerminalState;
|
||||
|
||||
import com.jcraft.jsch.ChannelShell;
|
||||
import com.jcraft.jsch.JSchException;
|
||||
import com.jcraft.jsch.Session;
|
||||
import com.jcraft.jsch.UserInfo;
|
||||
|
||||
class SshConnection extends Thread {
|
||||
private final ITerminalControl fControl;
|
||||
private final SshConnector fConn;
|
||||
protected SshConnection(SshConnector conn,ITerminalControl control) {
|
||||
fControl = control;
|
||||
fConn = conn;
|
||||
fControl.setState(TerminalState.CONNECTING);
|
||||
}
|
||||
public void run() {
|
||||
try {
|
||||
int nTimeout = fConn.getTelnetSettings().getTimeout() * 1000;
|
||||
String host = fConn.getTelnetSettings().getHost();
|
||||
String user = fConn.getTelnetSettings().getUser();
|
||||
int port=fConn.getTelnetSettings().getPort();
|
||||
Session session=fConn.getJsch().getSession(user, host, port);
|
||||
//session.setPassword("your password");
|
||||
|
||||
// username and password will be given via UserInfo interface.
|
||||
UserInfo ui=new MyUserInfo(fConn.getTelnetSettings().getPassword());
|
||||
session.setUserInfo(ui);
|
||||
|
||||
// java.util.Hashtable config=new java.util.Hashtable();
|
||||
// config.put("StrictHostKeyChecking", "no");
|
||||
// session.setConfig(config);
|
||||
|
||||
//session.connect();
|
||||
session.connect(nTimeout); // making connection with timeout.
|
||||
|
||||
ChannelShell channel=(ChannelShell) session.openChannel("shell");
|
||||
|
||||
//hmm, now it gets a bit complicated
|
||||
// Input and output streams are somehow confusing
|
||||
PipedInputStream pin = new PipedInputStream();
|
||||
PipedOutputStream out = new PipedOutputStream(pin);
|
||||
|
||||
PipedOutputStream pout = new PipedOutputStream();
|
||||
PipedInputStream in = new PipedInputStream(pout);
|
||||
|
||||
|
||||
channel.setInputStream(pin);
|
||||
channel.setOutputStream(pout);
|
||||
channel.connect();
|
||||
|
||||
fConn.setInputStream(in);
|
||||
fConn.setOutputStream(out);
|
||||
fConn.setChannel(channel);
|
||||
fControl.setState(TerminalState.CONNECTED);
|
||||
// read data until the connection gets terminated
|
||||
readDataForever(in);
|
||||
} catch (JSchException e) {
|
||||
connectFailed(e.getMessage(),e.getMessage());
|
||||
} catch (IOException e) {
|
||||
connectFailed(e.getMessage(),e.getMessage());
|
||||
} finally {
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Read the data from the ssh connection and display it in the terminal.
|
||||
* @param in
|
||||
* @throws IOException
|
||||
*/
|
||||
private void readDataForever(InputStream in) throws IOException {
|
||||
// read the data
|
||||
byte bytes[]=new byte[32*1024];
|
||||
int n;
|
||||
while((n=in.read(bytes))!=-1) {
|
||||
fControl.writeToTerminal(new String(bytes,0,n));
|
||||
}
|
||||
fControl.setState(TerminalState.CLOSED);
|
||||
}
|
||||
|
||||
private static class MyUserInfo implements UserInfo {
|
||||
private String fPassword;
|
||||
|
||||
public MyUserInfo(String password) {
|
||||
fPassword = password;
|
||||
}
|
||||
public String getPassword() {
|
||||
return fPassword;
|
||||
}
|
||||
public boolean promptYesNo(final String str) {
|
||||
//need to switch to UI thread for prompting
|
||||
final boolean[] retval = new boolean[1];
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
public void run() {
|
||||
retval[0] = MessageDialog.openQuestion(null, SshMessages.WARNING, str);
|
||||
}
|
||||
});
|
||||
return retval[0];
|
||||
}
|
||||
public String getPassphrase() {
|
||||
return null;
|
||||
}
|
||||
public boolean promptPassphrase(String message) {
|
||||
return true;
|
||||
}
|
||||
public boolean promptPassword(final String message) {
|
||||
return true;
|
||||
}
|
||||
public void showMessage(final String message) {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
public void run() {
|
||||
MessageDialog.openInformation(null, SshMessages.INFO, message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
private void connectFailed(String terminalText, String msg) {
|
||||
Logger.log(terminalText);
|
||||
fControl.displayTextInTerminal(terminalText);
|
||||
fControl.setState(TerminalState.CLOSED);
|
||||
fControl.setMsg(msg);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 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
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Michael Scharf (Wind River) - initial implementation
|
||||
*
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.terminal.ssh;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.eclipse.tm.terminal.ISettingsPage;
|
||||
import org.eclipse.tm.terminal.ISettingsStore;
|
||||
import org.eclipse.tm.terminal.ITerminalConnector;
|
||||
import org.eclipse.tm.terminal.ITerminalControl;
|
||||
import org.eclipse.tm.terminal.Logger;
|
||||
import org.eclipse.tm.terminal.TerminalState;
|
||||
|
||||
import com.jcraft.jsch.ChannelShell;
|
||||
import com.jcraft.jsch.JSch;
|
||||
|
||||
public class SshConnector implements ITerminalConnector {
|
||||
private OutputStream fOutputStream;
|
||||
private InputStream fInputStream;
|
||||
private ITerminalControl fControl;
|
||||
private JSch fJsch;
|
||||
private ChannelShell fChannel;
|
||||
|
||||
private final SshSettings fSettings;
|
||||
public SshConnector() {
|
||||
this(new SshSettings());
|
||||
try {
|
||||
fJsch=new JSch();
|
||||
} catch(NoClassDefFoundError e) {
|
||||
// ignore
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public SshConnector(SshSettings settings) {
|
||||
fSettings=settings;
|
||||
}
|
||||
public String getId() {
|
||||
return getClass().getName();
|
||||
}
|
||||
public boolean isInstalled() {
|
||||
return fJsch!=null;
|
||||
}
|
||||
public void connect(ITerminalControl control) {
|
||||
Logger.log("entered."); //$NON-NLS-1$
|
||||
fControl=control;
|
||||
SshConnection worker = new SshConnection(this,control);
|
||||
worker.start();
|
||||
}
|
||||
public void disconnect() {
|
||||
Logger.log("entered."); //$NON-NLS-1$
|
||||
|
||||
if (getInputStream() != null) {
|
||||
try {
|
||||
getInputStream().close();
|
||||
} catch (Exception exception) {
|
||||
Logger.logException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
if (getOutputStream() != null) {
|
||||
try {
|
||||
getOutputStream().close();
|
||||
} catch (Exception exception) {
|
||||
Logger.logException(exception);
|
||||
}
|
||||
}
|
||||
setState(TerminalState.CLOSED);
|
||||
}
|
||||
public boolean isLocalEcho() {
|
||||
return false;
|
||||
}
|
||||
public void setTerminalSize(int newWidth, int newHeight) {
|
||||
if(fChannel!=null)
|
||||
fChannel.setPtySize(newWidth, newHeight, 8, 8);
|
||||
|
||||
}
|
||||
public InputStream getInputStream() {
|
||||
return fInputStream;
|
||||
}
|
||||
public OutputStream getOutputStream() {
|
||||
return fOutputStream;
|
||||
}
|
||||
void setInputStream(InputStream inputStream) {
|
||||
fInputStream = inputStream;
|
||||
}
|
||||
void setOutputStream(OutputStream outputStream) {
|
||||
fOutputStream = outputStream;
|
||||
}
|
||||
public void writeToTerminal(String txt) {
|
||||
fControl.writeToTerminal(txt);
|
||||
|
||||
}
|
||||
public void setState(TerminalState state) {
|
||||
fControl.setState(state);
|
||||
|
||||
}
|
||||
public ISshSettings getTelnetSettings() {
|
||||
return fSettings;
|
||||
}
|
||||
public ISettingsPage makeSettingsPage() {
|
||||
return new SshSettingsPage(fSettings);
|
||||
}
|
||||
public String getStatusString(String strConnected) {
|
||||
return fSettings.getStatusString(strConnected);
|
||||
}
|
||||
public void load(ISettingsStore store) {
|
||||
fSettings.load(store);
|
||||
|
||||
}
|
||||
public void save(ISettingsStore store) {
|
||||
fSettings.save(store);
|
||||
}
|
||||
protected JSch getJsch() {
|
||||
return fJsch;
|
||||
}
|
||||
ChannelShell getChannel() {
|
||||
return fChannel;
|
||||
}
|
||||
void setChannel(ChannelShell channel) {
|
||||
fChannel = channel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 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
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Michael Scharf (Wind River) - initial implementation
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.tm.terminal.ssh;
|
||||
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
public class SshMessages extends NLS {
|
||||
static {
|
||||
NLS.initializeMessages(SshMessages.class.getName(), SshMessages.class);
|
||||
}
|
||||
public static String CONNTYPE;
|
||||
public static String USER;
|
||||
public static String HOST;
|
||||
public static String PORT;
|
||||
public static String PASSWORD;
|
||||
public static String TIMEOUT;
|
||||
public static String WARNING;
|
||||
public static String INFO;
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2006 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
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# Wind River Systems, Inc. - initial implementation
|
||||
#
|
||||
###############################################################################
|
||||
CONNTYPE = SSH
|
||||
HOST = Host
|
||||
USER = User
|
||||
PORT = Port
|
||||
PASSWORD = Password
|
||||
TIMEOUT = Timeout
|
||||
WARNING = Warning
|
||||
INFO = Info
|
|
@ -0,0 +1,98 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 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
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Michael Scharf (Wind River) - initial implementation
|
||||
*
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.terminal.ssh;
|
||||
|
||||
import org.eclipse.tm.terminal.ISettingsStore;
|
||||
|
||||
public class SshSettings implements ISshSettings {
|
||||
protected String fHost;
|
||||
protected String fUser;
|
||||
protected String fPassword;
|
||||
protected String fPort;
|
||||
protected String fTimeout;
|
||||
public String getHost() {
|
||||
return fHost;
|
||||
}
|
||||
|
||||
public void setHost(String strHost) {
|
||||
fHost = strHost;
|
||||
}
|
||||
|
||||
public String getStatusString(String strConnected) {
|
||||
return " (" + //$NON-NLS-1$
|
||||
getHost() + ":" + //$NON-NLS-1$
|
||||
getUser() + " - " + //$NON-NLS-1$
|
||||
strConnected + ")"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public void load(ISettingsStore store) {
|
||||
fHost = store.get("Host");//$NON-NLS-1$
|
||||
fUser = store.get("User");//$NON-NLS-1$
|
||||
fPort = store.get("Port");//$NON-NLS-1$
|
||||
fTimeout = store.get("Timeout");//$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
public void save(ISettingsStore store) {
|
||||
store.put("Host", fHost);//$NON-NLS-1$
|
||||
store.put("User", fUser);//$NON-NLS-1$
|
||||
store.put("Port", fPort);//$NON-NLS-1$
|
||||
store.put("Timeout", fTimeout);//$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
public int getTimeout() {
|
||||
try {
|
||||
return Integer.parseInt(fTimeout);
|
||||
} catch (NumberFormatException numberFormatException) {
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
public String getTimeoutString() {
|
||||
return fTimeout;
|
||||
}
|
||||
|
||||
public void setTimeout(String timeout) {
|
||||
fTimeout = timeout;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return fUser;
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
fUser = user;
|
||||
}
|
||||
public int getPort() {
|
||||
try {
|
||||
return Integer.parseInt(fPort);
|
||||
} catch (NumberFormatException numberFormatException) {
|
||||
return 22;
|
||||
}
|
||||
}
|
||||
|
||||
public String getPortString() {
|
||||
return fPort;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
fPort = port;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return fPassword;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
fPassword = password;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 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
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Michael Scharf (Wind River) - initial implementation
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.tm.terminal.ssh;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.tm.terminal.ISettingsPage;
|
||||
|
||||
public class SshSettingsPage implements ISettingsPage {
|
||||
private Text fHostText;
|
||||
private Text fUser;
|
||||
private Text fTimeout;
|
||||
private final SshSettings fTerminalSettings;
|
||||
private Text fPort;
|
||||
private Text fPassword;
|
||||
|
||||
public SshSettingsPage(SshSettings settings) {
|
||||
fTerminalSettings=settings;
|
||||
}
|
||||
public void saveSettings() {
|
||||
fTerminalSettings.setHost(fHostText.getText());
|
||||
fTerminalSettings.setUser(fUser.getText());
|
||||
fTerminalSettings.setPassword(fPassword.getText());
|
||||
fTerminalSettings.setPort(fPort.getText());
|
||||
fTerminalSettings.setTimeout(fTimeout.getText());
|
||||
}
|
||||
|
||||
public void loadSettings() {
|
||||
if(fTerminalSettings!=null) {
|
||||
fHostText.setText(get(fTerminalSettings.getHost(),""));//$NON-NLS-1$
|
||||
fTimeout.setText(get(fTerminalSettings.getTimeoutString(),"0"));//$NON-NLS-1$
|
||||
fUser.setText(get(fTerminalSettings.getUser(),""));//$NON-NLS-1$
|
||||
fPort.setText(get(fTerminalSettings.getPortString(),"22"));//$NON-NLS-1$
|
||||
fPassword.setText(get(fTerminalSettings.getPassword(),""));//$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
String get(String value, String def) {
|
||||
if(value==null || value.length()==0)
|
||||
return def;
|
||||
return value;
|
||||
}
|
||||
public boolean validateSettings() {
|
||||
return true;
|
||||
}
|
||||
public void createControl(Composite parent) {
|
||||
Composite composite = new Composite(parent, SWT.NONE);
|
||||
GridLayout gridLayout = new GridLayout(2, false);
|
||||
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
|
||||
|
||||
composite.setLayout(gridLayout);
|
||||
composite.setLayoutData(gridData);
|
||||
|
||||
fHostText = createTextField(composite, SshMessages.HOST);
|
||||
fUser = createTextField(composite, SshMessages.USER);
|
||||
fPassword = createTextField(composite, SshMessages.PASSWORD,SWT.PASSWORD);
|
||||
fTimeout = createTextField(composite, SshMessages.TIMEOUT);
|
||||
fPort = createTextField(composite, SshMessages.PORT);
|
||||
loadSettings();
|
||||
}
|
||||
private Text createTextField(Composite composite, String labelTxt, int textOptions) {
|
||||
GridData gridData;
|
||||
// Add label
|
||||
Label ctlLabel = new Label(composite, SWT.RIGHT);
|
||||
ctlLabel.setText(labelTxt + ":"); //$NON-NLS-1$
|
||||
|
||||
// Add control
|
||||
gridData = new GridData(GridData.FILL_HORIZONTAL);
|
||||
Text text= new Text(composite, SWT.BORDER | textOptions);
|
||||
text.setLayoutData(gridData);
|
||||
return text;
|
||||
}
|
||||
private Text createTextField(Composite composite, String labelTxt) {
|
||||
return createTextField(composite, labelTxt, 0);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return SshMessages.CONNTYPE;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue