public int compare( Viewer viewer, Object o1, Object o2 )
{
// o1 is StudioConnectionRunnableWithProgress
if ( o1 instanceof StudioConnectionRunnableWithProgress )
{
StudioConnectionRunnableWithProgress runnable = ( StudioConnectionRunnableWithProgress ) o1;
for ( Object lockedObject : runnable.getLockedObjects() )
{
if ( lockedObject instanceof ISearch )
{
ISearch search = ( ISearch ) lockedObject;
if ( o1 == search.getTopSearchRunnable() )
{
return lessThanEntries();
}
else if ( o1 == search.getNextSearchRunnable() )
{
return greaterThanEntries();
}
}
else if ( lockedObject instanceof IEntry )
{
IEntry entry = ( IEntry ) lockedObject;
if ( o1 == entry.getTopPageChildrenRunnable() )
{
return lessThanEntries();
}
else if ( o1 == entry.getNextPageChildrenRunnable() )
{
return greaterThanEntries();
}
}
}
return lessThanEntries();
}
// o2 is StudioConnectionRunnableWithProgress
if ( o2 instanceof StudioConnectionRunnableWithProgress )
{
StudioConnectionRunnableWithProgress runnable = ( StudioConnectionRunnableWithProgress ) o2;
for ( Object lockedObject : runnable.getLockedObjects() )
{
if ( lockedObject instanceof ISearch )
{
ISearch search = ( ISearch ) lockedObject;