Create UI elements by adding SWT controls via script commands to a dynamic GridLayout. Each element allows to provide layout data, which accepts a fairly simple syntax: <coordinates> <horizontal align> <vertical align>
Most methods of this module deal with SWT components. To access them the code needs to be run in the UI thread. See executeUI() for more information.
Whenever callback code is registered the executing engine is automatically set to be kept alive after script execution. This is required as callback execution needs a script engine.
Method | Description |
---|---|
addControl() | Add a generic control. |
createButton() | Create a push button. |
createCheckBox() | Create a checkbox. |
createComboViewer() | Create a combo box. |
createComparator() | Create a comparator (sorter) to be used for combos, lists or tables. |
createComposite() | Create a new composite. |
createDialog() | Create a dialog with scripted content. |
createGroup() | Create a group composite. |
createImage() | Create an image instance. |
createLabel() | Create a label. |
createLabelProvider() | Create a label provider to be used for combos, lists or tables. |
createListViewer() | Create a list viewer. |
createProgressBar() | Create a progress bar. |
createRadioButton() | Create a radio button. |
createSeparator() | Create a separator. |
createTableViewer() | Create a table viewer. |
createText() | Create a single line text input. |
createTextBox() | Create a multi line text input. |
createTreeViewer() | Create a tree viewer. |
createView() | Create a view with scripted content. |
createViewerColumn() | Create a column for a table viewer. |
getComposite() | Get the active composite. |
getProviderElement() | Get the current element for the label/content provider. |
getUiEvent() | Get the current event in case we are within a UI callback method. |
popComposite() | Remove the current composite from the composite stack. |
pushComposite() | Sets the active composite for further commands. |
removeControl() | Remove a control. |
setColumnCount() | Set the minimum column count. |
showGrid() | Display a grid aiding in layouting. |
Control addControl(Control control, [String layout])
Add a generic control.
control instance
Button createButton(Object labelOrImage, Object callback, [String layout])
Create a push button.
button instance
Button createCheckBox(String label, [boolean selected], [Object callback], [String layout])
Create a checkbox.
checkbox instance
ComboViewer createComboViewer(Object elements, [Object callback], [String layout])
Create a combo box. The first element will automatically be selected.
combo viewer instance
ViewerComparator createComparator(StructuredViewer viewer, [Object categoryCallback], [Object compareCallback])
Create a comparator (sorter) to be used for combos, lists or tables. The comparator is automatically attached to the provided viewer.
the viewer comparator
Composite createComposite([String layout])
Create a new composite. Further create commands will target this composite. To revert back to the parent use popComposite().
composite instance
org.eclipse.ease.modules.platform.uibuilder.ScriptableDialog createDialog(Object layoutCode, [String title], [String message])
Create a dialog with scripted content. To populate the dialog we need to provide a callback method that creates UI elements for the dialog area. After the setup the dialog can be shown by calling dialog.open(). To retrieve input data after the dialog got closed call dialog.getData(uiComponent).
dialog instance
Group createGroup([String label], [String layout])
Create a group composite. Further create commands will target this composite. To revert back to the parent use popComposite().
group instance
Image createImage(String location)
Create an image instance. Images will not directly be displayed. Instead they can be used when creating controls or views. When an image is created, its lifecycle gets bound to the current composite. When the composite gets disposed also all images bound to that composite get disposed.
image instance
Label createLabel(Object labelOrImage, [String layout])
Create a label.
label instance
ColumnLabelProvider createLabelProvider([Object textCallback], [Object imageCallback])
Create a label provider to be used for combos, lists or tables. While the callback is executed you may call getProviderElement() to get the current element.
label provider instance
ListViewer createListViewer(Object elements, [Object callback], [String layout])
Create a list viewer.
list viewer instance
ProgressBar createProgressBar([int value], [int maximum], [String layout])
Create a progress bar.
progress bar instance
Button createRadioButton(String label, [boolean selected], [Object callback], [String layout])
Create a radio button.
radio button instance
Label createSeparator([boolean horizontal], [String layout])
Create a separator.
true
for horizontal, false
for verticalOptional: defaults to <true>.separator instance
TableViewer createTableViewer(Object elements, [Object callback], [String layout])
Create a table viewer. To enhance look and feel create columns using createViewerColumn().
table viewer instance
Text createText([String layout])
Create a single line text input.
text instance
Text createTextBox([String layout])
Create a multi line text input.
text instance
TreeViewer createTreeViewer(Object rootElements, Object getChildrenCallback, [Object callback], [String layout])
Create a tree viewer. To enhance look and feel create columns using createViewerColumn().
tree viewer instance
MPart createView(String title, [String iconUri], [String relativeTo], [String position])
Create a view with scripted content. Automatically sets the active composite for further commands. This view will not be stored when the workbench gets closed.
view instance
ViewerColumn createViewerColumn(ColumnViewer viewer, String title, [BaseLabelProvider labelProvider], [int weight])
Create a column for a table viewer. The viewer will automatically use a weighted layout for columns, distributing the horizontal space on all columns depending on their weight.
table viewer column
Object getProviderElement()
Get the current element for the label/content provider. Only valid while a provider callback is evaluated.
the element for the current provider evaluation or null
Object getUiEvent()
Get the current event in case we are within a UI callback method.
current UI event or null
Composite popComposite()
Remove the current composite from the composite stack. For the topmost composite this method does nothing.
current composite after the removal
void pushComposite(Composite composite)
Sets the active composite for further commands. The composite layout will be set to GridLayout if not already done. When creating multiple composites you may return to a previous one using popComposite().
void removeControl(Object controlOrLocation)
Remove a control.
void setColumnCount(int columns)
Set the minimum column count. If the current column count is already equal or higher then this method does nothing.
void showGrid([boolean showGrid])
Display a grid aiding in layouting. When the grid is displayed, empty cells do show a label with their location coordinates.
true
to display.Optional: defaults to <true>.