{
final IEntry parentEntry = ( IEntry ) parent;
if ( parentEntry instanceof IContinuation )
{
IContinuation continuation = ( IContinuation ) parentEntry;
if ( continuation.getState() == State.UNRESOLVED )
{
continuation.resolve();
}
if ( continuation.getState() == State.CANCELED )
{
return new Object[0];
}
}
if ( !parentEntry.isChildrenInitialized() )
{
new StudioBrowserJob( new InitializeChildrenRunnable( false, parentEntry ) ).execute();
return new String[]
{ Messages.getString( "BrowserContentProvider.FetchingEntries" ) }; //$NON-NLS-1$
}
else if ( parentEntry.getChildrenCount() <= preferences.getFoldingSize() || !preferences.isUseFolding() )
{
if ( entryToEntryPagesMap.containsKey( parentEntry ) )
{
entryToEntryPagesMap.remove( parentEntry );
}
IEntry[] results = parentEntry.getChildren();
List<Object> objects = new ArrayList<Object>();
if ( widget.getQuickSearch() != null
&& parentEntry.getDn().equals( widget.getQuickSearch().getSearchBase() ) )
{
objects.add( widget.getQuickSearch() );
}
if ( parentEntry.getTopPageChildrenRunnable() != null )
{
objects.add( parentEntry.getTopPageChildrenRunnable() );
}
objects.addAll( Arrays.asList( results ) );
if ( parentEntry.getNextPageChildrenRunnable() != null )
{
objects.add( parentEntry.getNextPageChildrenRunnable() );
}
return objects.toArray();
}
else
{
BrowserEntryPage[] entryPages = getEntryPages( parentEntry );
List<Object> objects = new ArrayList<Object>();
if ( widget.getQuickSearch() != null
&& parentEntry.getDn().equals( widget.getQuickSearch().getSearchBase() ) )
{
objects.add( widget.getQuickSearch() );
}
objects.addAll( Arrays.asList( entryPages ) );
return objects.toArray();
}
}
else if ( parent instanceof BrowserSearchResultPage )
{
BrowserSearchResultPage srPage = ( BrowserSearchResultPage ) parent;
Object[] objects = srPage.getChildren();
if ( objects == null )
{
return new String[]
{ Messages.getString( "BrowserContentProvider.FetchingSearchResults" ) }; //$NON-NLS-1$
}
else if ( objects instanceof ISearchResult[] )
{
ISearchResult[] srs = ( ISearchResult[] ) objects;
return srs;
}
else
{
return objects;
}
}
else if ( parent instanceof ISearch )
{
ISearch search = ( ISearch ) parent;
if ( search instanceof IContinuation )
{
IContinuation continuation = ( IContinuation ) search;
if ( continuation.getState() == State.UNRESOLVED )
{
continuation.resolve();
}
if ( continuation.getState() == State.CANCELED )
{
return new Object[0];
}
}