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 ui.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. |
createScrolledComposite() | Create a new composite inside of a scrolled composite. |
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]) throws Throwable
Add a generic control.
control instance
Button createButton(Object labelOrImage, Object callback, [String layout]) throws Throwable
Create a push button.
button instance
Button createCheckBox(String label, [boolean selected], [Object callback], [String layout]) throws Throwable
Create a checkbox.
checkbox instance
ComboViewer createComboViewer(Object[] elements, [boolean editable], [Object callback], [String layout]) throws Throwable
Create a combo box. The first element will automatically be selected.
true
to allow users to enter custom entriesOptional: defaults to <als>.combo viewer instance
ViewerComparator createComparator(StructuredViewer viewer, [Object categoryCallback], [Object compareCallback]) throws Throwable
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]) throws Throwable
Create a new composite. To activate the composite (and create elements inside) use pushComposite().
composite instance
org.eclipse.ease.modules.platform.uibuilder.ScriptableDialog createDialog(Object layoutCode, [String title], [String message]) throws Throwable
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]) throws Throwable
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) throws Throwable
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]) throws Throwable
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]) throws Throwable
Create a list viewer.
list viewer instance
ProgressBar createProgressBar([int value], [int maximum], [String layout]) throws Throwable
Create a progress bar.
progress bar instance
Button createRadioButton(String label, [boolean selected], [Object callback], [String layout]) throws Throwable
Create a radio button.
radio button instance
Composite createScrolledComposite([String layout]) throws Throwable
Create a new composite inside of a scrolled composite. Scrollbars will be added dynamically in case the content does not fit into the composite area. To activate the composite (and create elements inside) use pushComposite().
composite instance
Label createSeparator([boolean horizontal], [String layout]) throws Throwable
Create a separator.
true
for horizontal, false
for verticalOptional: defaults to <ru>.separator instance
TableViewer createTableViewer(Object[] elements, [Object callback], [String layout]) throws Throwable
Create a table viewer. To enhance look and feel create columns using createViewerColumn().
table viewer instance
Text createText([String layout]) throws Throwable
Create a single line text input.
text instance
Text createTextBox([String layout]) throws Throwable
Create a multi line text input.
text instance
TreeViewer createTreeViewer(Object[] rootElements, Object getChildrenCallback, [Object callback], [String layout]) throws Throwable
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]) throws Throwable
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]) throws Throwable
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 <ru>.