|
|
|
|
org.eclipse.rse.ui
Class SystemWidgetHelpers
java.lang.Object
org.eclipse.rse.ui.SystemWidgetHelpers
-
Direct Known Subclasses:
-
SystemFileWidgetHelpers
-
public class SystemWidgetHelpers
- extends
Object
Static methods that can be used when writing SWT GUI code.
They simply make it more productive.
Method Summary
|
static
String
|
appendColon
(
String label)
Appends a colon to a label, if the label doesn't already end in a colon of the proper size. |
static
Button
|
createBrowseButton
(
Composite group,
Listener listener)
Creates a new "Browse..." pushbutton instance and sets the default
layout data. |
static
Button
|
createBrowseButton
(
Composite group,
Listener listener,
String tooltip)
Deprecated.
|
static
Button
|
createCheckBox
(
Composite group,
int horizontalSpan,
Listener listener,
String label,
String tooltip)
Creates a new checkbox instance with the given horizontal span and sets the default
layout data, and sets the tooltip text. |
static
Button
|
createCheckBox
(
Composite group,
int horizontalSpan,
String label,
Listener listener)
Creates a new checkbox instance with the given horizontal span and sets the default
layout data. |
static
Button
|
createCheckBox
(
Composite group,
Listener listener,
String label,
String tooltip)
Creates a new checkbox instance and sets the default
layout data, and sets the tooltip text. |
static
Button
|
createCheckBox
(
Composite group,
String label,
Listener listener)
Creates a new checkbox instance and sets the default
layout data. |
static
Combo
|
createCombo
(
Composite parent,
Listener listener)
Creates a new combobox instance and sets the default
layout data. |
static
Combo
|
createCombo
(
Composite parent,
Listener listener,
String toolTip)
Creates a new combobox instance and sets the default
layout data, with tooltip text. |
static
Label
|
createCommandStatusLine
(
Composite parent,
int horizontalSpan)
Create a label to show a command string as it is being built-up in a dialog
This version uses a default height of 3 normal lines. |
static
Label
|
createCommandStatusLine
(
Composite parent,
int horizontalSpan,
int heightInLines)
Create a label to show a command string as it is being built-up in a dialog. |
static
Composite
|
createComposite
(
Composite parent,
int numColumns)
Creates composite control and sets the default layout data. |
static
Composite
|
createComposite
(
Composite parent,
int parentSpan,
int numColumns,
boolean border,
String label,
int marginSize,
int spacingSize)
This is the most flexible composite creation method. |
static
SystemHostCombo
|
createConnectionCombo
(
Composite parent,
SelectionListener listener,
IRSESystemType[] systemTypes,
ISubSystemConfiguration factory,
String factoryId,
String factoryCategory,
IHost defaultConnection,
int horizontalSpan,
boolean newButton)
Creates a new remote system connection combobox instance and sets the default
layout data, with tooltip text. |
static
Composite
|
createFlushComposite
(
Composite parent,
int numColumns)
Creates "flush" composite control and sets the default layout data. |
static
Group
|
createGroupComposite
(
Composite parent,
int numColumns,
String label)
Creates group composite control and sets the default layout data. |
static
SystemHistoryCombo
|
createHistoryCombo
(
Composite parent,
SelectionListener listener,
String historyKey,
boolean readonly,
String tooltip)
Creates a new historical combobox instance and sets the default
layout data, with tooltip text. |
static
Combo
|
createHostNameCombo
(
Composite parent,
Listener listener,
IRSESystemType systemType)
Creates a hostname combination box. |
static
Button
|
createImageButton
(
Composite group,
Image image,
Listener listener)
Creates a new pushbutton instance with an image, vs text. |
static
InheritableEntryField
|
createInheritableTextField
(
Composite parent,
String toggleToolTip,
String entryToolTip)
Create an entry field controlled by an inherit/override switch button
After creating the widget, call setLocal to set initial state, and setInheritedText/setLocalText to set inherited/local text |
static
Label
|
createLabel
(
Composite parent,
String text)
Creates a label instance and inserts it into a given GridLayout. |
static
Label
|
createLabel
(
Composite parent,
String text,
int span)
Creates a label instance and inserts it into a given GridLayout. |
static
Label
|
createLabel
(
Composite parent,
String text,
int span,
boolean wantBorder)
Creates a label instance and inserts it into a given GridLayout, optionally
with a border style |
static
Label
|
createLabel
(
Composite parent,
String text,
String tooltip)
Creates a label instance and inserts it into a given GridLayout. |
static
Label
|
createLabel
(
Composite parent,
String text,
String tooltip,
int span,
boolean wantBorder)
Creates a label instance and inserts it into a given GridLayout. |
static
Combo
|
createLabeledCombo
(
Composite parent,
Listener listener,
String label,
String tooltip)
Create a labeled combo field and insert it into a GridLayout, and assign tooltip text. |
static
Label
|
createLabeledLabel
(
Composite parent,
String label,
String tooltip,
boolean wantBorder)
Create a pair of labels, the first being a prompt and the second being a value. |
static
Combo
|
createLabeledReadonlyCombo
(
Composite parent,
Listener listener,
String labelText,
String tooltip)
Create a labeled readonly combo field and insert it into a GridLayout, and assign tooltip text. |
static
Text
|
createLabeledReadonlyTextField
(
Composite parent,
String text,
String tooltip)
Create a labeled readonly text field and insert it into a GridLayout, and assign tooltip text. |
static
Text
|
createLabeledTextField
(
Composite parent,
Listener listener,
String labelText,
String tooltip)
Create a labeled text field and insert it into a GridLayout, and assign tooltip text. |
static
Label
|
createLabeledVerbiage
(
Composite parent,
String labelText,
String tooltip,
int span,
boolean border,
int widthHint)
Create a labeled verbiage (wrappable label) field and insert it into a GridLayout, and assign tooltip text. |
static
List
|
createListBox
(
Composite group,
Listener listener,
boolean multiSelect,
String label,
String tooltip)
Creates a new listbox instance and sets the default
layout data. |
static
List
|
createListBox
(
Composite group,
String label,
Listener listener,
boolean multiSelect)
Creates a new listbox instance and sets the default
layout data. |
static
List
|
createListBox
(
Composite group,
String label,
Listener listener,
boolean multiSelect,
int columnSpan)
Creates a new listbox instance and sets the default
layout data. |
static
List
|
createListBox
(
Composite group,
String label,
Listener listener,
boolean multiSelect,
String tooltip)
Creates a new listbox instance and sets the default
layout data. |
static
Text
|
createMultiLineLabeledTextField
(
Composite parent,
Listener listener,
String labelString,
String tooltip,
int heightHint)
Create a multiline labeled text field and insert it into a GridLayout, and assign tooltip text. |
static
Text
|
createMultiLineTextField
(
Composite parent,
Listener listener,
int heightHint)
Create a multiline text field and insert it into a GridLayout. |
static
Button
|
createPushButton
(
Composite group,
Listener listener,
String label,
String tooltip)
This one takes the resource bundle key and appends "label" and "tooltip" to it to
get the label and tooltip text. |
static
Button
|
createPushButton
(
Composite group,
String label,
Listener listener)
Creates a new pushbutton instance and sets the default
layout data. |
static
Button
|
createPushButton
(
Composite group,
String label,
Listener listener,
String tooltip)
Creates a new pushbutton instance and sets the default
layout data, and assign tooltip text
Assign the listener to the passed in implementer of Listener. |
static
Button
|
createRadioButton
(
Composite group,
Listener listener,
String label)
Creates a new radiobutton instance and sets the default
layout data, and assigns tooltip text. |
static
Button
|
createRadioButton
(
Composite group,
Listener listener,
String label,
String tooltip)
Creates a new radiobutton instance and sets the default
layout data, and assigns tooltip text. |
static
Button
|
createRadioButton
(
Composite group,
String label,
Listener listener)
Creates a new radiobutton instance and sets the default
layout data. |
static
Combo
|
createReadonlyCombo
(
Composite parent,
Listener listener)
Creates a new readonly combobox instance and sets the default
layout data. |
static
Combo
|
createReadonlyCombo
(
Composite parent,
Listener listener,
String tooltip)
Creates a new readonly combobox instance and sets the default
layout data, with tooltip text. |
static
Text
|
createReadonlyTextField
(
Composite parent)
Create a readonly text field and insert it into a GridLayout. |
static
Text
|
createReadonlyTextField
(
Composite parent,
String toolTip)
Create a readonly text field and insert it into a GridLayout,
and assign tooltip text. |
static
Label
|
createRigidFillerLabel
(
Composite parent,
int span,
int widthHint)
Creates a label for use a simple filler, to eat up space. |
static void
|
createSpacerLine
(
Composite parent,
int columnSpan,
boolean wantBorder)
Create a spacer line. |
static
Combo
|
createSystemTypeCombo
(
Composite parent,
Listener listener,
IRSESystemType[] systemTypes)
Creates a readonly system type combination box with the given system types. |
static
Text
|
createTextField
(
Composite parent,
Listener listener)
Create a text field and insert it into a GridLayout. |
static
Text
|
createTextField
(
Composite parent,
Listener listener,
String toolTip)
Create a text field and insert it into a GridLayout, and assign tooltip text. |
static
Composite
|
createTightComposite
(
Composite parent,
int numColumns)
Creates "tight" composite control and sets the default layout data. |
static
Label
|
createVerbiage
(
Composite parent,
String text,
int span,
boolean border,
int widthHint)
Creates a widget for displaying text verbiage that spans multiple lines. |
static
Composite
|
createVerticalBeginComposite
(
Composite parent,
int parentSpan,
int numColumns,
boolean border,
String label,
int marginSize,
int spacingSize)
Creates a composite with vertical alignment GridData.VERTICAL_ALIGN_BEGINNING. |
static
Label
|
getFirstColumnOneLabel
(
Composite composite)
Given a composite that has been layed out, return the first label found in the first column. |
static
Label
|
getLastLabel
()
Return the prompting label from the last call to createLabeledXXXX. |
static
String[]
|
getSystemTypeLabels
(
IRSESystemType[] systemTypes)
Return the labels for the given list of system types. |
static
IRSESystemType[]
|
getValidSystemTypes
(
String[] restrictIds)
Return the list of all registered valid system types. |
static void
|
lineUpPrompts
(
Composite composite)
Helper method to line up the leading prompts in a composite, taking
into account composite prompts nested within. |
static void
|
setCompositeHelp
(
Composite parent,
String helpID)
Given a Composite, this method walks all the children recursively and
and sets the infopop help id for each child control where help
makes sense (eg, buttons, combos, entry fields, lists, trees). |
static void
|
setHelp
(
Control c,
IViewPart view,
Object id)
Deprecated.
|
static void
|
setHelp
(
Control c,
String id)
Set the context id for a control |
static void
|
setHelp
(
IAction c,
String id)
Set the context id for an action |
static void
|
setHelp
(
MenuItem c,
String id)
Set the context id for a menu item |
static
Mnemonics
|
setMnemonics
(
Composite parent)
Given a Composite, this method walks all the children recursively and
and sets the mnemonics uniquely for each child control where a
mnemonic makes sense (eg, buttons). |
static
Mnemonics
|
setMnemonics
(
Composite parent,
boolean applyToPrecedingLabels)
Same as above but also whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields. |
static void
|
setMnemonics
(
Menu menu)
Given an SWT Menu, "walk it" and automatically assign unique
mnemonics for every menu item in it, and then for each
submenu, do so for it too. |
static
Mnemonics
|
setMnemonics
(
Mnemonics mnemonics,
Composite parent)
Same as above but takes as input a previously populated mnemonics object,
which records already-used mnemonics for whatever scope you want (a dialog usually). |
static
Mnemonics
|
setPreferencePageMnemonics
(
Composite parent)
Same as above but specifically for preference pages |
static
Mnemonics
|
setPreferencePageMnemonics
(
Composite parent,
boolean applyToPrecedingLabels)
Same as above but also whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields. |
static
Mnemonics
|
setWizardPageMnemonics
(
Composite parent)
Same as above but specifically for wizard pages |
static
Mnemonics
|
setWizardPageMnemonics
(
Composite parent,
boolean applyToPrecedingLabels)
Same as above but also whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields. |
static void
|
sortSystemTypesByLabel
(
IRSESystemType[] systemTypes)
Sorts the given array of systemTypes in ascending order by system
type label. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
traceHelpIDs
public static boolean traceHelpIDs
previousLabel
public static
Label previousLabel
SystemWidgetHelpers
public SystemWidgetHelpers()
createComposite
public static
Composite createComposite(
Composite parent,
int parentSpan,
int numColumns,
boolean border,
String label,
int marginSize,
int spacingSize)
- This is the most flexible composite creation method.
-
-
Parameters:
-
parent - Parent composite -
parentSpan - number of columns this is to span in the parent's composite -
numColumns - number of columns this composite is to have -
border - true if you want to show an etched border around the composite -
label - optional label to show in the border. Forces border to true -
marginSize - the number pixels around the composite. -1 means Eclipse default -
spacingSize - the number pixels around the composite controls. -1 means Eclipse default
createVerticalBeginComposite
public static
Composite createVerticalBeginComposite(
Composite parent,
int parentSpan,
int numColumns,
boolean border,
String label,
int marginSize,
int spacingSize)
- Creates a composite with vertical alignment GridData.VERTICAL_ALIGN_BEGINNING.
-
-
Parameters:
-
parent - Parent composite -
parentSpan - number of columns this is to span in the parent's composite -
numColumns - number of columns this composite is to have -
border - true if you want to show an etched border around the composite -
label - optional label to show in the border. Forces border to true -
marginSize - the number pixels around the composite. -1 means Eclipse default -
spacingSize - the number pixels around the composite controls. -1 means Eclipse default
createComposite
public static
Composite createComposite(
Composite parent,
int numColumns)
- Creates composite control and sets the default layout data.
-
-
Parameters:
-
parent - GridLayout composite to put the new group composite into. -
numColumns - Number of columns the new group will contain.
createGroupComposite
public static
Group createGroupComposite(
Composite parent,
int numColumns,
String label)
- Creates group composite control and sets the default layout data.
Group composites show a visible border line and optional text in it.
-
-
Parameters:
-
parent - GridLayout composite to put the new group composite into. -
numColumns - Number of columns the new group will contain. -
label - Text to display in the group border. Can be null.
createTightComposite
public static
Composite createTightComposite(
Composite parent,
int numColumns)
- Creates "tight" composite control and sets the default layout data.
A tight composite is one with no vertical or horizontal spacing, or margin spacing.
-
-
Parameters:
-
parent - GridLayout composite to put the new group composite into. -
numColumns - Number of columns the new group will contain.
createFlushComposite
public static
Composite createFlushComposite(
Composite parent,
int numColumns)
- Creates "flush" composite control and sets the default layout data.
A flush composite is one with no margin spacing but normal inter-component spacing
-
-
Parameters:
-
parent - GridLayout composite to put the new group composite into. -
numColumns - Number of columns the new group will contain.
createRigidFillerLabel
public static
Label createRigidFillerLabel(
Composite parent,
int span,
int widthHint)
- Creates a label for use a simple filler, to eat up space. This is for a rigid
filler that doesn't consume space.
-
-
Parameters:
-
parent - Composite to put the field into. -
span - Horizontal span -
widthHint - How wide to make it. Pass -1 to use SWT default
createLabel
public static
Label createLabel(
Composite parent,
String text)
- Creates a label instance and inserts it into a given GridLayout.
-
-
Parameters:
-
parent - GridLayout composite to put the field into. -
text - Text to display in the label.
createLabel
public static
Label createLabel(
Composite parent,
String text,
int span)
- Creates a label instance and inserts it into a given GridLayout.
-
-
Parameters:
-
parent - Composite to put the field into. -
text - Text to display in the label. -
span - Horizontal span
createLabel
public static
Label createLabel(
Composite parent,
String text,
int span,
boolean wantBorder)
- Creates a label instance and inserts it into a given GridLayout, optionally
with a border style
-
-
Parameters:
-
parent - Composite to put the field into. -
text - Text to display in the label. -
span - Horizontal span -
wantBorder - true to place border around the label
createLabel
public static
Label createLabel(
Composite parent,
String text,
String tooltip)
- Creates a label instance and inserts it into a given GridLayout. Supports tooltip text
-
-
Parameters:
-
parent - GridLayout composite to put the field into. -
text - -
tooltip -
createLabel
public static
Label createLabel(
Composite parent,
String text,
String tooltip,
int span,
boolean wantBorder)
- Creates a label instance and inserts it into a given GridLayout.
-
-
Parameters:
-
parent - Composite to put the field into. -
text - -
tooltip - -
span - Horizontal span -
wantBorder - true to place border around the label
createLabeledLabel
public static
Label createLabeledLabel(
Composite parent,
String label,
String tooltip,
boolean wantBorder)
- Create a pair of labels, the first being a prompt and the second being a value. A colon
is appended to the text of the first label. The text value of the second will be set to "".
The first label is set to not grab excess horizontal space, while the second one is, since
its contents are variable.
To help with initial sizing, the widthHint of the second is set to 100.
If you need a handle to the prompting label, immediately call
getLastLabel()
-
-
Parameters:
-
parent - composite to put the fields into. Will be added sequentially -
label - -
tooltip - -
wantBorder - true if a border is desired around the second label (the value vs the prompt)
-
Returns:
- the second label created. Use setText to place the value in it.
getLastLabel
public static
Label getLastLabel()
- Return the prompting label from the last call to createLabeledXXXX.
These methods only return the second control, but we sometimes need access to the label.
-
createSpacerLine
public static void createSpacerLine(
Composite parent,
int columnSpan,
boolean wantBorder)
- Create a spacer line. No widget returned so we have the freedom to change it over time
-
createVerbiage
public static
Label createVerbiage(
Composite parent,
String text,
int span,
boolean border,
int widthHint)
- Creates a widget for displaying text verbiage that spans multiple lines. Takes resolved text vs resource bundle id.
The returned widget is not typed so we can easily change it in the future if we decide on a better widget.
-
-
Parameters:
-
parent - Composite to put the field into. -
text - String is the verbiage text to display -
span - Horizontal span -
border - true if you want a border around the verbiage -
widthHint - number of pixels to limit width to before wrapping. 200 is a reasonable number
-
Returns:
- the Label widget, in case you want to tweak it
createLabeledVerbiage
public static
Label createLabeledVerbiage(
Composite parent,
String labelText,
String tooltip,
int span,
boolean border,
int widthHint)
- Create a labeled verbiage (wrappable label) field and insert it into a GridLayout, and assign tooltip text.
After calling this, you must call setText on the result to set its contents.
If you need a handle to the prompting label, immediately call
getLastLabel()
-
-
Parameters:
-
parent - composite to put the field into. -
labelText - -
tooltip - -
span - Horizontal span -
border - true if you want a border around the verbiage -
widthHint - number of pixels to limit width to before wrapping. 200 is a reasonable number
-
Returns:
- Label created.
createCommandStatusLine
public static
Label createCommandStatusLine(
Composite parent,
int horizontalSpan)
- Create a label to show a command string as it is being built-up in a dialog
This version uses a default height of 3 normal lines.
-
createCommandStatusLine
public static
Label createCommandStatusLine(
Composite parent,
int horizontalSpan,
int heightInLines)
- Create a label to show a command string as it is being built-up in a dialog.
This version allows you specify how tall to make it, in terms of normal line height.
-
createTextField
public static
Text createTextField(
Composite parent,
Listener listener)
- Create a text field and insert it into a GridLayout.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
parent - GridLayout composite to put the field into. -
listener - Listener object to listen for events. Can be null.
createTextField
public static
Text createTextField(
Composite parent,
Listener listener,
String toolTip)
- Create a text field and insert it into a GridLayout, and assign tooltip text.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
parent - composite to put the field into. -
listener - object to listen for events. Can be null. -
toolTip - tooltip text
createLabeledTextField
public static
Text createLabeledTextField(
Composite parent,
Listener listener,
String labelText,
String tooltip)
- Create a labeled text field and insert it into a GridLayout, and assign tooltip text.
Assign the listener to the passed in implementer of Listener.
If you need a handle to the prompting label, immediately call
getLastLabel()
-
-
Parameters:
-
parent - composite to put the field into. -
listener - object to listen for events. Can be null. -
labelText - the label -
tooltip - the tooltip
-
Returns:
- TextField created.
createReadonlyTextField
public static
Text createReadonlyTextField(
Composite parent)
- Create a readonly text field and insert it into a GridLayout.
-
-
Parameters:
-
parent - GridLayout composite to put the field into.
createReadonlyTextField
public static
Text createReadonlyTextField(
Composite parent,
String toolTip)
- Create a readonly text field and insert it into a GridLayout,
and assign tooltip text.
-
-
Parameters:
-
parent - composite to put the field into. -
toolTip -
createLabeledReadonlyTextField
public static
Text createLabeledReadonlyTextField(
Composite parent,
String text,
String tooltip)
- Create a labeled readonly text field and insert it into a GridLayout, and assign tooltip text.
Assign the listener to the passed in implementer of Listener.
If you need a handle to the prompting label, immediately call
getLastLabel()
-
-
Parameters:
-
parent - composite to put the field into. -
text - the label -
tooltip - the tooltip
-
Returns:
- TextField created.
createMultiLineTextField
public static
Text createMultiLineTextField(
Composite parent,
Listener listener,
int heightHint)
- Create a multiline text field and insert it into a GridLayout.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
parent - GridLayout composite to put the field into. -
listener - Listener object to listen for events. Can be null.
createMultiLineLabeledTextField
public static
Text createMultiLineLabeledTextField(
Composite parent,
Listener listener,
String labelString,
String tooltip,
int heightHint)
- Create a multiline labeled text field and insert it into a GridLayout, and assign tooltip text.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
parent - composite to put the field into. -
listener - object to listen for events. Can be null. -
labelString - the label -
tooltip - the tooltip
-
Returns:
- TextField created.
createCheckBox
public static
Button createCheckBox(
Composite group,
String label,
Listener listener)
- Creates a new checkbox instance and sets the default
layout data. Spans 1 column horizontally.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the checkbox into. -
label - to display in the checkbox. -
listener - object to listen for events. Can be null.
createCheckBox
public static
Button createCheckBox(
Composite group,
int horizontalSpan,
String label,
Listener listener)
- Creates a new checkbox instance with the given horizontal span and sets the default
layout data.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the checkbox into. -
horizontalSpan - number of columns this checkbox is to span. -
label - to display in the checkbox. -
listener - object to listen for events. Can be null.
createCheckBox
public static
Button createCheckBox(
Composite group,
Listener listener,
String label,
String tooltip)
- Creates a new checkbox instance and sets the default
layout data, and sets the tooltip text.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the checkbox into. -
listener - object to listen for events. Can be null. -
label - the label -
tooltip - the tooltip
createCheckBox
public static
Button createCheckBox(
Composite group,
int horizontalSpan,
Listener listener,
String label,
String tooltip)
- Creates a new checkbox instance with the given horizontal span and sets the default
layout data, and sets the tooltip text.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the checkbox into. -
horizontalSpan - number of columns to span. -
listener - object to listen for events. Can be null. -
label - the label -
tooltip - the tooltip
createRadioButton
public static
Button createRadioButton(
Composite group,
String label,
Listener listener)
- Creates a new radiobutton instance and sets the default
layout data.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the button into. -
label - to display in the button -
listener - object to listen for events. Can be null.
createRadioButton
public static
Button createRadioButton(
Composite group,
Listener listener,
String label,
String tooltip)
- Creates a new radiobutton instance and sets the default
layout data, and assigns tooltip text.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the button into. -
listener - object to listen for events. Can be null. -
label - the label -
tooltip - the tooltip
createRadioButton
public static
Button createRadioButton(
Composite group,
Listener listener,
String label)
- Creates a new radiobutton instance and sets the default
layout data, and assigns tooltip text.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the button into. -
listener - object to listen for events. Can be null. -
label - the label
createImageButton
public static
Button createImageButton(
Composite group,
Image image,
Listener listener)
- Creates a new pushbutton instance with an image, vs text.
SWT does not allow both image and text on a button.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - The composite to put the button into. -
image - The image to display in the button -
listener - The object to listen for events. Can be null.
createPushButton
public static
Button createPushButton(
Composite group,
String label,
Listener listener)
- Creates a new pushbutton instance and sets the default
layout data.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the button into. -
label - to display in the button -
listener - object to listen for events. Can be null.
createPushButton
public static
Button createPushButton(
Composite group,
String label,
Listener listener,
String tooltip)
- Creates a new pushbutton instance and sets the default
layout data, and assign tooltip text
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the button into. -
label - to display in the button -
listener - object to listen for events. Can be null. -
tooltip - the tooltip
createPushButton
public static
Button createPushButton(
Composite group,
Listener listener,
String label,
String tooltip)
- This one takes the resource bundle key and appends "label" and "tooltip" to it to
get the label and tooltip text.
-
-
Parameters:
-
group - composite to put the button into. -
listener - object to listen for events. Can be null. -
label - the label -
tooltip - the tooltip
createBrowseButton
public static
Button createBrowseButton(
Composite group,
Listener listener)
- Creates a new "Browse..." pushbutton instance and sets the default
layout data.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the button into. -
listener - object to listen for events. Can be null.
createBrowseButton
public static
Button createBrowseButton(
Composite group,
Listener listener,
String tooltip)
-
Deprecated.
- Creates a new "Browse..." pushbutton instance and sets the default
layout data, with tooltip text.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the button into. -
listener - object to listen for events. Can be null. -
tooltip - the tooltip text
createListBox
public static
List createListBox(
Composite group,
String label,
Listener listener,
boolean multiSelect)
- Creates a new listbox instance and sets the default
layout data.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the button into. -
label - to display above the list box (can be null). -
listener - object to listen for events. Can be null. -
multiSelect - true if this is to be a multiple selection list. False for single selection.
createListBox
public static
List createListBox(
Composite group,
String label,
Listener listener,
boolean multiSelect,
int columnSpan)
- Creates a new listbox instance and sets the default
layout data.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the button into. -
label - to display above the list box (can be null). -
listener - object to listen for events. Can be null. -
multiSelect - true if this is to be a multiple selection list. False for single selection. -
columnSpan - number of columns this should span
createListBox
public static
List createListBox(
Composite group,
String label,
Listener listener,
boolean multiSelect,
String tooltip)
- Creates a new listbox instance and sets the default
layout data.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the button into. -
label - to display above the list box (can be null). -
listener - object to listen for events. Can be null. -
multiSelect - true if this is to be a multiple selection list. False for single selection. -
tooltip - the tooltip
createListBox
public static
List createListBox(
Composite group,
Listener listener,
boolean multiSelect,
String label,
String tooltip)
- Creates a new listbox instance and sets the default
layout data.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
group - composite to put the button into. -
listener - object to listen for events. Can be null. -
multiSelect - true if this is to be a multiple selection list. False for single selection. -
label - the label -
tooltip - the tooltip
createCombo
public static
Combo createCombo(
Composite parent,
Listener listener)
- Creates a new combobox instance and sets the default
layout data.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
parent - composite to put the button into. -
listener - object to listen for selection events. Can be null.
If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
createCombo
public static
Combo createCombo(
Composite parent,
Listener listener,
String toolTip)
- Creates a new combobox instance and sets the default
layout data, with tooltip text.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
parent - composite to put the combo into. -
listener - object to listen for selection events. Can be null.
If you want to listen for modify events, call addListener(SWT.Modify,this) on your own. -
toolTip - tooltip text
createLabeledCombo
public static
Combo createLabeledCombo(
Composite parent,
Listener listener,
String label,
String tooltip)
- Create a labeled combo field and insert it into a GridLayout, and assign tooltip text.
Assign the listener to the passed in implementer of Listener.
If you need a handle to the prompting label, immediately call
getLastLabel()
-
-
Parameters:
-
parent - composite to put the field into. -
listener - object to listen for selection events. Can be null.
If you want to listen for modify events, call addListener(SWT.Modify,this) on your own. -
label - the label text -
tooltip - the tooltip for the combo field
-
Returns:
- Combo created.
createReadonlyCombo
public static
Combo createReadonlyCombo(
Composite parent,
Listener listener)
- Creates a new readonly combobox instance and sets the default
layout data.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
parent - composite to put the button into. -
listener - object to listen for selection events. Can be null.
If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
createReadonlyCombo
public static
Combo createReadonlyCombo(
Composite parent,
Listener listener,
String tooltip)
- Creates a new readonly combobox instance and sets the default
layout data, with tooltip text.
Assign the listener to the passed in implementer of Listener.
-
-
Parameters:
-
parent - composite to put the button into. -
listener - object to listen for selection events. Can be null.
If you want to listen for modify events, call addListener(SWT.Modify,this) on your own. -
tooltip -
createLabeledReadonlyCombo
public static
Combo createLabeledReadonlyCombo(
Composite parent,
Listener listener,
String labelText,
String tooltip)
- Create a labeled readonly combo field and insert it into a GridLayout, and assign tooltip text.
Assign the listener to the passed in implementer of Listener.
If you need a handle to the prompting label, immediately call
getLastLabel()
-
-
Parameters:
-
parent - composite to put the field into. -
listener - object to listen for selection events. Can be null.
If you want to listen for modify events, call addListener(SWT.Modify,this) on your own. -
labelText - the label -
tooltip - the tooltip
-
Returns:
- Combo created.
createHistoryCombo
public static
SystemHistoryCombo createHistoryCombo(
Composite parent,
SelectionListener listener,
String historyKey,
boolean readonly,
String tooltip)
- Creates a new historical combobox instance and sets the default
layout data, with tooltip text.
Assign the listener to the passed in implementer of Listener.
A historical combobox is one that persists its contents between sessions. The management
of that persistence is handled for you!.
-
-
Parameters:
-
parent - composite to put the combo into. -
listener - object to listen for selection events. Can be null.
If you want to listen for modify events, call addListener(SWT.Modify,this) on your own. -
historyKey - the preferences key (any unique string) to use to persist this combo's history -
readonly - true if this combo is to be readonly, forcing user to select from the history -
tooltip - the tooltip
createConnectionCombo
public static
SystemHostCombo createConnectionCombo(
Composite parent,
SelectionListener listener,
IRSESystemType[] systemTypes,
ISubSystemConfiguration factory,
String factoryId,
String factoryCategory,
IHost defaultConnection,
int horizontalSpan,
boolean newButton)
- Creates a new remote system connection combobox instance and sets the default
layout data, with tooltip text.
Assign the listener to the passed in implementer of Listener.
A remote system connection combobox is one that allows users to select a connection. The connection
list can be subsetted by system type, subsystem factory or subsystem factory category.
It has a "Connection:" prompt in front of it and optionally a "New..." button beside it.
-
-
Parameters:
-
parent - composite to put the combo into. -
listener - object to listen for selection events. Can be null.
If you want to listen for modify events, call addSelectionListener(...) on your own. -
systemTypes - array of system types to subset connection list by. Specify a single entry of '*' for
all system types. Specify this OR specify factory OR specify factoryCategory
OR specify factory Id -
factory - the subsystem factory to subset connection list by. Only connections with a subsystem
owned by this factory are listed. Specify this OR specify systemTypes OR specify factoryCategory
OR specify factory Id -
factoryId - the subsystem factory id to subset connection list by. Only connections with a
subsystem owned by this factory are listed, where id is a string specified in the
plugin.xml file for the subsystem factory extension point definition.
Specify this OR specify factory OR specify systemTypes OR specify factory category -
factoryCategory - the subsystem factory category to subset connection list by. Only connections with a
subsystem owned by a factory of this category are listed, where category is a string specified in the
plugin.xml file for the subsystem factory extension point definition.
Specify this OR specify factory OR specify factory Id OR specify systemTypes -
defaultConnection - the connection to pre-select. Can be null. -
horizontalSpan - number of columns this should span -
newButton - true if the combo is to have a "New..." button beside it
getValidSystemTypes
public static
IRSESystemType[] getValidSystemTypes(
String[] restrictIds)
- Return the list of all registered valid system types.
A system type is considered valid, if at least one subsystem
configuration is registered against it, and the system type
is enabled in the Preferences.
The list is ordered alphabetically by system type label
according to international unicode rules, in the current Locale.
-
-
Parameters:
-
restrictIds - An array of system type IDs to restrict the
returned list of valid system types to only those requested,
or null to return all valid system types.
-
Returns:
- an ordered list of all registered valid system types.
sortSystemTypesByLabel
public static void sortSystemTypesByLabel(
IRSESystemType[] systemTypes)
- Sorts the given array of systemTypes in ascending order by system
type label.
Note that this method sorts the array in place, so clients are
responsible for creating a copy of the array when needed.
Labels are sorted with a Collator according to international
unicode rules, in the current Locale.
-
-
Parameters:
-
systemTypes - list of system types to sort
getSystemTypeLabels
public static
String[] getSystemTypeLabels(
IRSESystemType[] systemTypes)
- Return the labels for the given list of system types.
-
-
Parameters:
-
systemTypes - an array of system types
-
Returns:
- the String labels for the system types.
createSystemTypeCombo
public static
Combo createSystemTypeCombo(
Composite parent,
Listener listener,
IRSESystemType[] systemTypes)
- Creates a readonly system type combination box with the given system types.
Does NOT create the leading prompt or anything except the combo.
In order to find out what system type was selected, clients need to
use
Combo.getSelectionIndex() and use the return value as
an index into the array of system types they provided.
-
-
Parameters:
-
parent - the parent composite to embed this widget in. -
listener - a listener for selection events. -
systemTypes - an array of system types to show in this Combo.
Must not be null .
Fill this with the result of
getValidSystemTypes(String[])
with a null argument in order to get a combo box with all valid
system types.
-
Returns:
- a Combo box displaying the given system types.
createHostNameCombo
public static
Combo createHostNameCombo(
Composite parent,
Listener listener,
IRSESystemType systemType)
- Creates a hostname combination box. It if prefilled with all previously specified hostnames
for the given system type.
Does NOT create the leading prompt or anything except the combo.
-
createInheritableTextField
public static
InheritableEntryField createInheritableTextField(
Composite parent,
String toggleToolTip,
String entryToolTip)
- Create an entry field controlled by an inherit/override switch button
After creating the widget, call setLocal to set initial state, and setInheritedText/setLocalText to set inherited/local text
-
-
Parameters:
-
parent - composite to put the button into. -
toggleToolTip - text for the toggle. Can be null -
entryToolTip - text for the entry field. Can be null
-
Returns:
- The text field widget
lineUpPrompts
public static void lineUpPrompts(
Composite composite)
- Helper method to line up the leading prompts in a composite, taking
into account composite prompts nested within.
-
getFirstColumnOneLabel
public static
Label getFirstColumnOneLabel(
Composite composite)
- Given a composite that has been layed out, return the first label found in the first column.
-
setMnemonics
public static
Mnemonics setMnemonics(
Composite parent)
- Given a Composite, this method walks all the children recursively and
and sets the mnemonics uniquely for each child control where a
mnemonic makes sense (eg, buttons).
The letter/digit chosen for the mnemonic is unique for this Composite,
so you should call this on as high a level of a composite as possible
per Window.
Call this after populating your controls.
-
-
Returns:
- mnemonics object used for recording used-mnemonics. Use this
as input to subsequent calls to setMnemonics for the same window/dialog.
setMnemonics
public static
Mnemonics setMnemonics(
Composite parent,
boolean applyToPrecedingLabels)
- Same as above but also whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields.
-
setWizardPageMnemonics
public static
Mnemonics setWizardPageMnemonics(
Composite parent)
- Same as above but specifically for wizard pages
-
setWizardPageMnemonics
public static
Mnemonics setWizardPageMnemonics(
Composite parent,
boolean applyToPrecedingLabels)
- Same as above but also whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields.
-
setPreferencePageMnemonics
public static
Mnemonics setPreferencePageMnemonics(
Composite parent)
- Same as above but specifically for preference pages
-
setPreferencePageMnemonics
public static
Mnemonics setPreferencePageMnemonics(
Composite parent,
boolean applyToPrecedingLabels)
- Same as above but also whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields.
-
setMnemonics
public static
Mnemonics setMnemonics(
Mnemonics mnemonics,
Composite parent)
- Same as above but takes as input a previously populated mnemonics object,
which records already-used mnemonics for whatever scope you want (a dialog usually).
-
setMnemonics
public static void setMnemonics(
Menu menu)
- Given an SWT Menu, "walk it" and automatically assign unique
mnemonics for every menu item in it, and then for each
submenu, do so for it too.
-
-
Parameters:
-
menu - the menubar to add mnemonics for
setCompositeHelp
public static void setCompositeHelp(
Composite parent,
String helpID)
- Given a Composite, this method walks all the children recursively and
and sets the infopop help id for each child control where help
makes sense (eg, buttons, combos, entry fields, lists, trees).
Call this after populating your controls.
-
setHelp
public static void setHelp(
Control c,
IViewPart view,
Object id)
-
Deprecated.
- Set the context id for a control on a view part
-
setHelp
public static void setHelp(
Control c,
String id)
- Set the context id for a control
-
setHelp
public static void setHelp(
IAction c,
String id)
- Set the context id for an action
-
setHelp
public static void setHelp(
MenuItem c,
String id)
- Set the context id for a menu item
-
appendColon
public static
String appendColon(
String label)
- Appends a colon to a label, if the label doesn't already end in a colon of the proper size.
If the wrong size colon is already there, it strips it first.
-
-
Parameters:
-
label - the label which to examine for a colon
-
Returns:
- the label ending with a colon of the appropriate size
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.
|
|
|