IBrowserConnection browserConnection = getBrowserConnection();
if ( browserConnection != null )
{
// Getting the current quick search
IQuickSearch quickSearch = widget.getQuickSearch();
// Creating a new quick search with the currently selected entry
// if there's no current quick search or quick search isn't selected
if ( ( quickSearch == null ) || !isQuickSearchSelected() )
{
// Setting a default search base on Root DSE
IEntry searchBase = browserConnection.getRootDSE();
// Getting the selected entry
IEntry selectedEntry = getSelectedEntry();
if ( selectedEntry != null )
{
// Setting the selected entry as search base
searchBase = selectedEntry;
}
// Creating a new quick search
quickSearch = new QuickSearch( searchBase, browserConnection );
widget.setQuickSearch( quickSearch );
}
// Creating and opening the dialog
PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn( getShell(), quickSearch,
BrowserCommonConstants.PROP_SEARCH, null, null );
dialog.getShell().setText(
NLS.bind( Messages.getString( "PropertiesAction.PropertiesForX" ), //$NON-NLS-1$
Utils.shorten( quickSearch.getName(), 30 ) ) );
if ( dialog.open() == PreferenceDialog.OK )
{
// Performing the quick search if it has not been performed before
// (ie. the quick search was not modified at in the dialog)
if ( quickSearch.getSearchResults() == null )
{
new StudioBrowserJob( new SearchRunnable( new ISearch[]
{ quickSearch } ) ).execute();
}
}