blob: 004db6dd3a403a603a3b7c577b1771381b30c596 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta name="copyright" content=
"Copyright (c) IBM Corporation and others 2000, 2011. 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=utf-8" />
<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 class="color1">
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];
}
</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>