use of org.eclipse.ui.dialogs.ElementListSelectionDialog in project bndtools by bndtools.
the class ProjectLaunchTabPiece method doBrowseProject.
void doBrowseProject() {
ElementListSelectionDialog dialog = new ElementListSelectionDialog(launchTargetTxt.getShell(), new WorkbenchLabelProvider());
dialog.setTitle("Project Selection");
dialog.setMessage("Select a project to constrain your search.");
List<IProject> projects = loadProjects();
dialog.setElements(projects.toArray());
if (Window.OK == dialog.open()) {
IProject selected = (IProject) dialog.getFirstResult();
launchTargetTxt.setText(selected.getName());
}
}
use of org.eclipse.ui.dialogs.ElementListSelectionDialog 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