Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Nebula Launcher
Introduction
A widget used to launch applications, modules or anything, with a simple and fancy zoom effect, widely inspired by work of Romain Guy.
Contents
Usage
This launcher contains 4 methods :
- 2 methods to add and remove selection listeners (
addSelectionListener
andremoveSelectionListener
) - One method to add and item :
void addItem(final String title, final String image)
where title is the text located under the image - A method to get the selected item :
int getSelection()
final Launcher l = new Launcher(shell, SWT.NONE); l.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); l.addItem("Address Book", "org/mihalis/opal/launcher/icons/x-office-address-book.png"); l.addItem("Calendar", "org/mihalis/opal/launcher/icons/x-office-calendar.png"); l.addItem("Presentation", "org/mihalis/opal/launcher/icons/x-office-presentation.png"); l.addItem("Spreadsheet", "org/mihalis/opal/launcher/icons/x-office-spreadsheet.png"); l.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { Dialog.inform("Selection", "You have selected item #" + l.getSelection()); } });
You can customize the widget:
- Set the background color for unselected and selected items (setItemBackgroundColor and setSelectedItemBackgroundColor
- Set the number of columns : setNumberOfColumns. By default, the number of columns is the number of items divided by 2
- Set the font for the blocks : setFont
- Change the selection mode : setSingleClickSelection(true) if the selection is done on click, setSingleClickSelection(false) if the selection is done on double click (default behaviour)
Example
2 examples called LauncherSnippet and LauncherSnippetAdvanced are located in the plugin org.eclipse.nebula.widgets.opal.launcher.snippets.
These examples are also available here :