JDT UI 外掛程式會提供一個 public 程式類別 JavaUI, 可讓您以程式設計方式來呼叫 JDT 使用者介面。
下列片段可讓類型提示程式對話框開啟:
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];
}