| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> |
| <html> |
| <head> |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <link rel="STYLESHEET" href="../book.css" charset="ISO-8859-1" type="text/css"> |
| <title>Creating Java specific prompter dialogs</title> |
| <link rel="stylesheet" type="text/css" href="../book.css"> |
| </head> |
| <body> |
| <h3>Creating Java specific prompter dialogs</h3> |
| <p> The following snippet uses the <b><a href="../reference/api/org/eclipse/jdt/ui/JavaUI.html">JavaUI</a> </b>class to open the Open Type dialog:</p> |
| <pre><font color="#4444cc"> 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]; |
| }</font></pre> |
| <p> <a href="../reference/api/org/eclipse/jdt/ui/JavaUI.html"><b>JavaUI</b></a> |
| provides additional methods for creating Open Package and Open Main Type dialogs. |
| </p> |
| |
| </body> |
| </html> |