|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.rse.ui.widgets.SystemHostCombo
public class SystemHostCombo
This re-usable widget is for selecting a connection from the master list of connections. The list is subsettable by one or more system types. There is also the option of including a "New" button to the right of the connection dropdown, for the purpose of creating a new connection.
Without the New button, the composite is layed as follows:
Connection: ______________________v
With the New button, the composite is layed as follows:
Connection: ______________v New...
There are numerous ways to subset the connection list:
ISubSystemConfigurationCategories
.
Field Summary | |
---|---|
protected Combo |
connectionCombo
|
protected Label |
connectionLabel
|
protected boolean |
listeningForConnectionEvents
|
protected Button |
newButton
|
protected boolean |
showLabel
|
protected boolean |
showNewButton
|
protected boolean |
showQualifiedNames
|
Fields inherited from class org.eclipse.swt.widgets.Composite |
---|
embeddedHandle |
Fields inherited from class org.eclipse.swt.widgets.Widget |
---|
handle |
Constructor Summary | |
---|---|
SystemHostCombo(Composite parent,
int style,
IHost defaultConnection,
boolean showNewButton,
String ssConfigCategory)
Constructor for SystemConnectionCombo when there is a subsystem factory category to restrict the list to. |
|
SystemHostCombo(Composite parent,
int style,
IHost defaultConnection,
boolean showNewButton,
String ssConfigCategory,
boolean showLabel)
Constructor for SystemConnectionCombo when there is a subsystem factory category to restrict the list to. |
|
SystemHostCombo(Composite parent,
int style,
IHost defaultConnection,
String ssConfigId,
boolean showNewButton)
Constructor for SystemConnectionCombo when there is a subsystem factory id to restrict the list to. |
|
SystemHostCombo(Composite parent,
int style,
IRSESystemType[] systemTypes,
IHost defaultConnection,
boolean showNewButton)
Constructor for SystemConnectionCombo when there is an array of system types to restrict the connection list to. |
|
SystemHostCombo(Composite parent,
int style,
IRSESystemType systemType,
IHost defaultConnection,
boolean showNewButton)
Constructor for SystemConnectionCombo when there is only a single system type to restrict the connection list to. |
|
SystemHostCombo(Composite parent,
int style,
ISubSystemConfiguration ssConfig,
IHost defaultConnection,
boolean showNewButton)
Constructor for SystemConnectionCombo when there is a subsystem factory to restrict the list to. |
Method Summary | |
---|---|
void |
addModifyListener(ModifyListener listener)
Register a listener interested in entry field modify events |
void |
addNewButtonSelectionListener(SelectionListener listener)
Register a listener interested in when the new button is selected |
protected void |
addOurButtonSelectionListener()
|
protected void |
addOurConnectionSelectionListener()
|
void |
addSelectionChangedListener(ISelectionChangedListener listener)
Register a listener interested in an item is selected in the combo box |
void |
addSelectionListener(SelectionListener listener)
Register a listener interested in an item is selected in the combo box |
void |
clearSelection()
Deselect |
void |
clearTextSelection()
Clear the entered/selected contents of the combo box. |
static Combo |
createCombo(Composite parent,
boolean readonly)
Creates a new combobox instance and sets the default layout data. |
protected Combo |
createConnectionCombo(Composite parent)
Creates a new read-only connection combobox instance and sets the default layout data, with tooltip text. |
protected static Button |
createPushButton(Composite group,
String label)
|
protected static Button |
createPushButton(Composite group,
String label,
String tooltip)
|
Combo |
getCombo()
Return the combo box widget |
IHost[] |
getConnections()
|
int |
getGridColumns()
Return the number of grid data columns within this composite. |
IHost |
getHost()
Get the user selected SystemConnection object. |
String[] |
getItems()
Get the items in the combo field |
Button |
getNewButton()
Return the New... button widget |
protected SystemNewConnectionAction |
getNewConnectionAction(Shell shell,
ISelectionProvider selectionProvider)
Overridable method. |
Label |
getPromptLabel()
Get the prompt Label widget |
ISelection |
getSelection()
|
int |
getSelectionIndex()
Get the index number of the currently selected item. |
String |
getText()
Return the text in the connection combo entry field. |
protected void |
init(Composite parent,
boolean showNewButton)
|
protected void |
init(Composite parent,
boolean showNewButton,
boolean showLabel)
|
void |
listenToConnectionEvents(boolean start)
Have the SystemConnectionCombo listen to add/delete/rename events on connections and automatically update it's list of connections |
protected boolean |
populateConnectionCombo(Combo combo,
IHost defaultConnection,
String ssConfigCategory)
Populates a read-only connection combobox instance with system connections which have subsystems owned by a subsystem factory of the given subsystem factory category. |
protected void |
populateConnectionCombo(Combo combo,
IRSESystemType[] systemTypes,
IHost defaultConnection)
Populates a read-only connection combobox instance with system connections for the given array of system types. |
protected boolean |
populateConnectionCombo(Combo combo,
IRSESystemType systemType,
IHost defaultConnection,
boolean preSelectIfNoMatch)
Populates a read-only connection combobox instance with system connections for the given system type. |
protected boolean |
populateConnectionCombo(Combo combo,
IRSESystemType systemType,
IHost defaultConnection,
boolean preSelectIfNoMatch,
boolean appendToCombo)
Populates a read-only connection combobox instance with system connections for the given system type. |
protected boolean |
populateConnectionCombo(Combo combo,
ISubSystemConfiguration ssConfig,
IHost defaultConnection)
Populates a read-only connection combobox instance with system connections which have subsystems owned by the given subsystem factory. |
protected boolean |
populateConnectionCombo(Combo combo,
String ssConfigId,
IHost defaultConnection)
Populates a read-only connection combobox instance with system connections which have subsystems owned by a subsystem factory of the given subsystem factory id. |
protected Composite |
prepareComposite(int numColumns)
Prepares this composite control and sets the default layout data. |
void |
refreshConnections()
Refresh the list of connections |
void |
removeModifyListener(ModifyListener listener)
Remove a previously set entry field listener. |
void |
removeNewButtonSelectionListener(SelectionListener listener)
Remove a previously set new button selection listener. |
void |
removeSelectionChangedListener(ISelectionChangedListener listener)
Remove a previously set combo box selection listener. |
void |
removeSelectionListener(SelectionListener listener)
Remove a previously set combo box selection listener. |
void |
select(IHost connection)
Select a connection from the dropdown |
void |
select(int selIdx)
Select the combo dropdown list entry at the given index. |
void |
setAutoUpperCase(boolean enable)
Set auto-uppercase. |
protected void |
setBusyCursor(boolean setBusy)
Helper method. |
void |
setButtonToolTipText(String tip)
Same as setNewButtonToolTipText(String) |
void |
setButtonWidthHint(Control otherWidget)
Set button width hint, based on the width of another widget |
void |
setButtonWidthHint(int widthHint)
Set button width hint |
void |
setConnections(IHost[] input)
|
protected void |
setConnectionToolTipText()
|
void |
setEnabled(boolean enabled)
Disable/Enable all the child controls. |
boolean |
setFocus()
Set the focus to the directory combo field |
void |
setItems(String[] items)
Set the items in the combo field |
void |
setLabel(String label)
Set the label to use for the prompt. |
void |
setNewButtonFocus()
Set the focus to the new button |
void |
setNewButtonToolTipText(String tip)
Set the tooltip text for the new button |
void |
setSelection(ISelection selection)
|
void |
setSelectionIndex(int selIdx)
Same as select(int) |
void |
setToolTipText(String tip)
Set the tooltip text for the directory combo field |
void |
setWidthHint(int widthHint)
Set the width hint for this whole composite Default is 180. |
protected static String |
sub(String msg,
String subOld,
String subNew)
Do string variable substitution. |
void |
systemResourceChanged(ISystemResourceChangeEvent event)
This is the method in your class that will be called when a system resource changes. |
void |
widgetDisposed(DisposeEvent e)
We are going away. |
Methods inherited from class org.eclipse.swt.widgets.Composite |
---|
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setLayout, setLayoutDeferred, setTabList |
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
---|
computeTrim, getBorderWidth, getHorizontalBar, getVerticalBar |
Methods inherited from class org.eclipse.swt.widgets.Widget |
---|
addDisposeListener, addListener, checkWidget, dispose, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.rse.ui.model.ISystemShellProvider |
---|
getShell |
Field Detail |
---|
protected Label connectionLabel
protected Combo connectionCombo
protected Button newButton
protected boolean showNewButton
protected boolean showLabel
protected boolean showQualifiedNames
protected boolean listeningForConnectionEvents
Constructor Detail |
---|
public SystemHostCombo(Composite parent, int style, IRSESystemType systemType, IHost defaultConnection, boolean showNewButton)
parent
- Parent compositestyle
- SWT style flags for overall composite widget. Typically just pass SWT.NULLsystemType
- the system type to restrict the connection list to. Can be null or * for all.defaultConnection
- the system connection to preselect. Pass null to preselect first connection.showNewButton
- true if a New... button is to be included in this compositepublic SystemHostCombo(Composite parent, int style, IRSESystemType[] systemTypes, IHost defaultConnection, boolean showNewButton)
parent
- Parent compositestyle
- SWT style flags for overall composite widget. Typically just pass SWT.NULLsystemTypes
- the system type array to restrict the connection list to.defaultConnection
- the system connection to preselect. Pass null to preselect first connection.showNewButton
- true if a New... button is to be included in this compositepublic SystemHostCombo(Composite parent, int style, ISubSystemConfiguration ssConfig, IHost defaultConnection, boolean showNewButton)
parent
- Parent compositestyle
- SWT style flags for overall composite widget. Typically just pass SWT.NULLssConfig
- Only connections with subsystems owned by this factory are returned.defaultConnection
- the system connection to preselect. Pass null to preselect first connection.showNewButton
- true if a New... button is to be included in this compositepublic SystemHostCombo(Composite parent, int style, IHost defaultConnection, String ssConfigId, boolean showNewButton)
parent
- Parent compositestyle
- SWT style flags for overall composite widget. Typically just pass SWT.NULLdefaultConnection
- the system connection to preselect. Pass null to preselect first connection.ssConfigId
- Only connections with subsystems owned by this configuration are returned.showNewButton
- true if a New... button is to be included in this compositepublic SystemHostCombo(Composite parent, int style, IHost defaultConnection, boolean showNewButton, String ssConfigCategory)
parent
- Parent compositestyle
- SWT style flags for overall composite widget. Typically just pass SWT.NULLdefaultConnection
- the system connection to preselect. Pass null to preselect first connection.showNewButton
- true if a New... button is to be included in this compositessConfigCategory
- Only connections with subsystems owned by configurations of this category are returned.public SystemHostCombo(Composite parent, int style, IHost defaultConnection, boolean showNewButton, String ssConfigCategory, boolean showLabel)
parent
- Parent compositestyle
- SWT style flags for overall composite widget. Typically just pass SWT.NULLdefaultConnection
- the system connection to preselect. Pass null to preselect first connection.showNewButton
- true if a New... button is to be included in this compositessConfigCategory
- Only connections with subsystems owned by factories of this category are returned.showLabel
- true if a 'Connection' label is to be included in this compositeMethod Detail |
---|
public void setAutoUpperCase(boolean enable)
This method is part of ISystemCombo, so we must support it, but it does not apply this combo widget since the contents are read-only. Hence, it does nothing!
setAutoUpperCase
in interface ISystemCombo
protected void init(Composite parent, boolean showNewButton)
protected void init(Composite parent, boolean showNewButton, boolean showLabel)
protected SystemNewConnectionAction getNewConnectionAction(Shell shell, ISelectionProvider selectionProvider)
public IHost getHost()
public Combo getCombo()
getCombo
in interface ISystemCombo
public void setWidthHint(int widthHint)
setWidthHint
in interface ISystemCombo
public void setButtonWidthHint(int widthHint)
public void setButtonWidthHint(Control otherWidget)
public int getGridColumns()
public Button getNewButton()
public Label getPromptLabel()
public void setItems(String[] items)
public String[] getItems()
public String getText()
getText
in interface ISystemCombo
public void setEnabled(boolean enabled)
setEnabled
in interface ISystemCombo
setEnabled
in class Control
public void setToolTipText(String tip)
setToolTipText
in interface ISystemCombo
setToolTipText
in class Control
public void setNewButtonToolTipText(String tip)
public void setButtonToolTipText(String tip)
setNewButtonToolTipText(String)
setButtonToolTipText
in interface ISystemCombo
public void setLabel(String label)
public boolean setFocus()
setFocus
in interface ISystemCombo
setFocus
in class Composite
public void setNewButtonFocus()
public void select(int selIdx)
select
in interface ISystemCombo
public void setSelectionIndex(int selIdx)
select(int)
setSelectionIndex
in interface ISystemCombo
public void select(IHost connection)
public void clearSelection()
clearSelection
in interface ISystemCombo
public void clearTextSelection()
clearTextSelection
in interface ISystemCombo
public int getSelectionIndex()
getSelectionIndex
in interface ISystemCombo
public void addSelectionListener(SelectionListener listener)
addSelectionListener
in interface ISystemCombo
removeSelectionListener(SelectionListener)
public void removeSelectionListener(SelectionListener listener)
removeSelectionListener
in interface ISystemCombo
addSelectionListener(SelectionListener)
public void addNewButtonSelectionListener(SelectionListener listener)
removeNewButtonSelectionListener(SelectionListener)
public void removeNewButtonSelectionListener(SelectionListener listener)
addNewButtonSelectionListener(SelectionListener)
public void addModifyListener(ModifyListener listener)
removeModifyListener(ModifyListener)
public void removeModifyListener(ModifyListener listener)
addModifyListener(ModifyListener)
protected Composite prepareComposite(int numColumns)
numColumns
- Number of columns the new group will contain.protected Combo createConnectionCombo(Composite parent)
This fills the combination with the names of all the active connections of the given system type.
parent
- composite to put the button into.public static Combo createCombo(Composite parent, boolean readonly)
Does NOT set the widthHint as that causes problems. Instead the combo will consume what space is available within this composite.
parent
- composite to put the button into.protected boolean populateConnectionCombo(Combo combo, IRSESystemType systemType, IHost defaultConnection, boolean preSelectIfNoMatch)
This fills the combination with the names of all the active connections of the given system type.
combo
- composite to populatesystemType
- the system type to restrict the connection list to. Pass null or * for all system typesdefaultConnection
- the default system connection to preselect.preSelectIfNoMatch
- true if we should preselect the first item if the given connection is not found
protected boolean populateConnectionCombo(Combo combo, IRSESystemType systemType, IHost defaultConnection, boolean preSelectIfNoMatch, boolean appendToCombo)
This fills the combination with the names of all the active connections of the given system type.
combo
- composite to populatesystemType
- the system type to restrict the connection list to. Pass null for all system typesdefaultConnection
- the default system connection to preselect.preSelectIfNoMatch
- true if we should preselect the first item if the given connection is not foundappendToCombo
- indicates whether or not to append to combo with population or replace
protected void populateConnectionCombo(Combo combo, IRSESystemType[] systemTypes, IHost defaultConnection)
combo
- composite to populatesystemTypes
- the system types to restrict the connection list to. Pass null or * for all system typesdefaultConnection
- the default system connection to preselect.protected boolean populateConnectionCombo(Combo combo, ISubSystemConfiguration ssConfig, IHost defaultConnection)
combo
- composite to populatessConfig
- the subsystem factory to restrict the connection list to.defaultConnection
- the default system connection to preselect.
protected boolean populateConnectionCombo(Combo combo, String ssConfigId, IHost defaultConnection)
combo
- composite to populatedefaultConnection
- the default system connection to preselect.ssConfigId
- the subsystem factory id to restrict the connection list by.
protected boolean populateConnectionCombo(Combo combo, IHost defaultConnection, String ssConfigCategory)
combo
- composite to populatedefaultConnection
- the default system connection to preselect.ssConfigCategory
- the subsystem factory category to restrict the connection list by.
protected static String sub(String msg, String subOld, String subNew)
msg
- message containing substitution variable. Eg "Connect failed with return code &1"subOld
- substitution variable. Eg "%1"subNew
- substitution data. Eg "001"
public void refreshConnections()
public void systemResourceChanged(ISystemResourceChangeEvent event)
systemResourceChanged
in interface ISystemResourceChangeListener
ISystemResourceChangeEvent
public void listenToConnectionEvents(boolean start)
public void widgetDisposed(DisposeEvent e)
widgetDisposed
in interface DisposeListener
protected void addOurButtonSelectionListener()
protected void addOurConnectionSelectionListener()
protected void setConnectionToolTipText()
protected static Button createPushButton(Composite group, String label)
protected static Button createPushButton(Composite group, String label, String tooltip)
public void addSelectionChangedListener(ISelectionChangedListener listener)
addSelectionChangedListener
in interface ISelectionProvider
removeSelectionChangedListener(ISelectionChangedListener)
public void removeSelectionChangedListener(ISelectionChangedListener listener)
removeSelectionChangedListener
in interface ISelectionProvider
addSelectionChangedListener(ISelectionChangedListener)
public ISelection getSelection()
getSelection
in interface ISelectionProvider
public void setSelection(ISelection selection)
setSelection
in interface ISelectionProvider
public IHost[] getConnections()
public void setConnections(IHost[] input)
protected void setBusyCursor(boolean setBusy)
|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |