Пример #1
0
  /**
   * Create the SSH connection to the remote target environment. First, {@link
   * #setConnectionParameters(org.eclipse.ptp.remotetools.environment.control.SSHTargetControl.SSHParameters)}
   * must be called.
   *
   * @param monitor progress monitor
   * @throws RemoteConnectionException
   */
  protected synchronized void connect(IProgressMonitor monitor) throws RemoteConnectionException {
    Assert.isNotNull(fAuthInfo, "missing ssh parameters"); // $NON-NLS-1$
    /*
     * Try to connect, else undo the connection.
     */

    if (remoteConnection == null) {
      remoteConnection = RemotetoolsPlugin.createSSHConnection();
    }
    try {
      remoteConnection.connect(
          fAuthInfo,
          fConfig.getConnectionAddress(),
          fConfig.getConnectionPort(),
          fConfig.getCipherType(),
          fConfig.getConnectionTimeout() * 1000,
          monitor);
    } catch (RemoteConnectionException e) {
      disconnect();
      throw e;
    }
  }