Feature request: Add window.promptSelection to Init.js
ThomasRohde opened this issue · 3 comments
ThomasRohde commented
I suggest to add a selection prompt to Init.js, prompting the user to select from a list of given string options. Suggested implementation in Init.js:
window.promptSelection = function (title, choices) {
var ElementListSelectionDialog = Java.type('org.eclipse.ui.dialogs.ElementListSelectionDialog');
var LabelProvider = Java.type('org.eclipse.jface.viewers.LabelProvider');
var dialog = new ElementListSelectionDialog(shell, new LabelProvider());
dialog.setElements(choices);
dialog.setTitle(title);
dialog.open();
result = dialog.getResult();
if (result) return new String(result);
else return null;
}
Phillipus commented
Sure I could add it, or you could submit a Pull Request if you prefer?
ThomasRohde commented
Please do. I'm not familiar with the process :-)
Phillipus commented
OK, I added it with a small modification to return the first element.