use of org.eclipse.jdt.ui.JavaElementLabelProvider in project bndtools by bndtools.
the class NewTypeWizardPage method choosePackage.
// selection dialogs
/**
* Opens a selection dialog that allows to select a package.
*
* @return returns the selected package or <code>null</code> if the dialog has been canceled. The caller typically
* sets the result to the package input field.
* <p>
* Clients can override this method if they want to offer a different dialog.
* </p>
* @since 3.2
*/
protected IPackageFragment choosePackage() {
IPackageFragmentRoot froot = getPackageFragmentRoot();
IJavaElement[] packages = null;
try {
if (froot != null && froot.exists()) {
packages = froot.getChildren();
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
if (packages == null) {
packages = new IJavaElement[0];
}
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT));
dialog.setIgnoreCase(false);
dialog.setTitle(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_title);
dialog.setMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_description);
dialog.setEmptyListMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_empty);
dialog.setElements(packages);
dialog.setHelpAvailable(false);
IPackageFragment pack = getPackageFragment();
if (pack != null) {
dialog.setInitialSelections(new Object[] { pack });
}
if (dialog.open() == Window.OK) {
return (IPackageFragment) dialog.getFirstResult();
}
return null;
}
Aggregations