Creating Java specific prompter dialogs

The following snippet uses the JavaUI class to open the Open Type dialog:

    public IType selectType() throws JavaModelException {
        Shell parent = ...;
        SelectionDialog dialog= JavaUI.createTypeDialog(
            parent, new ProgressMonitorDialog(parent),
            SearchEngine.createWorkspaceScope(),
            IJavaElementSearchConstants.CONSIDER_ALL_TYPES, false);
        dialog.setTitle("My Dialog Title");
        dialog.setMessage("My Dialog Message");
        if (dialog.open() == IDialogConstants.CANCEL_ID)
            return null;

        Object[] types= dialog.getResult();
        if (types == null || types.length == 0)
            return null;
        return (IType)types[0];
    }

JavaUI provides additional methods for creating Open Package and Open Main Type dialogs.