//created the HistoryElementListSelectionDialog instead of using the ElementListSelectionDialog directly because:
//1. No sorting should be enabled for choosing the history
//2. The last element should be the one selected by default
//3. The list should be below the commands
//4. The up arrow should be the one used to get focus in the elements
HistoryElementListSelectionDialog dialog = new HistoryElementListSelectionDialog(Display.getDefault()
.getActiveShell(), getLabelProvider());
dialog.setTitle("Command history");
dialog.setElements(selectFrom.toArray(new String[0]));
dialog.setEmptySelectionMessage("No command selected");
dialog.setAllowDuplicates(true);
dialog.setBlockOnOpen(true);
dialog.setSize(100, 25); //in number of chars
dialog.setMessage("Select command(s) to be executed");
dialog.setMultipleSelection(true);
if (dialog.open() == SelectionDialog.OK) {
Object[] result = dialog.getResult();
if (result != null) {
ArrayList<String> list = new ArrayList<String>();
for (Object o : result) {
list.add(o.toString());
}