PTP
Release 5.0

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

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.eclipse.ptp.remote.ui.widgets.RemoteConnectionWidget
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable

public class RemoteConnectionWidget
extends org.eclipse.swt.widgets.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
           
 
Field Summary
 
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
 
Fields inherited from class org.eclipse.swt.widgets.Widget
handle
 
Constructor Summary
RemoteConnectionWidget(org.eclipse.swt.widgets.Composite parent, int style, String title, org.eclipse.jface.operation.IRunnableContext context)
           
 
Method Summary
 void addSelectionListener(org.eclipse.swt.events.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.
 IRemoteConnection getConnection()
          Get the connection that is currently selected in the widget, or null if there is no selected connection.
protected  IRemoteConnection getRemoteConnection(IRemoteServices services, String name)
           
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  String initializeRemoteServicesCombo(String id)
          Initialize the contents of the remote services combo.
 void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
          Remove a listener that will be notified when one of the widget's controls are selected
 void setConnection(IRemoteConnection connection)
          Set the selected connection.
 void setEnabled(boolean enabled)
           
 void setHints(String[] attrHints, String[] attrHintValues)
          Set hints to use when creating a new connection.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getBorderWidth, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isTouchEnabled, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setTouchEventsEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RemoteConnectionWidget

public RemoteConnectionWidget(org.eclipse.swt.widgets.Composite parent,
                              int style,
                              String title,
                              org.eclipse.jface.operation.IRunnableContext context)
Method Detail

addSelectionListener

public void addSelectionListener(org.eclipse.swt.events.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

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

removeSelectionListener

public void removeSelectionListener(org.eclipse.swt.events.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 selected connection.

Parameters:
connection - connection to select

setEnabled

public void setEnabled(boolean enabled)
Overrides:
setEnabled in class org.eclipse.swt.widgets.Control

setHints

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

Parameters:
attrHints -
attrHintValues -

getRemoteConnection

protected IRemoteConnection getRemoteConnection(IRemoteServices services,
                                                String name)

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. 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 String 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.


PTP
Release 5.0

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