Button btnBrowsePackage = new Button(container, SWT.NONE);
btnBrowsePackage.setText("...");
btnBrowsePackage.addSelectionListener(new SelectionListenerAdapter(){
public void widgetSelected(SelectionEvent e)
{
super.widgetSelected(e);
IJavaProject javaProject = JavaCore.create(getCurrentProject());
SelectionDialog dialog = null;
try
{
dialog = JavaUI.createPackageDialog(getSite().getShell(),
javaProject,IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS);
} catch (JavaModelException e1)
{
ExceptionHandler.handleExceptionAndAbort(e1);
}
if (dialog.open() != Window.OK)
{
return;
}
IPackageFragment pck = (IPackageFragment) dialog.getResult()[0];
if (pck != null)
{
txtPackageName.setText(pck.getElementName());
}
}
});