PTP
Release 7.0

org.eclipse.ptp.remote.ui.widgets
Class RemoteConnectionWidget

java.lang.Object
  extended by Composite
      extended by org.eclipse.ptp.remote.ui.widgets.RemoteConnectionWidget

public class RemoteConnectionWidget
extends Composite

Widget to allow the user to select a service provider and connection. Provides a "New" button to create a new connection. If title is supplied then the widget will be placed in a group.

Since:
5.0

Nested Class Summary
protected  class RemoteConnectionWidget.WidgetListener
          Listener for widget selected events.
 
Field Summary
static int FLAG_FORCE_PROVIDER_SELECTION
          Force the use of a remote provider dialog, regardless of the PRE_REMOTE_SERVICES_ID preference setting.
static int FLAG_NO_LOCAL_SELECTION
          Do not provide a selection for local services.
 
Constructor Summary
RemoteConnectionWidget(Composite parent, int style, String title, int flags, IRunnableContext context)
          Constructor
 
Method Summary
 void addSelectionListener(SelectionListener listener)
          Adds the listener to the collection of listeners who will be notified when the user changes the receiver's selection, by sending it one of the messages defined in the SelectionListener interface.
 Button getButton()
          Get the new button from the widget
 IRemoteConnection getConnection()
          Get the connection that is currently selected in the widget, or null if there is no selected connection.
protected  IRemoteConnectionManager getRemoteConnectionManager(IRemoteServices services)
           
protected  IRemoteServices getRemoteServices(String id)
           
protected  void handleConnectionSelected()
          Handle the section of a new connection.
protected  void handleNewRemoteConnectionSelected()
          Handle creation of a new connection by pressing the 'New...' button.
protected  void handleRemoteServiceSelected(IRemoteConnection conn)
          Handle selection of a new remote services provider from the remote services combo.
protected  void initializeRemoteServicesCombo(String id)
          Initialize the contents of the remote services combo.
 boolean isEnabled()
           
 void removeSelectionListener(SelectionListener listener)
          Remove a listener that will be notified when one of the widget's controls are selected
 void setConnection(IRemoteConnection connection)
          Set the connection that should be selected in the widget.
 void setConnection(String id, String name)
          Set the connection that should be selected in the widget.
 void setEnabled(boolean enabled)
           
 void setHints(String[] attrHints, String[] attrHintValues)
          Set hints to use when creating a new connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLAG_FORCE_PROVIDER_SELECTION

public static int FLAG_FORCE_PROVIDER_SELECTION
Force the use of a remote provider dialog, regardless of the PRE_REMOTE_SERVICES_ID preference setting.

Since:
7.0

FLAG_NO_LOCAL_SELECTION

public static int FLAG_NO_LOCAL_SELECTION
Do not provide a selection for local services.

Since:
7.0
Constructor Detail

RemoteConnectionWidget

public RemoteConnectionWidget(Composite parent,
                              int style,
                              String title,
                              int flags,
                              IRunnableContext context)
Constructor

Parameters:
parent - parent composite
style - style or SWT.NONE
title - if a title is supplied then the widget will be placed in a group. Can be null.
flags - a combination of flags that modify the behavior of the widget.
context - runnable context, or null
Since:
7.0
Method Detail

addSelectionListener

public void addSelectionListener(SelectionListener listener)
Adds the listener to the collection of listeners who will be notified when the user changes the receiver's selection, by sending it one of the messages defined in the SelectionListener interface.

widgetSelected is called when the user changes the service provider or connection.

Parameters:
listener - the listener which should be notified

getButton

public Button getButton()
Get the new button from the widget

Returns:
button
Since:
7.0

getConnection

public IRemoteConnection getConnection()
Get the connection that is currently selected in the widget, or null if there is no selected connection.

Returns:
selected connection

getRemoteConnectionManager

protected IRemoteConnectionManager getRemoteConnectionManager(IRemoteServices services)

getRemoteServices

protected IRemoteServices getRemoteServices(String id)

handleConnectionSelected

protected void handleConnectionSelected()
Handle the section of a new connection. Update connection option buttons appropriately.


handleNewRemoteConnectionSelected

protected void handleNewRemoteConnectionSelected()
Handle creation of a new connection by pressing the 'New...' button. Calls handleRemoteServicesSelected() to update the connection combo with the new connection. TODO should probably select the new connection


handleRemoteServiceSelected

protected void handleRemoteServiceSelected(IRemoteConnection conn)
Handle selection of a new remote services provider from the remote services combo. Handles the special case where the services combo is null and a local connection is supplied. In this case, the selected services are not changed. The assumption is that this will trigger a call to the selection handler for the connection combo.

Parameters:
conn - connection to select as current. If conn is null, select the first item in the list.
notify - if true, notify handlers that the connection has changed. This should only happen if the user changes the connection.

initializeRemoteServicesCombo

protected void initializeRemoteServicesCombo(String id)
Initialize the contents of the remote services combo. Keeps an array of remote services that matches the combo elements. Returns the id of the selected element.

Since:
6.0

isEnabled

public boolean isEnabled()

removeSelectionListener

public void removeSelectionListener(SelectionListener listener)
Remove a listener that will be notified when one of the widget's controls are selected

Parameters:
listener - listener to remove

setConnection

public void setConnection(IRemoteConnection connection)
Set the connection that should be selected in the widget.

Parameters:
connection - connection to select

setConnection

public void setConnection(String id,
                          String name)
Set the connection that should be selected in the widget.

Parameters:
id - remote services id
name - connection name
Since:
6.0

setEnabled

public void setEnabled(boolean enabled)

setHints

public void setHints(String[] attrHints,
                     String[] attrHintValues)
Set hints to use when creating a new connection.

Parameters:
attrHints -
attrHintValues -

PTP
Release 7.0

Copyright (c) 2011 IBM Corporation and others. All Rights Reserved.