use of org.eclipse.ui.dialogs.EditorSelectionDialog in project yamcs-studio by yamcs.
the class OpenWithMenu method createOtherMenuItem.
/**
* Creates the Other... menu item
*
* @param menu
* the menu to add the item to
*/
private void createOtherMenuItem(final Menu menu) {
IFile fileResource = getFileResource();
if (fileResource == null) {
return;
}
new MenuItem(menu, SWT.SEPARATOR);
MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
menuItem.setText("Other...");
menuItem.addListener(SWT.Selection, evt -> {
EditorSelectionDialog dialog = new EditorSelectionDialog(menu.getShell());
dialog.setMessage("Choose the editor for opening " + fileResource.getName());
if (dialog.open() == Window.OK) {
IEditorDescriptor editor = dialog.getSelectedEditor();
if (editor != null) {
openEditor(editor, editor.isOpenExternal());
}
}
});
}
Aggregations