Creating Java specific prompter dialogs

The JDT UI plug-in provides the utility class JavaUI, which allows you to programmatically invoke the JDT user interface.

The following snippet causes a type prompter dialog to open:

public IType selectType() throws JavaModelException {
    SelectionDialog dialog=

        JavaUI.createTypeDialog(parent, new ProgressMonitorDialog(parent),
            SearchEngine.createWorkspaceScope(), IJavaElementSearchConstants.CONSIDER_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];      

}


In addition to methods for creating a  type prompter dialog the class JavaUI provides additional methods for creating package and main type prompter dialogs as well.

Copyright IBM Corporation and others 2000, 2002. All Rights Reserved.