{
IEntry[] entries = BrowserSelectionUtils.getEntries( selection );
ISearchResult[] searchResults = BrowserSelectionUtils.getSearchResults( selection );
IBookmark[] bookmarks = BrowserSelectionUtils.getBookmarks( selection );
ISearch[] searches = BrowserSelectionUtils.getSearches( selection );
EntryEditorManager entryEditorManager = BrowserUIPlugin.getDefault().getEntryEditorManager();
if ( entries.length + searchResults.length + bookmarks.length + searches.length == 1 )
{
if ( ( entries.length == 1 ) || ( searchResults.length == 1 ) || ( bookmarks.length == 1 ) )
{
entryEditorManager.openEntryEditor( entries, searchResults, bookmarks );
}
else if ( searches.length == 1 )
{
try
{
SearchResultEditorInput input = new SearchResultEditorInput( searches[0] );
view.getSite().getPage().openEditor( input, SearchResultEditor.getId(), false );
}
catch ( PartInitException e )
{
}
}
}
// Checking if there's at least one entry editor open.
// We need to blank it
else if ( isOneOrMoreOpenSingleTabEntryEditors() )
{
entryEditorManager.openEntryEditor( new IEntry[0], new ISearchResult[0], new IBookmark[0] );
}
}
}