Class RemoteConnectionWidget

java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.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

    Nested Classes
    Modifier and Type
    Class
    Description
    protected class 
    Listener for widget selected events.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static int
    Force the use of the connection type combo, regardless of the PREF_CONNECTION_TYPE preference setting.
    static int
    Do not provide a selection for local services.

    Fields inherited from class org.eclipse.swt.widgets.Composite

    embeddedHandle

    Fields inherited from class org.eclipse.swt.widgets.Widget

    handle
  • Constructor Summary

    Constructors
    Constructor
    Description
    RemoteConnectionWidget(org.eclipse.swt.widgets.Composite parent, int style, String title, int flags)
    Constructor
    RemoteConnectionWidget(org.eclipse.swt.widgets.Composite parent, int style, String title, int flags, List<IRemoteConnectionType> connectionTypes)
    Constructor
    RemoteConnectionWidget(org.eclipse.swt.widgets.Composite parent, int style, String title, int flags, org.eclipse.jface.operation.IRunnableContext context)
    Constructor
    RemoteConnectionWidget(org.eclipse.swt.widgets.Composite parent, int style, String title, int flags, org.eclipse.jface.operation.IRunnableContext context, List<IRemoteConnectionType> connectionTypes)
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    final void
    Limit the connection types that will be used when displaying valid connections.
    org.eclipse.swt.widgets.Button
    Get the new button from the widget
    Get the connection that is currently selected in the widget, or null if there is no selected connection.
    protected void
    Handle the section of a new connection.
    protected void
    Handle selection of a new connection type from the connection type combo.
    protected void
    Handle creation of a new connection by pressing the 'New...' button.
    protected void
    Initialize the contents of the connection type combo.
    boolean
     
    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
    Set the connection that should be selected in the widget.
    void
    Set the connection that should be selected in the widget.
    void
    setEnabled(boolean enabled)
     

    Methods inherited from class org.eclipse.swt.widgets.Composite

    changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString

    Methods inherited from class org.eclipse.swt.widgets.Scrollable

    computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsMode

    Methods inherited from class org.eclipse.swt.widgets.Control

    addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isAutoScalable, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update

    Methods inherited from class org.eclipse.swt.widgets.Widget

    addDisposeListener, addListener, addTypedListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setData

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • DEFAULT_CONNECTION_NAME

      public static final String DEFAULT_CONNECTION_NAME
      See Also:
    • FLAG_FORCE_CONNECTION_TYPE_SELECTION

      public static int FLAG_FORCE_CONNECTION_TYPE_SELECTION
      Force the use of the connection type combo, regardless of the PREF_CONNECTION_TYPE preference setting.
      Since:
      2.0
    • FLAG_NO_LOCAL_SELECTION

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

    • RemoteConnectionWidget

      public RemoteConnectionWidget(org.eclipse.swt.widgets.Composite parent, int style, String title, int flags)
      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.
    • RemoteConnectionWidget

      public RemoteConnectionWidget(org.eclipse.swt.widgets.Composite parent, int style, String title, int flags, org.eclipse.jface.operation.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:
      2.0
    • RemoteConnectionWidget

      public RemoteConnectionWidget(org.eclipse.swt.widgets.Composite parent, int style, String title, int flags, List<IRemoteConnectionType> connectionTypes)
      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.
      connnectionTypes - list of connection types to select from
      Since:
      2.0
    • RemoteConnectionWidget

      public RemoteConnectionWidget(org.eclipse.swt.widgets.Composite parent, int style, String title, int flags, org.eclipse.jface.operation.IRunnableContext context, List<IRemoteConnectionType> connectionTypes)
      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
      connectionTypes - list of connection types to select from
      Since:
      2.0
  • Method Details

    • 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
    • filterConnections

      @SafeVarargs public final void filterConnections(Class<? extends IRemoteConnection.Service>... services)
      Limit the connection types that will be used when displaying valid connections. Only connection types that support connections with supplied services will be displayed in the connection type combo, and only connections from these connection types will be displayed in the connection combo.
      Parameters:
      services - list of services IRemoteConnection.Service
      Since:
      2.0
    • getButton

      public org.eclipse.swt.widgets.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
    • 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
    • handleConnectionTypeSelected

      protected void handleConnectionTypeSelected(IRemoteConnection conn)
      Handle selection of a new connection type from the connection type combo. Handles the special case where the connection type combo is null and a local connection is supplied. In this case, the selected connection type is 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.
      Since:
      2.0
    • initializeConnectionTypeCombo

      protected void initializeConnectionTypeCombo()
      Initialize the contents of the connection type combo. Keeps an array of connection types that matches the combo elements.
      Since:
      2.0
    • isEnabled

      public boolean isEnabled()
      Overrides:
      isEnabled in class org.eclipse.swt.widgets.Control
    • 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 connection that should be selected in the widget.
      Parameters:
      connection - connection to select
      Throws:
      org.eclipse.core.runtime.CoreException
    • setConnection

      public void setConnection(String id, String name)
      Set the connection that should be selected in the widget.
      Parameters:
      id - connection type id
      name - connection name
      Since:
      6.0
    • setEnabled

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