Bug 331018 - Approve and include dependencies for the tests
Remove Abbot dependencies and reimplement UI tests with SWTBot 
diff --git a/tests/org.eclipse.platform.discovery.core.test.unit/src/org/eclipse/platform/discovery/core/test/unit/internal/SearchConsoleControllerFixture.java b/tests/org.eclipse.platform.discovery.core.test.unit/src/org/eclipse/platform/discovery/core/test/unit/internal/SearchConsoleControllerFixture.java
index 1a09710..2344bfd 100644
--- a/tests/org.eclipse.platform.discovery.core.test.unit/src/org/eclipse/platform/discovery/core/test/unit/internal/SearchConsoleControllerFixture.java
+++ b/tests/org.eclipse.platform.discovery.core.test.unit/src/org/eclipse/platform/discovery/core/test/unit/internal/SearchConsoleControllerFixture.java
@@ -23,6 +23,8 @@
 import org.eclipse.platform.discovery.runtime.internal.model.descriptions.ISearchProviderDescription;
 import org.eclipse.platform.discovery.testutils.utils.jmock.Mock;
 import org.eclipse.platform.discovery.testutils.utils.jmock.MockObjectTestCase;
+import org.eclipse.platform.discovery.testutils.utils.model.DestinationCategoryDescriptionBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.ObjectTypeDescriptionBuilder;
 import org.eclipse.platform.discovery.util.api.env.IDiscoveryEnvironment;
 import org.eclipse.platform.discovery.util.api.env.IErrorHandler;
 import org.eclipse.platform.discovery.util.api.longop.ILongOperationRunner;
@@ -39,15 +41,15 @@
 	protected Mock<ISearchProviderConfiguration> providerConfig;

 	protected Mock<ISearchConsoleControllerOutputView> view;

 

-	protected Mock<IObjectTypeDescription> objectType_1;

-	protected Mock<IObjectTypeDescription> objectType_2;

+	protected IObjectTypeDescription objectType_1;

+	protected IObjectTypeDescription objectType_2;

 	protected static final String OBJECT_TYPE_1_ID = "object1id";

 	protected static final String OBJECT_TYPE_2_ID = "object2id";

 

 	protected Mock<ISearchProviderDescription> searchProviderDescr_1;

-	protected Mock<IDestinationCategoryDescription> destinationCategory1;

-	protected Mock<IDestinationCategoryDescription> destinationCategory2;

-	protected Mock<IDestinationCategoryDescription> destinationCategory3;

+	protected IDestinationCategoryDescription destinationCategory1;

+	protected IDestinationCategoryDescription destinationCategory2;

+	protected IDestinationCategoryDescription destinationCategory3;

 

 	protected List<IDestinationCategoryDescription> destinationCategories_obj1;

 	protected List<IDestinationCategoryDescription> destinationCategories_obj2;

@@ -70,7 +72,7 @@
 

 		view = mock(ISearchConsoleControllerOutputView.class);

 		final List<IObjectTypeDescription> objectTypes = Arrays.asList(new IObjectTypeDescription[] {

-				objectType_1.proxy(), objectType_2.proxy() });

+				objectType_1, objectType_2 });

 		view.expects(once()).method("showObjectTypes").with(eq(objectTypes));

 		

 		setupSessions();

@@ -100,29 +102,26 @@
 

 	private void setupObjectTypes()

 	{

-		objectType_1 = mock(IObjectTypeDescription.class);

-		objectType_1.stubs().method("getId").will(returnValue(OBJECT_TYPE_1_ID));

-		objectType_2 = mock(IObjectTypeDescription.class);

-		objectType_2.stubs().method("getId").will(returnValue(OBJECT_TYPE_2_ID));

+		objectType_1 = new ObjectTypeDescriptionBuilder().withId(OBJECT_TYPE_1_ID).object();

+		objectType_2 = new ObjectTypeDescriptionBuilder().withId(OBJECT_TYPE_2_ID).object();

 	}

 

 	private void setupSearchProviderConfig()

 	{

 		final List<IObjectTypeDescription> objectTypes = Arrays.asList(new IObjectTypeDescription[] {

-				objectType_1.proxy(), objectType_2.proxy() });

+				objectType_1, objectType_2 });

 		providerConfig = mock(ISearchProviderConfiguration.class);

 		providerConfig.stubs().method("getObjectTypes").will(returnValue(objectTypes));

 

-		destinationCategory1 = mock(IDestinationCategoryDescription.class);

-		destinationCategory2 = mock(IDestinationCategoryDescription.class);

-		destinationCategories_obj1 = Arrays.asList(new IDestinationCategoryDescription[] {

-				destinationCategory1.proxy(), destinationCategory2.proxy() });

-		providerConfig.stubs().method("getAvailableDestinationCategoriesForObjectType").with(eq(objectType_1.proxy())).will(

+		destinationCategory1 = new DestinationCategoryDescriptionBuilder().object();

+		destinationCategory2 = new DestinationCategoryDescriptionBuilder().object();

+		destinationCategories_obj1 = Arrays.asList(new IDestinationCategoryDescription[] {destinationCategory1, destinationCategory2});

+		providerConfig.stubs().method("getAvailableDestinationCategoriesForObjectType").with(eq(objectType_1)).will(

 				returnValue(destinationCategories_obj1));

 

-		destinationCategory3 = mock(IDestinationCategoryDescription.class);

-		destinationCategories_obj2 = Arrays.asList(new IDestinationCategoryDescription[] { destinationCategory3.proxy() });

-		providerConfig.stubs().method("getAvailableDestinationCategoriesForObjectType").with(eq(objectType_2.proxy())).will(

+		destinationCategory3 = new DestinationCategoryDescriptionBuilder().object();

+		destinationCategories_obj2 = Arrays.asList(new IDestinationCategoryDescription[] { destinationCategory3 });

+		providerConfig.stubs().method("getAvailableDestinationCategoriesForObjectType").with(eq(objectType_2)).will(

 				returnValue(destinationCategories_obj2));

 	}

 }

diff --git a/tests/org.eclipse.platform.discovery.core.test.unit/src/org/eclipse/platform/discovery/core/test/unit/internal/SearchConsoleControllerTest.java b/tests/org.eclipse.platform.discovery.core.test.unit/src/org/eclipse/platform/discovery/core/test/unit/internal/SearchConsoleControllerTest.java
index fd2f6b4..6ca43f5 100644
--- a/tests/org.eclipse.platform.discovery.core.test.unit/src/org/eclipse/platform/discovery/core/test/unit/internal/SearchConsoleControllerTest.java
+++ b/tests/org.eclipse.platform.discovery.core.test.unit/src/org/eclipse/platform/discovery/core/test/unit/internal/SearchConsoleControllerTest.java
@@ -40,11 +40,11 @@
 	public void testDestinationsChangeOnObjectSelectionChange()

 	{

 		view.expects(once()).method("showDestinationsCategories").with(new IsSame(destinationCategories_obj1));

-		testController.objectTypeSelected(objectType_1.proxy());

+		testController.objectTypeSelected(objectType_1);

 		view.verify();

 

 		view.expects(once()).method("showDestinationsCategories").with(new IsSame(destinationCategories_obj2));

-		testController.objectTypeSelected(objectType_2.proxy());

+		testController.objectTypeSelected(objectType_2);

 		view.verify();

 	}

 

@@ -70,19 +70,18 @@
 

 		final Mock<ISearchDestination> searchDestination = mock(ISearchDestination.class);

 

-		providerConfig.stubs().method("getActiveSearchProvider").with(same(objectType_1.proxy()), same(destinationCategory1.proxy())).will(

+		providerConfig.stubs().method("getActiveSearchProvider").with(same(objectType_1), same(destinationCategory1)).will(

 										returnValue(searchProviderDescr_1.proxy()));

 		providerConfig.stubs().method("getDestinationCategoriesForDestination").with(eq(searchDestination.proxy())).will(

-				returnValue(Arrays.asList(new IDestinationCategoryDescription[] { destinationCategory1

-						.proxy() })));

+				returnValue(Arrays.asList(new IDestinationCategoryDescription[] { destinationCategory1 })));

 

 		final Mock<ISearchSubdestination> subdestination = mock(ISearchSubdestination.class);

 		final List<ISearchSubdestination> subdestinations = new ArrayList<ISearchSubdestination>();

 		subdestinations.add(subdestination.proxy());

-		providerConfig.stubs().method("getAvailableSearchSubdestinations").with(eq(objectType_1.proxy()), eq(destinationCategory1.proxy()),

+		providerConfig.stubs().method("getAvailableSearchSubdestinations").with(eq(objectType_1), eq(destinationCategory1),

 				eq(searchProviderDescr_1.proxy())).will(returnValue(subdestinations));

-		providerConfig.stubs().method("isSubdestinationActive").with(eq(subdestination.proxy()), eq(objectType_1.proxy()),

-				eq(destinationCategory1.proxy()), eq(searchProviderDescr_1.proxy())).will(returnValue(true));

+		providerConfig.stubs().method("isSubdestinationActive").with(eq(subdestination.proxy()), eq(objectType_1),

+				eq(destinationCategory1), eq(searchProviderDescr_1.proxy())).will(returnValue(true));

 

 		final Mock<ISearchParameters> searchParameters = mock(ISearchParameters.class);

 

@@ -107,7 +106,7 @@
 			}

 		});

 

-		searchParameters.stubs().method("getObjectTypeId").will(returnValue(objectType_1.proxy().getId()));

+		searchParameters.stubs().method("getObjectTypeId").will(returnValue(objectType_1.getId()));

 		searchParameters.stubs().method("getSearchDestination").will(returnValue(searchDestination.proxy()));

 		sessionHistory.expects(once()).method("track").with(isA(ISearchContext.class));

 

@@ -135,11 +134,10 @@
 

 		final Mock<ISearchDestination> searchDestination = mock(ISearchDestination.class);

 

-		providerConfig.stubs().method("getActiveSearchProvider").with(same(objectType_1.proxy()), same(destinationCategory1.proxy())).will(

+		providerConfig.stubs().method("getActiveSearchProvider").with(same(objectType_1), same(destinationCategory1)).will(

 										returnValue(searchProviderDescr_1.proxy()));

 		providerConfig.stubs().method("getDestinationCategoriesForDestination").with(eq(searchDestination.proxy())).will(

-				returnValue(Arrays.asList(new IDestinationCategoryDescription[] { destinationCategory1

-						.proxy() })));

+				returnValue(Arrays.asList(new IDestinationCategoryDescription[] { destinationCategory1 })));

 		providerConfig.stubs().method("getAvailableSearchSubdestinations").will(returnValue(new ArrayList<ISearchSubdestination>()));

 		

 		view.expects(once()).method("showGroupingHierarchies").with(new Constraint()

@@ -158,7 +156,7 @@
 				return arg0;

 			}

 		});

-		testController.searchDestinationSelected(objectType_1.proxy(), searchDestination.proxy());

+		testController.searchDestinationSelected(objectType_1, searchDestination.proxy());

 	}

 	

 	public void testDestinationsDeselected()

@@ -179,7 +177,7 @@
 				return arg0;

 			}

 		});

-		testController.searchDestinationSelected(objectType_1.proxy(), null);

+		testController.searchDestinationSelected(objectType_1, null);

 	}

 	

 	public void testSubdestinationActivationChanged()

@@ -193,10 +191,10 @@
 

 		final Mock<ISearchDestination> searchDestination = mock(ISearchDestination.class);

 

-		providerConfig.stubs().method("getActiveSearchProvider").with(same(objectType_1.proxy()), same(destinationCategory1.proxy())).will(

+		providerConfig.stubs().method("getActiveSearchProvider").with(same(objectType_1), same(destinationCategory1)).will(

 										returnValue(searchProviderDescr_1.proxy()));

 		providerConfig.stubs().method("getDestinationCategoriesForDestination").with(eq(searchDestination.proxy())).will(

-				returnValue(Arrays.asList(new IDestinationCategoryDescription[] { destinationCategory1.proxy() })));

+				returnValue(Arrays.asList(new IDestinationCategoryDescription[] { destinationCategory1 })));

 		providerConfig.stubs().method("getAvailableSearchSubdestinations").will(returnValue(new ArrayList<ISearchSubdestination>()));

 		

 		view.expects(once()).method("showGroupingHierarchies").with(new Constraint()

@@ -215,6 +213,6 @@
 				return arg0;

 			}

 		});

-		testController.subdestinationActivationChanged(objectType_1.proxy(), searchDestination.proxy(), null, false);

+		testController.subdestinationActivationChanged(objectType_1, searchDestination.proxy(), null, false);

 	}

 }

diff --git a/tests/org.eclipse.platform.discovery.runtime.test.unit/src/org/eclipse/platform/discovery/runtime/test/unit/internal/SearchProviderConfigurationTest.java b/tests/org.eclipse.platform.discovery.runtime.test.unit/src/org/eclipse/platform/discovery/runtime/test/unit/internal/SearchProviderConfigurationTest.java
index a19c997..d2be181 100644
--- a/tests/org.eclipse.platform.discovery.runtime.test.unit/src/org/eclipse/platform/discovery/runtime/test/unit/internal/SearchProviderConfigurationTest.java
+++ b/tests/org.eclipse.platform.discovery.runtime.test.unit/src/org/eclipse/platform/discovery/runtime/test/unit/internal/SearchProviderConfigurationTest.java
@@ -12,9 +12,7 @@
 

 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 import org.eclipse.platform.discovery.runtime.api.IDestinationsProvider;
 import org.eclipse.platform.discovery.runtime.api.ISearchDestination;
@@ -36,11 +34,18 @@
 import org.eclipse.platform.discovery.runtime.internal.xp.ISearchProvidersExtensionParser;
 import org.eclipse.platform.discovery.testutils.utils.jmock.Mock;
 import org.eclipse.platform.discovery.testutils.utils.jmock.MockObjectTestCase;
+import org.eclipse.platform.discovery.testutils.utils.model.DestProviderDescriptionBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.DestinationCategoryDescriptionBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.DestinationsProviderBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.ObjectTypeDescriptionBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.SearchDestinationBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.SearchProviderDescriptionBuilder;
 import org.eclipse.platform.discovery.testutils.utils.reflection.ReflectionUtils;
 import org.eclipse.platform.discovery.util.internal.logging.ILogger;
 import org.jmock.core.Constraint;
 import org.jmock.core.Invocation;
 import org.jmock.core.Stub;
+import org.mockito.Mockito;
 

 

 /**

@@ -59,18 +64,18 @@
 	private Mock<IXPParsersFactory> xpParsersFactory;

 

 	// object types

-	private Mock<IObjectTypeDescription> objectType_1;

-	private Mock<IObjectTypeDescription> objectType_2;

+	private IObjectTypeDescription objectType_1;

+	private IObjectTypeDescription objectType_2;

 	private static final String OBJECT_TYPE_ID_1 = "objecttype1";

 	private static final String OBJECT_TYPE_ID_2 = "objecttype2";

 	private static final String OBJECT_TYPE_NAME_1 = "Object 1";

 	private static final String OBJECT_TYPE_NAME_2 = "Object 2";

 

 	// destination categories

-	private Mock<IDestinationCategoryDescription> destinationCategory1;

-	private Mock<IDestinationCategoryDescription> destinationCategory2;

-	private Mock<IDestinationCategoryDescription> destinationCategory3;

-	private Mock<IDestinationCategoryDescription> destinationCategory4;

+	private IDestinationCategoryDescription destinationCategory1;

+	private IDestinationCategoryDescription destinationCategory2;

+	private IDestinationCategoryDescription destinationCategory3;

+	private IDestinationCategoryDescription destinationCategory4;

 	private final static String DESTINATION_CATEGORY_ID_1 = "destcategory1";

 	private final static String DESTINATION_CATEGORY_ID_2 = "destcategory2";

 	private final static String DESTINATION_CATEGORY_ID_3 = "destcategory3";

@@ -81,14 +86,14 @@
 	private final static String DESTINATION_CATEGORY_NAME_4 = "Destination category 4";

 

 	// destinations

-	private Mock<ISearchDestination> searchDestination1;

-	private Mock<ISearchDestination> searchDestination2;

-	private Mock<ISearchDestination> searchDestination3;

-	private Mock<ISearchDestination> searchDestination4;

-	private Mock<ISearchDestination> searchDestination5;

-	private Mock<ISearchDestination> searchDestination6;

-	private Mock<ISearchDestination> searchDestination7;

-	private Mock<ISearchDestination> searchDestination8;

+	private ISearchDestination searchDestination1;

+	private ISearchDestination searchDestination2;

+	private ISearchDestination searchDestination3;

+	private ISearchDestination searchDestination4;

+	private ISearchDestination searchDestination5;

+	private ISearchDestination searchDestination6;

+	private ISearchDestination searchDestination7;

+	private ISearchDestination searchDestination8;

 	private static final String SEARCH_DESTINATION_NAME_1 = "Search destination 1";

 	private static final String SEARCH_DESTINATION_NAME_2 = "Search destination 2";

 	private static final String SEARCH_DESTINATION_NAME_3 = "Search destination 3";

@@ -99,16 +104,16 @@
 	private static final String SEARCH_DESTINATION_NAME_8 = "Search destination 8";

 	

 	// destination providers

-	private Mock<IDestinationsProviderDescription> destinationProviderDescr1;

-	private Mock<IDestinationsProviderDescription> destinationProviderDescr2;

-	private Mock<IDestinationsProviderDescription> destinationProviderDescr3;

-	private Mock<IDestinationsProviderDescription> destinationProviderDescr4;

-	private Mock<IDestinationsProviderDescription> destinationProviderDescr5;

-	private Mock<IDestinationsProvider> destinationProvider1;

-	private Mock<IDestinationsProvider> destinationProvider2;

-	private Mock<IDestinationsProvider> destinationProvider3;

-	private Mock<IDestinationsProvider> destinationProvider4;

-	private Mock<IDestinationsProvider> destinationProvider5;

+	private IDestinationsProviderDescription destinationProviderDescr1;

+	private IDestinationsProviderDescription destinationProviderDescr2;

+	private IDestinationsProviderDescription destinationProviderDescr3;

+	private IDestinationsProviderDescription destinationProviderDescr4;

+	private IDestinationsProviderDescription destinationProviderDescr5;

+	private IDestinationsProvider destinationProvider1;

+	private IDestinationsProvider destinationProvider2;

+	private IDestinationsProvider destinationProvider3;

+	private IDestinationsProvider destinationProvider4;

+	private IDestinationsProvider destinationProvider5;

 	private final static String DESTINATION_PROVIDER_ID_1 = "destinationprovider1";

 	private final static String DESTINATION_PROVIDER_ID_2 = "destinationprovider2";

 	private final static String DESTINATION_PROVIDER_ID_3 = "destinationprovider3";

@@ -116,10 +121,10 @@
 	private final static String DESTINATION_PROVIDER_ID_5 = "destinationprovider5";

 

 	// search providers

-	private Mock<ISearchProviderDescription> provider1;

-	private Mock<ISearchProviderDescription> provider2;

-	private Mock<ISearchProviderDescription> provider3;

-	private Mock<ISearchProviderDescription> provider4;

+	private ISearchProviderDescription provider1;

+	private ISearchProviderDescription provider2;

+	private ISearchProviderDescription provider3;

+	private ISearchProviderDescription provider4;

 	private static final String PROVIDER_ID_1 = "provider1";

 	private static final String PROVIDER_ID_2 = "provider2";

 	private static final String PROVIDER_ID_3 = "provider3";

@@ -171,130 +176,80 @@
 	}
 
 	private void setupObjectTypes()

-	{

-		objectType_1 = mock(IObjectTypeDescription.class, OBJECT_TYPE_ID_1);

-		objectType_1.stubs().method("getId").will(returnValue(OBJECT_TYPE_ID_1));

-		objectType_1.stubs().method("getDisplayName").will(returnValue(OBJECT_TYPE_NAME_1));

-		

-		objectType_2 = mock(IObjectTypeDescription.class, OBJECT_TYPE_ID_2);

-		objectType_2.stubs().method("getId").will(returnValue(OBJECT_TYPE_ID_2));

-		objectType_2.stubs().method("getDisplayName").will(returnValue(OBJECT_TYPE_NAME_2));

+	{
+		objectType_1 = new ObjectTypeDescriptionBuilder().withId(OBJECT_TYPE_ID_1).withName(OBJECT_TYPE_NAME_1).object();

+		objectType_2 = new ObjectTypeDescriptionBuilder().withId(OBJECT_TYPE_ID_2).withName(OBJECT_TYPE_NAME_2).object();
 	}

 	

 	private void setupSearchDestinations()

 	{

-		searchDestination1 = mock(ISearchDestination.class, SEARCH_DESTINATION_NAME_1);

-		searchDestination2 = mock(ISearchDestination.class, SEARCH_DESTINATION_NAME_2);

-		searchDestination3 = mock(ISearchDestination.class, SEARCH_DESTINATION_NAME_3);

-		searchDestination4 = mock(ISearchDestination.class, SEARCH_DESTINATION_NAME_4);

-		searchDestination5 = mock(ISearchDestination.class, SEARCH_DESTINATION_NAME_5);

-		searchDestination6 = mock(ISearchDestination.class, SEARCH_DESTINATION_NAME_6);

-		searchDestination7 = mock(ISearchDestination.class, SEARCH_DESTINATION_NAME_7);

-		searchDestination8 = mock(ISearchDestination.class, SEARCH_DESTINATION_NAME_8);

+		searchDestination1 = stubSearchDestination(SEARCH_DESTINATION_NAME_1);

+		searchDestination2 = stubSearchDestination(SEARCH_DESTINATION_NAME_2);

+		searchDestination3 = stubSearchDestination(SEARCH_DESTINATION_NAME_3);

+		searchDestination4 = stubSearchDestination(SEARCH_DESTINATION_NAME_4);

+		searchDestination5 = stubSearchDestination(SEARCH_DESTINATION_NAME_5);

+		searchDestination6 = stubSearchDestination(SEARCH_DESTINATION_NAME_6);

+		searchDestination7 = stubSearchDestination(SEARCH_DESTINATION_NAME_7);

+		searchDestination8 = stubSearchDestination(SEARCH_DESTINATION_NAME_8);

+	}
+	
+	private ISearchDestination stubSearchDestination(final String displayName)
+	{
+		return new SearchDestinationBuilder().withDisplayName(displayName).object();
 	}

 	

 	private void setupDestinationProviders()

 	{

-		destinationProvider1 = mock(IDestinationsProvider.class);

-		final Set<ISearchDestination> provider1Dest = new HashSet<ISearchDestination>(Arrays.asList(new ISearchDestination[]{searchDestination1.proxy(), searchDestination2.proxy()}));

-		destinationProvider1.stubs().method("getSearchDestinations").will(returnValue(provider1Dest));

-		destinationProviderDescr1 = mock(IDestinationsProviderDescription.class, DESTINATION_PROVIDER_ID_1);

-		destinationProviderDescr1.stubs().method("getId").will(returnValue(DESTINATION_PROVIDER_ID_1));

-		destinationProviderDescr1.stubs().method("createProvider").will(returnValue(destinationProvider1.proxy()));

+		destinationProvider1 = stubDestinationsProvider(searchDestination1, searchDestination2);
+		destinationProviderDescr1 = stubDestinationsProviderDescription(DESTINATION_PROVIDER_ID_1, destinationProvider1);

 

-		destinationProvider2 = mock(IDestinationsProvider.class);

-		final Set<ISearchDestination> provider2Dest =  new HashSet<ISearchDestination>(Arrays.asList(new ISearchDestination[]{searchDestination3.proxy()}));

-		destinationProvider2.stubs().method("getSearchDestinations").will(returnValue(provider2Dest));

-		destinationProviderDescr2 = mock(IDestinationsProviderDescription.class, DESTINATION_PROVIDER_ID_2);

-		destinationProviderDescr2.stubs().method("getId").will(returnValue(DESTINATION_PROVIDER_ID_2));

-		destinationProviderDescr2.stubs().method("createProvider").will(returnValue(destinationProvider2.proxy()));

+		destinationProvider2 = stubDestinationsProvider(searchDestination3);

+		destinationProviderDescr2 = stubDestinationsProviderDescription(DESTINATION_PROVIDER_ID_2, destinationProvider2);

 

-		destinationProvider3 = mock(IDestinationsProvider.class);

-		final Set<ISearchDestination> provider3Dest =  new HashSet<ISearchDestination>(Arrays.asList(new ISearchDestination[]{searchDestination4.proxy(), searchDestination5.proxy()}));

-		destinationProvider3.stubs().method("getSearchDestinations").will(returnValue(provider3Dest));

-		destinationProviderDescr3 = mock(IDestinationsProviderDescription.class, DESTINATION_PROVIDER_ID_3);

-		destinationProviderDescr3.stubs().method("getId").will(returnValue(DESTINATION_PROVIDER_ID_3));

-		destinationProviderDescr3.stubs().method("createProvider").will(returnValue(destinationProvider3.proxy()));

+		destinationProvider3 = stubDestinationsProvider(searchDestination4, searchDestination5);

+		destinationProviderDescr3 = stubDestinationsProviderDescription(DESTINATION_PROVIDER_ID_3, destinationProvider3);

 

-		destinationProvider4 = mock(IDestinationsProvider.class);

-		final Set<ISearchDestination> provider4Dest =  new HashSet<ISearchDestination>(Arrays.asList(new ISearchDestination[]{searchDestination6.proxy(), searchDestination7.proxy()}));

-		destinationProvider4.stubs().method("getSearchDestinations").will(returnValue(provider4Dest));

-		destinationProviderDescr4 = mock(IDestinationsProviderDescription.class, DESTINATION_PROVIDER_ID_4);

-		destinationProviderDescr4.stubs().method("getId").will(returnValue(DESTINATION_PROVIDER_ID_4));

-		destinationProviderDescr4.stubs().method("createProvider").will(returnValue(destinationProvider4.proxy()));

+		destinationProvider4 = stubDestinationsProvider(searchDestination6, searchDestination7);

+		destinationProviderDescr4 = stubDestinationsProviderDescription(DESTINATION_PROVIDER_ID_4, destinationProvider4);

 

-		destinationProvider5 = mock(IDestinationsProvider.class);

-		final Set<ISearchDestination> provider5Dest = new HashSet<ISearchDestination>(Arrays.asList(new ISearchDestination[]{searchDestination8.proxy()}));

-		destinationProvider5.stubs().method("getSearchDestinations").will(returnValue(provider5Dest));

-		destinationProviderDescr5 = mock(IDestinationsProviderDescription.class, DESTINATION_PROVIDER_ID_5);

-		destinationProviderDescr5.stubs().method("getId").will(returnValue(DESTINATION_PROVIDER_ID_5));

-		destinationProviderDescr5.stubs().method("createProvider").will(returnValue(destinationProvider5.proxy()));

+		destinationProvider5 = stubDestinationsProvider(searchDestination8);

+		destinationProviderDescr5 = stubDestinationsProviderDescription(DESTINATION_PROVIDER_ID_5, destinationProvider5);

+	}
+	
+	private IDestinationsProvider stubDestinationsProvider(final ISearchDestination... destinations)
+	{
+		return new DestinationsProviderBuilder().withDestinations(destinations).object();
+	}
+	
+	private IDestinationsProviderDescription stubDestinationsProviderDescription(final String id, final IDestinationsProvider destProviderInstance)
+	{
+		return new DestProviderDescriptionBuilder().withProvider(destProviderInstance).withId(id).object();
 	}

 	

 	private void setupDestinationCategories()

-	{

-		destinationCategory1 = mock(IDestinationCategoryDescription.class, DESTINATION_CATEGORY_NAME_1);

-		destinationCategory1.stubs().method("getId").will(returnValue(DESTINATION_CATEGORY_ID_1));

-		destinationCategory1.stubs().method("getDisplayName").will(returnValue(DESTINATION_CATEGORY_NAME_1));

-		final List<String> cat1Providers = Arrays.asList(new String[]{DESTINATION_PROVIDER_ID_1});

-		destinationCategory1.stubs().method("getDestinationProviderIds").will(returnValue(cat1Providers));

-		destinationCategory1.stubs().method("getDestinationsClass").will(returnValue(ISearchDestination.class));

-

-		destinationCategory2 = mock(IDestinationCategoryDescription.class, DESTINATION_CATEGORY_NAME_2);

-		destinationCategory2.stubs().method("getId").will(returnValue(DESTINATION_CATEGORY_ID_2));

-		destinationCategory2.stubs().method("getDisplayName").will(returnValue(DESTINATION_CATEGORY_NAME_2));

-		final List<String> cat2Providers = Arrays.asList(new String[]{DESTINATION_PROVIDER_ID_2, DESTINATION_PROVIDER_ID_3});

-		destinationCategory2.stubs().method("getDestinationProviderIds").will(returnValue(cat2Providers));

-		destinationCategory2.stubs().method("getDestinationsClass").will(returnValue(ISearchDestination.class));

-

-		destinationCategory3 = mock(IDestinationCategoryDescription.class, DESTINATION_CATEGORY_NAME_3);

-		destinationCategory3.stubs().method("getId").will(returnValue(DESTINATION_CATEGORY_ID_3));

-		destinationCategory3.stubs().method("getDisplayName").will(returnValue(DESTINATION_CATEGORY_NAME_3));

-		final List<String> cat3Providers =Arrays.asList(new String[]{DESTINATION_PROVIDER_ID_4});

-		destinationCategory3.stubs().method("getDestinationProviderIds").will(returnValue(cat3Providers));

-		destinationCategory3.stubs().method("getDestinationsClass").will(returnValue(ISearchDestination.class));

-		

-		destinationCategory4 = mock(IDestinationCategoryDescription.class, DESTINATION_CATEGORY_NAME_4);

-		destinationCategory4.stubs().method("getId").will(returnValue(DESTINATION_CATEGORY_ID_4));

-		destinationCategory4.stubs().method("getDisplayName").will(returnValue(DESTINATION_CATEGORY_NAME_4));

-		final List<String> cat4Providers = Arrays.asList(new String[]{DESTINATION_PROVIDER_ID_5});

-		destinationCategory4.stubs().method("getDestinationProviderIds").will(returnValue(cat4Providers));

-		destinationCategory4.stubs().method("getDestinationsClass").will(returnValue(ISearchDestination.class));

+	{
+		destinationCategory1 = stubDestCategoryDescription(DESTINATION_CATEGORY_ID_1, DESTINATION_CATEGORY_NAME_1, DESTINATION_PROVIDER_ID_1);
+		destinationCategory2 = stubDestCategoryDescription(DESTINATION_CATEGORY_ID_2, DESTINATION_CATEGORY_NAME_2, DESTINATION_PROVIDER_ID_2, DESTINATION_PROVIDER_ID_3);

+		destinationCategory3 = stubDestCategoryDescription(DESTINATION_CATEGORY_ID_3, DESTINATION_CATEGORY_NAME_3, DESTINATION_PROVIDER_ID_4);

+		destinationCategory4 = stubDestCategoryDescription(DESTINATION_CATEGORY_ID_4, DESTINATION_CATEGORY_NAME_4, DESTINATION_PROVIDER_ID_5);

+	}
+	
+	private IDestinationCategoryDescription stubDestCategoryDescription(final String id, final String displayName, final String... destProviderIds)
+	{
+		return new DestinationCategoryDescriptionBuilder().withDestinationClass(ISearchDestination.class).withDestinationProviders(destProviderIds).withId(id).withName(displayName).object();
 	}

 	

 	private void setupSearchProviders()

 	{

-		provider1 = mock(ISearchProviderDescription.class, PROVIDER_NAME_1);

-		provider1.stubs().method("getId").will(returnValue(PROVIDER_ID_1));

-		provider1.stubs().method("getDisplayName").will(returnValue(PROVIDER_NAME_1));

-		provider1.stubs().method("getObjectType").will(returnValue(objectType_1.proxy()));

-		final List<IDestinationCategoryDescription> provider1Cats = Arrays.asList(new IDestinationCategoryDescription[]{destinationCategory1.proxy(), destinationCategory2.proxy()});

-		provider1.stubs().method("getSupportedDestinationCategories").will(returnValue(provider1Cats));

-		provider1.stubs().method("supportsTextSearch").will(returnValue(true));

-		

-		provider2 = mock(ISearchProviderDescription.class, PROVIDER_NAME_2);

-		provider2.stubs().method("getId").will(returnValue(PROVIDER_ID_2));

-		provider2.stubs().method("getDisplayName").will(returnValue(PROVIDER_NAME_2));

-		provider2.stubs().method("getObjectType").will(returnValue(objectType_1.proxy()));

-		final List<IDestinationCategoryDescription> provider2Cats =Arrays.asList(new IDestinationCategoryDescription[]{destinationCategory3.proxy(), destinationCategory4.proxy()});

-		provider2.stubs().method("getSupportedDestinationCategories").will(returnValue(provider2Cats));

-		provider2.stubs().method("supportsTextSearch").will(returnValue(false));

-		

-		provider3 = mock(ISearchProviderDescription.class, PROVIDER_NAME_3);

-		provider3.stubs().method("getId").will(returnValue(PROVIDER_ID_3));

-		provider3.stubs().method("getDisplayName").will(returnValue(PROVIDER_NAME_3));

-		provider3.stubs().method("getObjectType").will(returnValue(objectType_1.proxy()));

-		final List<IDestinationCategoryDescription> provider3Cats = Arrays.asList(new IDestinationCategoryDescription[]{destinationCategory2.proxy(), destinationCategory3.proxy()});

-		provider3.stubs().method("getSupportedDestinationCategories").will(returnValue(provider3Cats));

-		provider3.stubs().method("supportsTextSearch").will(returnValue(true));

-		

-		provider4 = mock(ISearchProviderDescription.class, PROVIDER_NAME_4);

-		provider4.stubs().method("getId").will(returnValue(PROVIDER_ID_4));

-		provider4.stubs().method("getDisplayName").will(returnValue(PROVIDER_NAME_4));

-		provider4.stubs().method("getObjectType").will(returnValue(objectType_2.proxy()));

-		final List<IDestinationCategoryDescription> provider4Cats = Arrays.asList(new IDestinationCategoryDescription[]{destinationCategory1.proxy(), destinationCategory4.proxy()});

-		provider4.stubs().method("getSupportedDestinationCategories").will(returnValue(provider4Cats));

-		provider4.stubs().method("supportsTextSearch").will(returnValue(false));

+		provider1 = stubSearchProviderDescription(PROVIDER_ID_1, PROVIDER_NAME_1, true, objectType_1, destinationCategory1, destinationCategory2);

+		provider2 = stubSearchProviderDescription(PROVIDER_ID_2, PROVIDER_NAME_2, false, objectType_1, destinationCategory3, destinationCategory4);

+		provider3 = stubSearchProviderDescription(PROVIDER_ID_3, PROVIDER_NAME_3, true, objectType_1, destinationCategory2, destinationCategory3);

+		provider4 = stubSearchProviderDescription(PROVIDER_ID_4, PROVIDER_NAME_4, false, objectType_2, destinationCategory1, destinationCategory4);

+	}
+	
+	private ISearchProviderDescription stubSearchProviderDescription(String id, String name, boolean supportsTextSearch, IObjectTypeDescription objectType, IDestinationCategoryDescription... categories)
+	{
+		return new SearchProviderDescriptionBuilder().supportsTextSearch(supportsTextSearch).withDestinationCategories(categories).supportsObjectType(objectType).withId(id).withName(name).object();
 	}

 	

 	private void setupSubdestinations()

@@ -321,7 +276,7 @@
 	private void setupObjectTypesExtensionParser()

 	{

 		objectTypeExtensionParser = mock(IObjectTypeExtensionParser.class);

-		final List<IObjectTypeDescription> objects = Arrays.asList(new IObjectTypeDescription[]{objectType_1.proxy(), objectType_2.proxy()});

+		final List<IObjectTypeDescription> objects = Arrays.asList(new IObjectTypeDescription[]{objectType_1, objectType_2});

 		objectTypeExtensionParser.stubs().method("readContributions").will(returnValue(objects));

 	}

 	

@@ -329,7 +284,7 @@
 	{

 		destCategoryExtensionParser = mock(IDestinationCategoryExtensionParser.class);

 		final List<IDestinationCategoryDescription> categories = new ArrayList<IDestinationCategoryDescription>();

-		categories.addAll(Arrays.asList(new IDestinationCategoryDescription[]{destinationCategory1.proxy(), destinationCategory2.proxy(), destinationCategory3.proxy(), destinationCategory4.proxy()}));

+		categories.addAll(Arrays.asList(new IDestinationCategoryDescription[]{destinationCategory1, destinationCategory2, destinationCategory3, destinationCategory4}));

 		destCategoryExtensionParser.stubs().method("readContributions").will(returnValue(categories));

 	}

 	

@@ -337,7 +292,7 @@
 	{

 		destProviderExtensionParser = mock(IDestinationsProviderExtensionParser.class);

 		final List<IDestinationsProviderDescription> providers = new ArrayList<IDestinationsProviderDescription>();

-		providers.addAll(Arrays.asList(new IDestinationsProviderDescription[]{destinationProviderDescr1.proxy(), destinationProviderDescr2.proxy(), destinationProviderDescr3.proxy(), destinationProviderDescr4.proxy(), destinationProviderDescr5.proxy()}));

+		providers.addAll(Arrays.asList(new IDestinationsProviderDescription[]{destinationProviderDescr1, destinationProviderDescr2, destinationProviderDescr3, destinationProviderDescr4, destinationProviderDescr5}));

 		destProviderExtensionParser.stubs().method("readContributions").will(returnValue(providers));

 	}

 	

@@ -345,7 +300,7 @@
 	{

 		searchProviderExtensionParser = mock(ISearchProvidersExtensionParser.class);

 		final List<ISearchProviderDescription> providers = new ArrayList<ISearchProviderDescription>();

-		providers.addAll(Arrays.asList(new ISearchProviderDescription[]{provider1.proxy(), provider2.proxy(), provider3.proxy(), provider4.proxy()}));

+		providers.addAll(Arrays.asList(new ISearchProviderDescription[]{provider1, provider2, provider3, provider4}));

 		searchProviderExtensionParser.stubs().method("readContributions").will(returnValue(providers));

 	}

 	

@@ -353,12 +308,12 @@
 	{

 		final Mock<ISearchProviderActivationConfig> activationConfig = mock(ISearchProviderActivationConfig.class);

 		

-		activationConfig.stubs().method("getActiveSearchProviderDescription").with(eq(objectType_2.proxy()), or(eq(destinationCategory1.proxy()), eq(destinationCategory4.proxy()))).will(returnValue(provider4.proxy()));

-		activationConfig.stubs().method("getActiveSearchProviderDescription").with(eq(objectType_2.proxy()), not(or(eq(destinationCategory1.proxy()), eq(destinationCategory4.proxy())))).will(throwException(new ProviderNotFoundException("Provider not found")));

-		activationConfig.stubs().method("getActiveSearchProviderDescription").with(eq(objectType_1.proxy()), eq(destinationCategory1.proxy())).will(returnValue(provider1.proxy()));

-		activationConfig.stubs().method("getActiveSearchProviderDescription").with(eq(objectType_1.proxy()), eq(destinationCategory2.proxy())).will(returnValue(provider1.proxy()));

-		activationConfig.stubs().method("getActiveSearchProviderDescription").with(eq(objectType_1.proxy()), eq(destinationCategory3.proxy())).will(returnValue(provider3.proxy()));

-		activationConfig.stubs().method("getActiveSearchProviderDescription").with(eq(objectType_1.proxy()), eq(destinationCategory4.proxy())).will(returnValue(provider2.proxy()));

+		activationConfig.stubs().method("getActiveSearchProviderDescription").with(eq(objectType_2), or(eq(destinationCategory1), eq(destinationCategory4))).will(returnValue(provider4));

+		activationConfig.stubs().method("getActiveSearchProviderDescription").with(eq(objectType_2), not(or(eq(destinationCategory1), eq(destinationCategory4)))).will(throwException(new ProviderNotFoundException("Provider not found")));

+		activationConfig.stubs().method("getActiveSearchProviderDescription").with(eq(objectType_1), eq(destinationCategory1)).will(returnValue(provider1));

+		activationConfig.stubs().method("getActiveSearchProviderDescription").with(eq(objectType_1), eq(destinationCategory2)).will(returnValue(provider1));

+		activationConfig.stubs().method("getActiveSearchProviderDescription").with(eq(objectType_1), eq(destinationCategory3)).will(returnValue(provider3));

+		activationConfig.stubs().method("getActiveSearchProviderDescription").with(eq(objectType_1), eq(destinationCategory4)).will(returnValue(provider2));

 		

 		return activationConfig.proxy();

 	}

@@ -367,14 +322,14 @@
 	{

 		final Mock<ISubdestinationsActivationConfig> activationConfig = mock(ISubdestinationsActivationConfig.class);

 		

-		activationConfig.stubs().method("getAvailableSearchSubdestinations").with(eq(objectType_2.proxy()), ANYTHING, ANYTHING).will(returnValue(new ArrayList<ISearchSubdestination>()));

-		activationConfig.stubs().method("getAvailableSearchSubdestinations").with(eq(objectType_1.proxy()), eq(destinationCategory1.proxy()), ANYTHING).will(returnValue(Arrays.asList(new ISearchSubdestination[]{subdestination1.proxy()})));

-		activationConfig.stubs().method("getAvailableSearchSubdestinations").with(eq(objectType_1.proxy()), eq(destinationCategory2.proxy()), ANYTHING).will(returnValue(Arrays.asList(new ISearchSubdestination[]{subdestination2.proxy(), subdestination3.proxy()})));

-		activationConfig.stubs().method("getAvailableSearchSubdestinations").with(eq(objectType_1.proxy()), eq(destinationCategory3.proxy()), ANYTHING).will(returnValue(new ArrayList<ISearchSubdestination>()));

-		activationConfig.stubs().method("getAvailableSearchSubdestinations").with(eq(objectType_1.proxy()), eq(destinationCategory4.proxy()), ANYTHING).will(returnValue(new ArrayList<ISearchSubdestination>()));

+		activationConfig.stubs().method("getAvailableSearchSubdestinations").with(eq(objectType_2), ANYTHING, ANYTHING).will(returnValue(new ArrayList<ISearchSubdestination>()));

+		activationConfig.stubs().method("getAvailableSearchSubdestinations").with(eq(objectType_1), eq(destinationCategory1), ANYTHING).will(returnValue(Arrays.asList(new ISearchSubdestination[]{subdestination1.proxy()})));

+		activationConfig.stubs().method("getAvailableSearchSubdestinations").with(eq(objectType_1), eq(destinationCategory2), ANYTHING).will(returnValue(Arrays.asList(new ISearchSubdestination[]{subdestination2.proxy(), subdestination3.proxy()})));

+		activationConfig.stubs().method("getAvailableSearchSubdestinations").with(eq(objectType_1), eq(destinationCategory3), ANYTHING).will(returnValue(new ArrayList<ISearchSubdestination>()));

+		activationConfig.stubs().method("getAvailableSearchSubdestinations").with(eq(objectType_1), eq(destinationCategory4), ANYTHING).will(returnValue(new ArrayList<ISearchSubdestination>()));

 		

-		activationConfig.stubs().method("isSubdestinationActive").with(eq(subdestination2.proxy()), eq(objectType_1.proxy()), eq(destinationCategory2.proxy()), eq(provider1.proxy())).will(checkValueForSelection());

-		Constraint [] constraints = {eq(objectType_1.proxy()), eq(destinationCategory2.proxy()), eq(provider1.proxy()),eq(subdestination2.proxy()), eq(new Boolean(false))};

+		activationConfig.stubs().method("isSubdestinationActive").with(eq(subdestination2.proxy()), eq(objectType_1), eq(destinationCategory2), eq(provider1)).will(checkValueForSelection());

+		Constraint [] constraints = {eq(objectType_1), eq(destinationCategory2), eq(provider1),eq(subdestination2.proxy()), eq(new Boolean(false))};

 		activationConfig.stubs().method("activateSubdestination").with(constraints).will(new Stub(){

 

 			public Object invoke(Invocation arg0) throws Throwable {

@@ -409,7 +364,7 @@
 	public void testGetAvailableSearchProvidersDescriptionsForObjectType()

 	{

 

-		final List<ISearchProviderDescription> descriptions = searchProviderConfig.getAvailableSearchProviderDescriptions(objectType_1.proxy());

+		final List<ISearchProviderDescription> descriptions = searchProviderConfig.getAvailableSearchProviderDescriptions(objectType_1);

 		assertEquals("Three providers expected", 3, descriptions.size());

 		final List<String> ids = new ArrayList<String>();

 		for (ISearchProviderDescription d : descriptions)

@@ -423,7 +378,7 @@
 		assertTrue("Provider 3 not returned", ids.contains(PROVIDER_ID_3));

 		

 		final List<String> ids2 = new ArrayList<String>();

-		for(ISearchProviderDescription p : searchProviderConfig.getAvailableSearchProviderDescriptions(objectType_2.proxy()))

+		for(ISearchProviderDescription p : searchProviderConfig.getAvailableSearchProviderDescriptions(objectType_2))

 		{

 			assertEquals("Unexpected object type", OBJECT_TYPE_ID_2, p.getObjectType().getId());

 			ids2.add(p.getId());

@@ -435,7 +390,7 @@
 	public void testGetAvailableDestinationCategoriesForObjectType()

 	{

 		final List<String> cat1Ids = new ArrayList<String>();

-		for(IDestinationCategoryDescription cat : searchProviderConfig.getAvailableDestinationCategoriesForObjectType(objectType_1.proxy()))

+		for(IDestinationCategoryDescription cat : searchProviderConfig.getAvailableDestinationCategoriesForObjectType(objectType_1))

 		{

 			cat1Ids.add(cat.getId());

 		}

@@ -446,7 +401,7 @@
 		assertTrue("Destinationa category 1 not returned", cat1Ids.contains(DESTINATION_CATEGORY_ID_4));

 

 		final List<String> cat2Ids = new ArrayList<String>();

-		for(IDestinationCategoryDescription cat : searchProviderConfig.getAvailableDestinationCategoriesForObjectType(objectType_2.proxy()))

+		for(IDestinationCategoryDescription cat : searchProviderConfig.getAvailableDestinationCategoriesForObjectType(objectType_2))

 		{

 			cat2Ids.add(cat.getId());

 		}

@@ -457,17 +412,17 @@
 	

 	public void testGetActiveSearchProvider() throws ProviderNotFoundException

 	{

-		assertEquals(searchProviderConfig.getActiveSearchProvider(objectType_1.proxy(), destinationCategory1.proxy()).getId(), PROVIDER_ID_1);

-		assertEquals(searchProviderConfig.getActiveSearchProvider(objectType_1.proxy(), destinationCategory2.proxy()).getId(), PROVIDER_ID_1);

-		assertEquals(searchProviderConfig.getActiveSearchProvider(objectType_1.proxy(), destinationCategory3.proxy()).getId(), PROVIDER_ID_3);

-		assertEquals(searchProviderConfig.getActiveSearchProvider(objectType_1.proxy(), destinationCategory4.proxy()).getId(), PROVIDER_ID_2);

+		assertEquals(searchProviderConfig.getActiveSearchProvider(objectType_1, destinationCategory1).getId(), PROVIDER_ID_1);

+		assertEquals(searchProviderConfig.getActiveSearchProvider(objectType_1, destinationCategory2).getId(), PROVIDER_ID_1);

+		assertEquals(searchProviderConfig.getActiveSearchProvider(objectType_1, destinationCategory3).getId(), PROVIDER_ID_3);

+		assertEquals(searchProviderConfig.getActiveSearchProvider(objectType_1, destinationCategory4).getId(), PROVIDER_ID_2);

 		

-		assertEquals(searchProviderConfig.getActiveSearchProvider(objectType_2.proxy(), destinationCategory1.proxy()).getId(), PROVIDER_ID_4);

-		assertEquals(searchProviderConfig.getActiveSearchProvider(objectType_2.proxy(), destinationCategory4.proxy()).getId(), PROVIDER_ID_4);

+		assertEquals(searchProviderConfig.getActiveSearchProvider(objectType_2, destinationCategory1).getId(), PROVIDER_ID_4);

+		assertEquals(searchProviderConfig.getActiveSearchProvider(objectType_2, destinationCategory4).getId(), PROVIDER_ID_4);

 		

 		try

 		{

-			searchProviderConfig.getActiveSearchProvider(objectType_2.proxy(), destinationCategory3.proxy());

+			searchProviderConfig.getActiveSearchProvider(objectType_2, destinationCategory3);

 			fail("ProviderNotFoundException not thrown");

 		}

 		catch(ProviderNotFoundException e)

@@ -477,7 +432,7 @@
 		

 		try

 		{

-			searchProviderConfig.getActiveSearchProvider(objectType_2.proxy(), destinationCategory2.proxy());

+			searchProviderConfig.getActiveSearchProvider(objectType_2, destinationCategory2);

 			fail("ProviderNotFoundException not thrown");

 		}

 		catch(ProviderNotFoundException e)

@@ -517,71 +472,73 @@
 	

 	public void testGetDestinationProvidersForCategory()

 	{

-		final List<IDestinationsProviderDescription> providers1 = searchProviderConfig.getDestinationProvidersForCategory(destinationCategory1.proxy());

+		final List<IDestinationsProviderDescription> providers1 = searchProviderConfig.getDestinationProvidersForCategory(destinationCategory1);

 		assertEquals("One destination provider expected", 1, providers1.size());

-		assertTrue("Destination provider 1 not returned", providers1.contains(destinationProviderDescr1.proxy()));

+		assertTrue("Destination provider 1 not returned", providers1.contains(destinationProviderDescr1));

 		

-		final List<IDestinationsProviderDescription> providers2 = searchProviderConfig.getDestinationProvidersForCategory(destinationCategory2.proxy());

+		final List<IDestinationsProviderDescription> providers2 = searchProviderConfig.getDestinationProvidersForCategory(destinationCategory2);

 		assertEquals("Two destination providers expected", 2, providers2.size());

-		assertTrue("Destination provider 2 not returned", providers2.contains(destinationProviderDescr2.proxy()));

-		assertTrue("Destination provider 3 not returned", providers2.contains(destinationProviderDescr3.proxy()));

+		assertTrue("Destination provider 2 not returned", providers2.contains(destinationProviderDescr2));

+		assertTrue("Destination provider 3 not returned", providers2.contains(destinationProviderDescr3));

 

-		final List<IDestinationsProviderDescription> providers3 = searchProviderConfig.getDestinationProvidersForCategory(destinationCategory3.proxy());

+		final List<IDestinationsProviderDescription> providers3 = searchProviderConfig.getDestinationProvidersForCategory(destinationCategory3);

 		assertEquals("One destination provider expected", 1, providers3.size());

-		assertTrue("Destination provider 4 not returned", providers3.contains(destinationProviderDescr4.proxy()));

+		assertTrue("Destination provider 4 not returned", providers3.contains(destinationProviderDescr4));

 

-		final List<IDestinationsProviderDescription> providers4 = searchProviderConfig.getDestinationProvidersForCategory(destinationCategory4.proxy());

+		final List<IDestinationsProviderDescription> providers4 = searchProviderConfig.getDestinationProvidersForCategory(destinationCategory4);

 		assertEquals("One destination provider expected", 1, providers4.size());

-		assertTrue("Destination provider 5 not returned", providers4.contains(destinationProviderDescr5.proxy()));

+		assertTrue("Destination provider 5 not returned", providers4.contains(destinationProviderDescr5));

 	}	

 	

 	public void testGetSearchDestinations()

 	{

-		List<ISearchDestination> destinations = searchProviderConfig.getSearchDestinations(destinationCategory1.proxy(), destinationProvider1.proxy());

+		List<ISearchDestination> destinations = searchProviderConfig.getSearchDestinations(destinationCategory1, destinationProvider1);

 		assertEquals("Two destinations expected", 2, destinations.size());

-		assertTrue("Destination 1 not returned", destinations.contains(searchDestination1.proxy()));

-		assertTrue("Destination 2 not returned", destinations.contains(searchDestination2.proxy()));

+		assertTrue("Destination 1 not returned", destinations.contains(searchDestination1));

+		assertTrue("Destination 2 not returned", destinations.contains(searchDestination2));

 		

-		destinations = searchProviderConfig.getSearchDestinations(destinationCategory2.proxy(), destinationProvider2.proxy());

+		destinations = searchProviderConfig.getSearchDestinations(destinationCategory2, destinationProvider2);

 		assertEquals("One destination expected", 1, destinations.size());

-		assertTrue("Destination 3 not returned", destinations.contains(searchDestination3.proxy()));

+		assertTrue("Destination 3 not returned", destinations.contains(searchDestination3));

 		

-		destinations = searchProviderConfig.getSearchDestinations(destinationCategory2.proxy(), destinationProvider3.proxy());

+		destinations = searchProviderConfig.getSearchDestinations(destinationCategory2, destinationProvider3);

 		assertEquals("Two destinations expected", 2, destinations.size());

-		assertTrue("Destination 4 not returned", destinations.contains(searchDestination4.proxy()));

-		assertTrue("Destination 5 not returned", destinations.contains(searchDestination5.proxy()));

+		assertTrue("Destination 4 not returned", destinations.contains(searchDestination4));

+		assertTrue("Destination 5 not returned", destinations.contains(searchDestination5));

 		

-		destinations = searchProviderConfig.getSearchDestinations(destinationCategory3.proxy(), destinationProvider4.proxy());

+		destinations = searchProviderConfig.getSearchDestinations(destinationCategory3, destinationProvider4);

 		assertEquals("Two destinations expected", 2, destinations.size());

-		assertTrue("Destination 6 not returned", destinations.contains(searchDestination6.proxy()));

-		assertTrue("Destination 7 not returned", destinations.contains(searchDestination7.proxy()));

+		assertTrue("Destination 6 not returned", destinations.contains(searchDestination6));

+		assertTrue("Destination 7 not returned", destinations.contains(searchDestination7));

 		

-		destinations = searchProviderConfig.getSearchDestinations(destinationCategory4.proxy(), destinationProvider5.proxy());

+		destinations = searchProviderConfig.getSearchDestinations(destinationCategory4, destinationProvider5);

 		assertEquals("One destination expected", 1, destinations.size());

-		assertTrue("Destination 8 not returned", destinations.contains(searchDestination8.proxy()));

+		assertTrue("Destination 8 not returned", destinations.contains(searchDestination8));

 	}

 	

+	@SuppressWarnings("unchecked")
 	public void testGetSearchDestinationsIgnoredWhenDestinationsClassNoLegal() throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException

 	{

 		final Mock<ILogger> logger = mock(ILogger.class);

 		logger.expects(atLeastOnce()).method("logWarn");

-		ReflectionUtils.setFieldValue(searchProviderConfig, "logger", logger.proxy());

-		destinationCategory1.stubs().method("getDestinationsClass").will(returnValue(String.class));

-		assertEquals("No search destinations expected", 0, searchProviderConfig.getSearchDestinations(destinationCategory1.proxy(), destinationProvider1.proxy()).size());

-	}

-	

+		ReflectionUtils.setFieldValue(searchProviderConfig, "logger", logger.proxy());
+		final Class<?> illegalClass = String.class;
+		Mockito.stub(destinationCategory1.getDestinationsClass()).toReturn((Class<ISearchDestination>) illegalClass);

+		assertEquals("No search destinations expected", 0, searchProviderConfig.getSearchDestinations(destinationCategory1, destinationProvider1).size());

+	}
+	
 	public void testGetAvailableSearchSubdestinations()

 	{

-		final List<ISearchSubdestination> subdest1 = searchProviderConfig.getAvailableSearchSubdestinations(objectType_1.proxy(), destinationCategory1.proxy(), provider1.proxy());

+		final List<ISearchSubdestination> subdest1 = searchProviderConfig.getAvailableSearchSubdestinations(objectType_1, destinationCategory1, provider1);

 		assertEquals("One subdestination expected", 1, subdest1.size());

 		assertTrue("Subdestination 1 not returned", subdest1.contains(subdestination1.proxy()));

 		

-		final List<ISearchSubdestination> subdest2 = searchProviderConfig.getAvailableSearchSubdestinations(objectType_1.proxy(), destinationCategory2.proxy(), provider1.proxy());

+		final List<ISearchSubdestination> subdest2 = searchProviderConfig.getAvailableSearchSubdestinations(objectType_1, destinationCategory2, provider1);

 		assertEquals("Two subdestination expected", 2, subdest2.size());

 		assertTrue("Subdestination 2 not returned", subdest2.contains(subdestination2.proxy()));

 		assertTrue("Subdestination 3 not returned", subdest2.contains(subdestination3.proxy()));

 

-		final List<ISearchSubdestination> subdest3 = searchProviderConfig.getAvailableSearchSubdestinations(objectType_1.proxy(), destinationCategory3.proxy(), provider2.proxy());

+		final List<ISearchSubdestination> subdest3 = searchProviderConfig.getAvailableSearchSubdestinations(objectType_1, destinationCategory3, provider2);

 		assertEquals("No subdestination expected", 0, subdest3.size());

 	}

 	

@@ -589,39 +546,39 @@
 	public void testGetActiveSearchSubdestinations()

 	{

 		

-		final List<ISearchSubdestination> subdest2 = searchProviderConfig.getAvailableSearchSubdestinations(objectType_1.proxy(), destinationCategory2.proxy(), provider1.proxy());

+		final List<ISearchSubdestination> subdest2 = searchProviderConfig.getAvailableSearchSubdestinations(objectType_1, destinationCategory2, provider1);

 		assertEquals("Two subdestination expected", 2, subdest2.size());

 		assertTrue("Subdestination 2 not returned", subdest2.contains(subdestination2.proxy()));

 		assertTrue("Subdestination 3 not returned", subdest2.contains(subdestination3.proxy()));

 

-		assertTrue("Subdestination 2 not checked", searchProviderConfig.isSubdestinationActive(subdestination2.proxy(), objectType_1.proxy(), destinationCategory2.proxy(), provider1.proxy()));

-		searchProviderConfig.activateSubdestination( objectType_1.proxy(),  destinationCategory2.proxy(), provider1.proxy(), subdestination2.proxy(), false);

+		assertTrue("Subdestination 2 not checked", searchProviderConfig.isSubdestinationActive(subdestination2.proxy(), objectType_1, destinationCategory2, provider1));

+		searchProviderConfig.activateSubdestination( objectType_1,  destinationCategory2, provider1, subdestination2.proxy(), false);

 

-		assertFalse("Subdestination 2 is checked", searchProviderConfig.isSubdestinationActive(subdestination2.proxy(), objectType_1.proxy(), destinationCategory2.proxy(), provider1.proxy()));

+		assertFalse("Subdestination 2 is checked", searchProviderConfig.isSubdestinationActive(subdestination2.proxy(), objectType_1, destinationCategory2, provider1));

 		

 		

 		

 	}

 	public void testGetDestinationCategoriesForDestination() throws DestinationCategoryNotFoundException

 	{

-		assertEquals("Destination category 1 expected for destination1", DESTINATION_CATEGORY_ID_1, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination1.proxy()).iterator().next().getId());

-		assertEquals("Destination category 1 expected for destination2", DESTINATION_CATEGORY_ID_1, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination2.proxy()).iterator().next().getId());

-		assertEquals("Destination category 2 expected for destination3", DESTINATION_CATEGORY_ID_2, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination3.proxy()).iterator().next().getId());

-		assertEquals("Destination category 2 expected for destination4", DESTINATION_CATEGORY_ID_2, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination4.proxy()).iterator().next().getId());

-		assertEquals("Destination category 2 expected for destination5", DESTINATION_CATEGORY_ID_2, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination5.proxy()).iterator().next().getId());

-		assertEquals("Destination category 3 expected for destination6", DESTINATION_CATEGORY_ID_3, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination6.proxy()).iterator().next().getId());

-		assertEquals("Destination category 3 expected for destination7", DESTINATION_CATEGORY_ID_3, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination7.proxy()).iterator().next().getId());

-		assertEquals("Destination category 4 expected for destination8", DESTINATION_CATEGORY_ID_4, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination8.proxy()).iterator().next().getId());

+		assertEquals("Destination category 1 expected for destination1", DESTINATION_CATEGORY_ID_1, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination1).iterator().next().getId());

+		assertEquals("Destination category 1 expected for destination2", DESTINATION_CATEGORY_ID_1, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination2).iterator().next().getId());

+		assertEquals("Destination category 2 expected for destination3", DESTINATION_CATEGORY_ID_2, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination3).iterator().next().getId());

+		assertEquals("Destination category 2 expected for destination4", DESTINATION_CATEGORY_ID_2, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination4).iterator().next().getId());

+		assertEquals("Destination category 2 expected for destination5", DESTINATION_CATEGORY_ID_2, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination5).iterator().next().getId());

+		assertEquals("Destination category 3 expected for destination6", DESTINATION_CATEGORY_ID_3, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination6).iterator().next().getId());

+		assertEquals("Destination category 3 expected for destination7", DESTINATION_CATEGORY_ID_3, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination7).iterator().next().getId());

+		assertEquals("Destination category 4 expected for destination8", DESTINATION_CATEGORY_ID_4, searchProviderConfig.getDestinationCategoriesForDestination(searchDestination8).iterator().next().getId());

 	}

 	

 	public void testGetAvailableDestinationProviders()

 	{

 		final List<IDestinationsProviderDescription> providers = searchProviderConfig.getAvailableDestinationProviders();

 		assertEquals("5 providers expected", 5, providers.size());

-		assertTrue("destinationProviderDescr1 not found", providers.contains(destinationProviderDescr1.proxy()));

-		assertTrue("destinationProviderDescr2 not found", providers.contains(destinationProviderDescr2.proxy()));

-		assertTrue("destinationProviderDescr3 not found", providers.contains(destinationProviderDescr3.proxy()));

-		assertTrue("destinationProviderDescr4 not found", providers.contains(destinationProviderDescr4.proxy()));

-		assertTrue("destinationProviderDescr5 not found", providers.contains(destinationProviderDescr5.proxy()));

+		assertTrue("destinationProviderDescr1 not found", providers.contains(destinationProviderDescr1));

+		assertTrue("destinationProviderDescr2 not found", providers.contains(destinationProviderDescr2));

+		assertTrue("destinationProviderDescr3 not found", providers.contains(destinationProviderDescr3));

+		assertTrue("destinationProviderDescr4 not found", providers.contains(destinationProviderDescr4));

+		assertTrue("destinationProviderDescr5 not found", providers.contains(destinationProviderDescr5));

 	}

 }

diff --git a/tests/org.eclipse.platform.discovery.runtime.test.unit/src/org/eclipse/platform/discovery/runtime/test/unit/internal/SubdestinationsActivationConfigTest.java b/tests/org.eclipse.platform.discovery.runtime.test.unit/src/org/eclipse/platform/discovery/runtime/test/unit/internal/SubdestinationsActivationConfigTest.java
index 6aabe39..68ad186 100644
--- a/tests/org.eclipse.platform.discovery.runtime.test.unit/src/org/eclipse/platform/discovery/runtime/test/unit/internal/SubdestinationsActivationConfigTest.java
+++ b/tests/org.eclipse.platform.discovery.runtime.test.unit/src/org/eclipse/platform/discovery/runtime/test/unit/internal/SubdestinationsActivationConfigTest.java
@@ -24,12 +24,14 @@
 import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IObjectTypeDescription;
 import org.eclipse.platform.discovery.runtime.internal.model.descriptions.ISearchProviderDescription;
 import org.eclipse.platform.discovery.runtime.internal.xp.ISearchSubdestinationExtensionParser;
+import org.eclipse.platform.discovery.testutils.utils.model.ConflictBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.DestinationCategoryDescriptionBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.ObjectTypeDescriptionBuilder;
 import org.eclipse.platform.discovery.testutils.utils.model.SubdestinationBuilder;
 

 public class SubdestinationsActivationConfigTest extends TestCase

 {
 	
-	private SubdestinationBuilder subdestinationBuilder = new SubdestinationBuilder();

 	private final String OBJECT_TYPE_ID = "myobject";

 	private final String DEST_CATEGORY_ID = "mydestination";

 	private final String SUBDEST_ID = "mysubdestination";

@@ -52,16 +54,13 @@
 	@Override

 	protected void setUp() throws Exception

 	{

-		subdestination = subdestinationBuilder.buildSubdestination(SUBDEST_ID, DEST_CATEGORY_ID, OBJECT_TYPE_ID);
-		otherSubdestination = subdestinationBuilder.buildSubdestination(OTHER_SUBDEST_ID, OTHER_DEST_CATEGORY_ID, OTHER_OBJECT_TYPE_ID);
-		subdestinationWithConflicts = subdestinationBuilder.buildSubdestination(WITH_CONF_SUBDEST_ID, DEST_CATEGORY_ID, OBJECT_TYPE_ID, SUBDEST_ID);
-		

-		objectType = mock(IObjectTypeDescription.class);
-		when(objectType.getId()).thenReturn(OBJECT_TYPE_ID);

-		

-		destinationCategory = mock(IDestinationCategoryDescription.class);
-		when(destinationCategory.getId()).thenReturn(DEST_CATEGORY_ID);

-		

+		objectType = new ObjectTypeDescriptionBuilder().withId(OBJECT_TYPE_ID).object();
+		destinationCategory = new DestinationCategoryDescriptionBuilder().withId(DEST_CATEGORY_ID).object();
+		
+		subdestination = new SubdestinationBuilder().withDestCategoryId(DEST_CATEGORY_ID).forObjectType(OBJECT_TYPE_ID).withId(SUBDEST_ID).object();
+		otherSubdestination = new SubdestinationBuilder().withDestCategoryId(OTHER_DEST_CATEGORY_ID).forObjectType(OTHER_OBJECT_TYPE_ID).withId(OTHER_SUBDEST_ID).object();
+		subdestinationWithConflicts = new SubdestinationBuilder().withDestCategoryId(DEST_CATEGORY_ID).forObjectType(OBJECT_TYPE_ID).conflictsTo(new ConflictBuilder().conflictsToSubdestination(SUBDEST_ID).object()).withId(WITH_CONF_SUBDEST_ID).object();
+		
 		searchProvider = mock(ISearchProviderDescription.class);

 		

 		parser = mock(ISearchSubdestinationExtensionParser.class);
diff --git a/tests/org.eclipse.platform.discovery.test.testutils/META-INF/MANIFEST.MF b/tests/org.eclipse.platform.discovery.test.testutils/META-INF/MANIFEST.MF
index 415d3a0..62df908 100644
--- a/tests/org.eclipse.platform.discovery.test.testutils/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.platform.discovery.test.testutils/META-INF/MANIFEST.MF
@@ -7,7 +7,6 @@
 Require-Bundle: org.eclipse.core.runtime,

  org.eclipse.debug.core,

  org.eclipse.jdt.core,

- abbot.swt.eclipse,

  org.eclipse.ui.forms,

  org.jmock,

  org.easymock,

@@ -15,14 +14,11 @@
  org.eclipse.swt,

  org.eclipse.jface,

  org.eclipse.ui,

- abbot.swt,

  org.eclipse.platform.discovery.runtime,

  org.mockito,

  org.eclipse.platform.discovery.ui

 Bundle-ActivationPolicy: lazy

-Export-Package: org.eclipse.platform.discovery.testutils.utils.abbot,

- org.eclipse.platform.discovery.testutils.utils.abbot.matchers,

- org.eclipse.platform.discovery.testutils.utils.abbot.util,

+Export-Package: org.eclipse.platform.discovery.testutils.internal.plugin,

  org.eclipse.platform.discovery.testutils.utils.jmock,

  org.eclipse.platform.discovery.testutils.utils.junit.util.assertions,

  org.eclipse.platform.discovery.testutils.utils.junit.util.threading,

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/AbstractUITest.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/AbstractUITest.java
deleted file mode 100644
index bd39de8..0000000
--- a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/AbstractUITest.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.testutils.utils.abbot;

-

-import org.eclipse.platform.discovery.testutils.utils.abbot.util.PDEUtil;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.Assertions;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.ConditionCheckException;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.IWaitCondition;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.PlatformUI;
-
-import abbot.swt.finder.WidgetFinder;
-import abbot.swt.finder.WidgetFinderImpl;
-import abbot.swt.finder.WidgetHierarchy;
-import abbot.swt.finder.WidgetHierarchyImpl;
-import abbot.swt.finder.generic.HierarchyPrinter;
-import abbot.swt.tester.ButtonTester;
-import abbot.swt.tester.LabelTester;
-import abbot.swt.tester.MenuItemTester;
-import abbot.swt.tester.MenuTester;
-import abbot.swt.tester.ShellTester;
-import abbot.swt.tester.TableItemTester;
-import abbot.swt.tester.TextTester;
-import abbot.swt.tester.TreeItemTester;
-import abbot.swt.tester.WidgetTester;
-import abbot.swt.utilities.WidgetHierarchyPrinter;
-

-public abstract class AbstractUITest extends PDETestFixture {

-	

-	/** widget tester with specific button functionality */

-	protected static final ButtonTester BUTTON_T = ButtonTester.getButtonTester();

-

-	/** widget tester with specific label functionality */

-	protected static final LabelTester LABEL_T = LabelTester.getLabelTester();

-

-	/** widget tester with specific menu functionality */

-	protected static final MenuTester MENU_T = MenuTester.getMenuTester();

-

-	/** widget tester with specific shell functionality */

-	protected static final ShellTester SHELL_T = ShellTester.getShellTester();

-

-	/** widget tester with specific text functionality */

-	protected static final TextTester TEXT_T = TextTester.getTextTester();

-	

-	/** widget tester with specific table item functionality */

-	protected static final TableItemTester TABLE_ITEM_T = TableItemTester.getTableItemTester();

-	

-	/** widget tester with specific tree item functionality */

-	protected static final TreeItemTester TREE_ITEM_T = TreeItemTester.getTreeItemTester();

-	

-	/** widget tester with specific menu item functionality */

-	protected static final MenuItemTester MENU_ITEM_T = MenuItemTester.getMenuItemTester();

-	
-	protected static final WidgetTester TESTER = new WidgetTester(abbot.swt.Robot.getDefault());
-
-	protected static final WidgetFinder FINDER = new WaitingFinder(WidgetFinderImpl.getDefault());
-	

-	/**

-	 * SWT Widget finder. The {@link AbbotUtil#FINDER} finder is an instance of {@link WaitingFinder} which makes several find

-	 * tries with a timeout between them. This is not convenient for tests that check whether a widget is NOT displayed because

-	 * test execution time increases a lot.

-	 */

-	public static final WidgetFinder QUICK_FINDER = WidgetFinderImpl.getDefault();

-	

-	private static Display display;

-

-	/** The code to be executed by the setUp method.

-	 * @see junit.extensions.PDETestFixture#setUpPDE() */

-	@Override

-	public Display setUpPDE() throws Exception {

-		PDEUtil.prepareWorkbench();

-

-		display = PlatformUI.getWorkbench().getDisplay();

-		

-		return display;

-	}

-

-	/** Deferes test execution for a certain time

-	 * @param delay time in milliseconds */

-	protected void waitFor(int delay) {

-		TESTER.actionDelay(delay);

-	}

-

-	/** Wait for a shell to be displayed.

-	 * @param title regexp for the window title */

-	protected Shell waitForShell(String title) {

-		return ShellTester.waitVisible(title);

-	}

-

-	/** The code to be executed by the tearDown method. 

-	 * @see junit.extensions.PDETestFixture#tearDownPDE() */

-	@Override

-	protected void tearDownPDE() throws Exception {

-		if(getUiStarter() != null)

-		{

-			getUiStarter().closeEnclosingDialog(display);

-		}

-

-		display = null;

-		super.tearDownPDE();

-	}

-	

-	/** Prints out the whole widget tree. Useful if problems arise to find a specific widget. */

-	protected void printWidgets()

-	{

-		final WidgetHierarchy hierarchy = new WidgetHierarchyImpl(display);

-		final HierarchyPrinter<?> printer = new WidgetHierarchyPrinter(hierarchy, System.out);

-		display.syncExec(new Runnable()

-		{

-			public void run()

-			{

-				printer.print();

-			}

-		});

-	}

-	

-	/** Checks if the given control is enabled or not.

-	 * @param control control to be checked

-	 * @return true if enabled, otherwise false */

-	protected boolean isEnabled(final Control control)

-	{

-		assert control != null;

-		final boolean[] enabled = new boolean[1];

-		display.syncExec(new Runnable()

-		{

-			public void run()

-			{

-				enabled[0] = control.isEnabled();				

-			}

-		});

-		return enabled[0];

-	}

-	

-	/**

-	 * Checks whether the radio button specified is selected

-	 * @param button the button to be checked

-	 * @return true in case the button is a check button and is selected, otherwise false

-	 */

-	protected boolean isSelected(final Button button)

-	{

-		assert button != null;

-		final boolean[] selected = new boolean[1];

-		display.syncExec(new Runnable()

-		{

-			public void run()

-			{

-				if((button.getStyle() | SWT.RADIO) != 0)

-				{

-					selected[0] = button.getSelection();

-				}

-			}

-		});

-		return selected[0];

-	}

-	

-	/**

-	 * Checks whether the text control specified is editable

-	 * 

-	 * @param text

-	 * @return

-	 */

-	protected boolean isEditable(final Text text)

-	{

-		assert text != null;

-		final boolean[] editable = new boolean[1];

-		display.syncExec(new Runnable()

-		{

-			public void run()

-			{

-				editable[0] = (text.getStyle() & SWT.READ_ONLY) == 0;

-			}

-		});

-		return editable[0];

-	}

-	

-	

-	/**

-	 * Workaround for changing table item checkbox state. It seems that abbot does not behave correctly

-	 * for table item selection and pressing ' ' 

-	 * @param ti

-	 */

-	protected void changeTableItemCheckState(TableItem ti)

-	{

-		TESTER.actionClick(ti, -5, 1);

-		// On some machines sometimes it happens that the item is not checked/unchecked immediately and some time is required

-		waitFor(1000);

-	}

-

-	/**

-	 * Extenders may implement this method in order the dialog control that contains the UI tested to be closed on tearDown

-	 * In case this is not required, <code>null</code> should be returned

-	 * @return

-	 */

-	protected IAbbotTestUiStarter getUiStarter()

-	{

-		return null;

-	}

-

-	/**

-	 * Expands the tree item specified. If the tree item is expanded, the method simply returns

-	 * @param ti tree item

-	 */

-	protected void expandTreeItem(final TreeItem ti)

-	{

-		if(TREE_ITEM_T.getExpanded(ti))

-		{

-			return;

-		}

-		

-		TREE_ITEM_T.actionClick(ti);

-		TREE_ITEM_T.actionKey(SWT.ARROW_RIGHT);

-	}

-

-	/**

-	 * Opens the context menu for the tree item specified. The method will click on the item and will press the right mouse button

-	 * @param ti tree item

-	 */

-	protected void openTreeItemContextMenu(final TreeItem ti)

-	{

-		TREE_ITEM_T.actionClick(ti);		

-		TREE_ITEM_T.actionClick(ti, 1, 1, "BUTTON3");		

-	}

-	

-	/**

-	 * Waits for the widget specified to get disposed 

-	 * @param w the widget which disposal to wait for

-	 * @param failMessage message to fail with in case the widget does not get disposed after some time

-	 */

-	protected void waitForWidgetDisposed(final Widget w, final String failMessage)

-	{

-		Assertions.waitAssert(new IWaitCondition()

-		{

-			@Override

-			public boolean checkCondition() throws ConditionCheckException

-			{

-				return w.isDisposed();

-			}

-		}, failMessage);

-	}

-	

-	protected Display getDisplay()

-	{

-		return display;

-	}

-}
\ No newline at end of file
diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/ActiveSWTTestSuite.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/ActiveSWTTestSuite.java
deleted file mode 100644
index b0c109e..0000000
--- a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/ActiveSWTTestSuite.java
+++ /dev/null
@@ -1,455 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.testutils.utils.abbot;

-

-import java.awt.AWTException;

-import java.awt.Robot;

-import java.util.Timer;

-import java.util.TimerTask;

-import java.util.concurrent.ExecutorService;

-import java.util.concurrent.Executors;

-

-import junit.framework.AssertionFailedError;

-import junit.framework.Test;

-import junit.framework.TestCase;

-import junit.framework.TestResult;

-import junit.framework.TestSuite;

-

-import org.eclipse.platform.discovery.testutils.internal.plugin.TestPlugin;

-import org.eclipse.platform.discovery.testutils.utils.abbot.util.TimerUtils;

-import org.eclipse.platform.discovery.testutils.utils.abbot.util.internal.UICleanupManager;

-import org.eclipse.swt.SWTException;

-import org.eclipse.swt.widgets.Display;

-import org.eclipse.swt.widgets.Shell;

-

-

-/**

- * Suite for UI tests in SWT.

- * <p>

- * Forks the test execution out of the UI thread in order to avoid that a test

- * is blocked because of modal dialogs. The suite itself has to be started in

- * the UI thread. Consequently one cannot nest <code>ActiveSWTTestSuite</code>s.

- * </p>

- * <p>

- * By default remaining dialogs will be closed by hitting escape a number of

- * times. You can change that behavior by calling

- * <code>setCloseShells(true)</code> in {@link #setUpPDE()} or earlier. As a

- * consequence all shells that were not present before the test run will be

- * closed by calling {@link Shell#close()}. This may however cause problems in

- * subsequent tests if a shell is meant to be reused (e.g. GEF holds a shell in

- * a static member).

- * </p>

- *

- * @author Richard Birenheide

- */

-public class ActiveSWTTestSuite extends TestSuite {

-

-	private class RunTestSuiteTask extends TimerTask {

-		private final TestResult result;

-		private final ExecutorService service;

-

-

-		public RunTestSuiteTask(TestResult result, ExecutorService service) {

-			super();

-			this.result = result;

-			this.service = service;

-		}

-

-		@Override

-		public void run() {

-			this.result.addError(ActiveSWTTestSuite.this, new Throwable("Test execution terminated to avoid JDTD timeout"));

-			try {

-				ActiveSWTTestSuite.this.suiteTearDown();

-			} catch (AssertionFailedError th) {

-				this.result.addFailure(ActiveSWTTestSuite.this, th);

-			} catch (Exception ex) {

-				this.result.addError(ActiveSWTTestSuite.this, ex);

-			}

-			ActiveSWTTestSuite.this.testsFinished = true;

-			ActiveSWTTestSuite.this.display.wake();

-			service.shutdownNow();

-			//System.exit(0);

-		}

-

-

-	}

-

-	private final UICleanupManager cleanupManager = new UICleanupManager();

-

-	// private final static long JDTD_TIME =

-	// System.getProperty("testrun.activeTimeout")

-	// == null ? 100000 :

-	// Long.parseLong(System.getProperty("testrun.activeTimeout"));

-

-	private volatile boolean testsFinished = false;

-

-	/**

-	 * The display associated with this run.

-	 */

-	protected Display display;

-	/**

-	 * The shell being active when starting this run.

-	 */

-	protected Shell rootShell;

-

-	/**

-	 * Hold the number of tests in a test case that are already executed

-	 */

-	protected int executedTestsCount;

-

-	private TimerUtils timeController = TimerUtils.getInstance();

-

-	// a little less, than 15 mins, defined by JDTD itself

-	private final static long JDTD_TIMEOUT = 14 * 60 * 1000;

-

-	public TimerUtils getTimeController() {

-		return timeController;

-	}

-

-	public void setTimeController(TimerUtils timeController) {

-		this.timeController = timeController;

-	}

-

-	/**

-	 * Default constructor.

-	 * <p/>

-	 * The name associated with this class is given the Class name.

-	 */

-	public ActiveSWTTestSuite() {

-		super(ActiveSWTTestSuite.class.getName());

-		initJDTDExecutionTimeControlling();

-	}

-

-	/**

-	 * Constructs with a test class.

-	 * <p/>

-	 * The name associated with this class is given the Class name.

-	 *

-	 * @param theClass

-	 *            a test class.

-	 */

-	public ActiveSWTTestSuite(final Class<? extends TestCase> theClass) {

-		super(theClass, ActiveSWTTestSuite.class.getName());

-		initJDTDExecutionTimeControlling();

-	}

-

-	/**

-	 * Constructs with a name containing no test.

-	 * <p/>

-	 *

-	 * @param name

-	 *            the name. This name will be given to the separate thread

-	 *            running.

-	 */

-	public ActiveSWTTestSuite(final String name) {

-		super(name);

-		initJDTDExecutionTimeControlling();

-	}

-

-	/**

-	 * Constructs with a name and containing the test class given.

-	 * <p/>

-	 *

-	 * @param theClass

-	 *            a test class.

-	 * @param name

-	 *            the name. This name will be given to the separate thread

-	 *            running.

-	 */

-	public ActiveSWTTestSuite(final Class<? extends TestCase> theClass, final String name) {

-		super(theClass, name);

-		initJDTDExecutionTimeControlling();

-	}

-

-	@Override

-	public final void run(final TestResult result) {

-		this.display = Display.getCurrent();

-		if (this.display == null) {

-			throw new IllegalStateException(

-					"The TestSuite must be run from an SWT UI thread");

-		}

-		this.rootShell = display.getActiveShell();

-		this.cleanupManager.registerUIState();

-

-		final ExecutorService service = Executors.newSingleThreadScheduledExecutor();

-		// handle JDTD timeout: stop the test before JDTD timeout is thrown

-		Timer timeoutTimer = new Timer();

-		TimerTask task = new RunTestSuiteTask(result, service);

-		timeoutTimer.schedule(task, TimerUtils.getInstance().getRemainingTime());

-		service.execute(new TestSuiteRunnerTask(result));

-

-		waitUntilFinished();

-

-	}

-

-	private void initJDTDExecutionTimeControlling() {

-		executedTestsCount = 0;

-		if (this.timeController.getJDTD_TIME() == 0) {

-			String jdtdProperty = System.getProperty("testrun.activeTimeout");

-			this.timeController

-					.setJDTD_TIME(jdtdProperty == null ? JDTD_TIMEOUT : Long

-							.parseLong(jdtdProperty) * 1000);

-		}

-		System.out.println("******** Expected end of test run: "

-				+ this.timeController.formatNowTime(this.timeController

-						.getJDTD_TIME()) + "    ***********");

-		this.timeController.setSTART_TIME(System.currentTimeMillis());

-	}

-

-	private boolean shouldSkipNextTestExecution() {

-		long[] timeCheck = this.timeController.getRequiredTime(this

-				.countTestCases(), this.executedTestsCount);

-		return timeCheck[0] < timeCheck[1];

-	}

-

-	@Override

-	public final void runTest(final Test test, final TestResult result) {

-		try {

-			// inlined due to limitation in VA/Java

-			// ActiveSWTTestSuite.super.runTest(test, result);

-			test.run(result);

-		} finally {

-			ActiveSWTTestSuite.this.runFinished();

-		}

-	}

-

-	private void waitUntilFinished() {

-		while (!this.testsFinished) {

-			try {

-				if (!display.readAndDispatch()) {

-					display.sleep();

-				}

-			} catch (final SWTException ex) {

-				TestPlugin

-						.logError(

-								"A SWTException ocurred during waiting for the tests being finished in thread: "

-										+ Thread.currentThread().getName(), ex);

-				/*

-				 * Do nothing: rethrowing errors leads to premature end of the

-				 * WorkbenchTestable thread and the IDE subsequently not being

-				 * shut down.

-				 */

-			} catch (final RuntimeException ex) {

-				TestPlugin

-						.logError(

-								"A RuntimeException ocurred during waiting for the tests being finished in thread: "

-										+ Thread.currentThread().getName(), ex);

-			}

-		}

-	}

-

-	/**

-	 * Closes all shells when finished.

-	 */

-	private void runFinished() {

-

-		cleanupManager.cleanUp();

-

-	}

-

-	/**

-	 * Retrieves the display associated with this test run.

-	 * <p/>

-	 *

-	 * @return the display associated with this test run. Only valid after the

-	 *         test has been started.

-	 */

-	public Display getDisplay() {

-		return this.display;

-	}

-

-	/**

-	 * Runs a set up prior to executing the entirety of the tests within this

-	 * suite.

-	 * <p>

-	 * The method will run called in the non-UI thread. The default

-	 * implementation does nothing.

-	 * </p>

-	 *

-	 * @throws Exception

-	 *             convenience signature to ensure correct reporting on

-	 *             Exceptions in set up.

-	 *             {@link junit.framework.AssertionFailedError} is permissible

-	 *             as well and will be reported accordingly as failure.

-	 */

-	protected void suiteSetUp() throws Exception {

-	}

-

-	/**

-	 * Runs a tear down after executing all tests within this suite.

-	 * <p>

-	 * The method will run called in the non-UI thread. The default

-	 * implementation does nothing.

-	 * </p>

-	 *

-	 * @throws Exception

-	 *             convenience signature to ensure correct reporting on

-	 *             Exceptions in tear down.

-	 *             {@link junit.framework.AssertionFailedError} is permissible

-	 *             as well and will be reported accordingly as failure.

-	 */

-	protected void suiteTearDown() throws Exception {

-	}

-

-	/**

-	 * Closes all shells and child shells of the given array recursively.

-	 * <p>

-	 * This is called after each TestCase to guarantee that no (blocking)

-	 * dialogs are still open. Does currently not work perfect and it is thus

-	 * highly recommended that this is done properly in TestCase.tearDown().

-	 *

-	 * @param shells

-	 *            the shells to close.

-	 */

-	public static void closeShells(final Shell[] shells) {

-		for (int i = 0; i < shells.length; i++) {

-			if (!shells[i].isDisposed()) {

-				closeShells(shells[i].getShells());

-			}

-			if (!shells[i].isDisposed()) {

-				shells[i].close();

-				// shells[i].dispose();

-			}

-		}

-	}

-

-	/**

-	 * Convenience method for {@link Display#syncExec(java.lang.Runnable)}

-	 * catching {@link SWTException} and rethrowing {@link AssertionFailedError}

-	 * if appropriate.

-	 * <p>

-	 * Should be used from TestCase.testXXX() methods when asserting within the

-	 * SWT thread in order to guarantee that a test failure is displayed

-	 * correctly.

-	 *

-	 * @param display

-	 *            the display to run the runnable in.

-	 * @param runnable

-	 *            the Runnable to execute.

-	 * @throws AssertionFailedError

-	 *             if an assertion failed in the display thread.

-	 * @throws RuntimeException

-	 *             either a RuntimeException has been issued by the Runnable or

-	 *             the Runnable has thrown a Throwable not being a

-	 *             RuntimeException. In that case the RuntimeException carries

-	 *             the original Exception as cause.

-	 */

-	public static void syncExec(final Display display, final Runnable runnable) {

-		try {

-			display.syncExec(runnable);

-		} catch (final SWTException swtEx) {

-			if (swtEx.throwable instanceof AssertionFailedError) {

-				throw (AssertionFailedError) swtEx.throwable;

-			} else {

-				throw swtEx;

-			}

-		}

-	}

-

-	/**

-	 * Convenience method for {@link Display#asyncExec(java.lang.Runnable)}

-	 * catching {@link SWTException} and rethrowing {@link AssertionFailedError}

-	 * if appropriate.

-	 * <p>

-	 * Should be used from TestCase.testXXX() methods when asserting within the

-	 * SWT thread in order to guarantee that a test failure is displayed

-	 * correctly.

-	 * <p/>

-	 * NOTE that exception handling with this method cannot be guaranteed to

-	 * work since exceptions are thrown asynchronously. Currently I have no idea

-	 * how to notify the caller of a test being failed. But generally I have no

-	 * idea why one should like to run _tests_ asynchronously. Possibly one

-	 * could introduce an ErrorListener here but I am not sure. Ideal would be

-	 * to have knowledge about the actual {@link Test} and {@link TestResult}

-	 * when this method is called. Then one could feed the result with

-	 * {@link TestResult#addError(junit.framework.Test, java.lang.Throwable)} or

-	 * {@link TestResult#addFailure(junit.framework.Test, junit.framework.AssertionFailedError)}

-	 * . Actually I do not know how to get the correct Test. Unfortunately it is

-	 * not the one issued by {@link #runTest(Test, TestResult)}.

-	 *

-	 * @param display

-	 *            the display to run the runnable in.

-	 * @param runnable

-	 *            the Runnable to execute.

-	 */

-	public static void asyncExec(final Display display, final Runnable runnable) {

-		try {

-			display.asyncExec(runnable);

-		} catch (final SWTException swtEx) {

-			if (swtEx.throwable instanceof AssertionFailedError) {

-				throw (AssertionFailedError) swtEx.throwable;

-			} else {

-				throw swtEx;

-			}

-		}

-	}

-

-	/**

-	 * Runs the test in the separate thread.

-	 * <p/>

-	 *

-	 * @author Richard Birenheide

-	 */

-	private class TestSuiteRunnerTask implements Runnable {

-

-		private final TestResult result;

-

-		/**

-		 * Constructs with name and the TestResult given.

-		 * <p/>

-		 *

-		 * @param name

-		 *            the threads name.

-		 * @param result

-		 *            the test result.

-		 */

-		private TestSuiteRunnerTask(final TestResult result) {

-			this.result = result;

-			// Prestart the AWT threads so that they will not be started in our

-			// thread group

-			try {

-				final Robot r = new Robot();

-				TestPlugin.logInfo("Robot created: " + r.toString());

-			} catch (final AWTException ex) {

-				TestPlugin.logError(ex);

-			}

-		}

-

-		public void run() {

-

-			// Safeguard the setting of the finish flag against errors.

-			// Otherwise the Test may block infinitely.

-			try {

-				ActiveSWTTestSuite.this.suiteSetUp();

-				if (!shouldSkipNextTestExecution()) {

-					ActiveSWTTestSuite.super.run(this.result);

-				} else {

-					throw new TimeoutExceededException(

-							"The remaining time is less than expected execution time");

-				}

-			} catch (final AssertionFailedError th) {

-				this.result.addFailure(ActiveSWTTestSuite.this, th);

-			} catch (final Exception ex) {

-				this.result.addError(ActiveSWTTestSuite.this, ex);

-			} finally {

-				try {

-					ActiveSWTTestSuite.this.suiteTearDown();

-				} catch (final Exception ex) {

-					this.result.addError(ActiveSWTTestSuite.this, ex);

-				} catch (final AssertionFailedError th) {

-					this.result.addFailure(ActiveSWTTestSuite.this, th);

-				}

-				ActiveSWTTestSuite.this.testsFinished = true;

-				ActiveSWTTestSuite.this.display.wake();

-			}

-		}

-	}

-}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/IAbbotTestUiStarter.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/IAbbotTestUiStarter.java
deleted file mode 100644
index 3c31199..0000000
--- a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/IAbbotTestUiStarter.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.testutils.utils.abbot;

-

-import org.eclipse.swt.widgets.Display;

-

-public interface IAbbotTestUiStarter

-{

-	/**

-	 * Closes the "host" dialog

-	 * @param display the display in which the action would be executed

-	 * @throws NullPointerException when display is null

-	 * @throws IllegalStateException when the host dialog has not been initialized

-	 */

-	public void closeEnclosingDialog(Display display);

-}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/PDETestFixture.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/PDETestFixture.java
deleted file mode 100644
index 70e76cf..0000000
--- a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/PDETestFixture.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.testutils.utils.abbot;
-
-import junit.framework.TestCase;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
-
-import abbot.swt.Robot;
-
-
-/**
- * Provides a simple fixture for PDE testing. 
- * <p/>
- * The fixture tries to close all open stuff on tearDown(). To enforce this,
- * {@link junit.framework.TestCase#tearDown()} and {@link junit.framework.TestCase#setUp()}
- * have been marked final and replaced by {@link #setUpPDE()} and {@link #tearDownPDE()}.
- * @author Richard Birenheide
- */
-public abstract class PDETestFixture extends TestCase {
-	/**
-	 * The display as received by {@link #setUpPDE()}.
-	 */
-	/*
-	 * Although this member is currently not used it might turn out that it is
-	 * needed for proper tearDown() later. In order to not break API later on
-	 * it is introduced now.
-	 */
-	protected Display display = null;
-	/**
-	 * Sets up the fixture.
-	 * <p/>
-	 * Is marked as final to enforce usage of {@link #setUpPDE()} instead.
-	 * Comment from overridden method:<br/>
-	 * {@inheritDoc}
-	 * @throws Exception {@inheritDoc}
-	 * @see junit.framework.TestCase#setUp()
-	 */
-	protected final void setUp() throws Exception {
-		this.display = this.setUpPDE();
-		if (this.display == null) {
-			throw new NullPointerException("Method PDETestFixture.setUpPDE() must not return null");
-		}
-	}
-	/**
-	 * Tears down the fixture.
-	 * <p/>
-	 * Is marked as final to enforce usage of {@link #tearDownPDE()} instead.
-	 * The method tries to close any open blocking UI elements.
-	 * Comment from overridden method:<br/>
-	 * {@inheritDoc}
-	 * @throws Exception {@inheritDoc}
-	 * @see junit.framework.TestCase#tearDown()
-	 */
-	protected final void tearDown() throws Exception {
-		this.tearDownPDE();
-		//This is in order to close cleanly any stuff (eg. menues, modal dialogues) which puts
-		//the UI thread in blocking mode.
-		//FIXME This is a crude workaround. Search for open stuff instead
-		//and close these.
-		Robot robot = new Robot(this.display);
-		for (int i = 0; i < 25; i++) {
-			robot.key(SWT.ESC);
-		}
-	}
-	/**
-	 * Replaces the {@link TestCase#setUp()} method.
-	 * <p/>
-	 * Will be called as self call within setUp().
-	 * @return a Display to invoke calls on. Must be not null and should be the 
-	 * primary display of the application.
-	 * @throws Exception any Exception indicating setUp() failure.
-	 */
-	protected abstract Display setUpPDE() throws Exception;
-	/**
-	 * Replaces the {@link TestCase#tearDown()} method.
-	 * <p/>
-	 * Will be called as first self call from tearDown().
-	 * @throws Exception any Exception indicating tearDown() failure.
-	 */
-	protected void tearDownPDE() throws Exception {
-		
-	}
-}
diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/TimeoutExceededException.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/TimeoutExceededException.java
deleted file mode 100644
index 6e9acf8..0000000
--- a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/TimeoutExceededException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.testutils.utils.abbot;

-

-public final class TimeoutExceededException extends Exception {

-

-	public TimeoutExceededException() {

-		super();

-	}

-

-	public TimeoutExceededException(String message, Throwable cause) {

-		super(message, cause);

-	}

-

-	public TimeoutExceededException(String message) {

-		super(message);

-	}

-

-	public TimeoutExceededException(Throwable cause) {

-		super(cause);

-	}

-

-	/**

-	 *

-	 */

-	private static final long serialVersionUID = 1L;

-

-}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/WaitingFinder.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/WaitingFinder.java
deleted file mode 100644
index fcd6e79..0000000
--- a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/WaitingFinder.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.testutils.utils.abbot;
-
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.Assertions;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.ConditionCheckException;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.IWaitCondition;
-import org.eclipse.swt.widgets.Widget;
-
-import abbot.swt.finder.WidgetFinder;
-import abbot.swt.finder.generic.Matcher;
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-
-
-/**
- * A finder implementation which would perform several attempts to find a widget prior failing
- * 
- * @author Danail Branekov
- */
-public class WaitingFinder implements WidgetFinder
-{
-	private final WidgetFinder delegate;
-
-	public WaitingFinder(final WidgetFinder delegate)
-	{
-		this.delegate = delegate;
-	}
-
-	@Override
-	public Widget find(final Matcher<Widget> matcher) throws NotFoundException, MultipleFoundException
-	{
-		final Widget[] result = new Widget[1];
-		final IWaitCondition condition = new FindWaitCondition()
-		{
-			@Override
-			protected void find() throws NotFoundException, MultipleFoundException
-			{
-				result[0] = delegate.find(matcher);
-			}
-		};
-		Assertions.waitAssert(condition, "Widget not found");
-		return result[0];
-	}
-
-	@Override
-	public Widget find(final Widget node, final Matcher<Widget> matcher) throws NotFoundException, MultipleFoundException
-	{
-		final Widget[] result = new Widget[1];
-		final IWaitCondition condition = new FindWaitCondition()
-		{
-			@Override
-			protected void find() throws NotFoundException, MultipleFoundException
-			{
-				result[0] = delegate.find(node, matcher);
-			}
-		};
-		Assertions.waitAssert(condition, "Widget not found");
-		return result[0];
-	}
-
-	private abstract class FindWaitCondition implements IWaitCondition
-	{
-		@Override
-		public boolean checkCondition() throws ConditionCheckException
-		{
-			try
-			{
-				find();
-				return true;
-			} catch (NotFoundException e)
-			{
-				return false;
-			} catch (MultipleFoundException e)
-			{
-				throw new ConditionCheckException(e);
-			}
-		}
-
-		protected abstract void find() throws NotFoundException, MultipleFoundException;
-	}
-
-}
diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/matchers/EnhancedTextMatcher.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/matchers/EnhancedTextMatcher.java
deleted file mode 100644
index 61a9f8b..0000000
--- a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/matchers/EnhancedTextMatcher.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.testutils.utils.abbot.matchers;

-

-import org.eclipse.swt.custom.CLabel;

-import org.eclipse.swt.widgets.Link;

-import org.eclipse.swt.widgets.Widget;

-import org.eclipse.ui.forms.widgets.Hyperlink;

-

-import abbot.swt.finder.matchers.WidgetTextMatcher;

-

-/**

- * Text matcher which extends {@link WidgetTextMatcher} and adds support for some unsupported controls (e.g. CLabel)

- * @author Danail Branekov

- */

-@SuppressWarnings("rawtypes")

-public class EnhancedTextMatcher extends WidgetTextMatcher

-{

-	private final String text;

-	

-	public EnhancedTextMatcher(String text, boolean mustBeShowing, Class clazz)

-	{

-		super(text, clazz, mustBeShowing);

-		this.text = text;

-	}

-

-	public EnhancedTextMatcher(String text, boolean mustBeShowing)

-	{

-		super(text, mustBeShowing);

-		this.text = text;

-	}

-

-	public EnhancedTextMatcher(String text, Class clazz)

-	{

-		super(text, clazz);

-		this.text = text;

-	}

-

-	public EnhancedTextMatcher(String text)

-	{

-		super(text);

-		this.text = text;

-	}

-	

-	@Override

-	public boolean matches(Widget w)

-	{

-		if(w instanceof CLabel)

-		{

-			return handleCLabel((CLabel)w);

-		}

-		

-		if(w instanceof Link)

-		{

-			return handleLink((Link)w);

-		}

-		

-		if(w instanceof Hyperlink)

-		{

-			return handleImageHyperlink((Hyperlink)w);

-		}

-		

-		return super.matches(w);

-	}

-

-	private boolean handleCLabel(final CLabel clabel)

-	{

-		final boolean[] result = new boolean[]{false};

-		clabel.getDisplay().syncExec(new Runnable(){

-			@Override

-			public void run()

-			{

-				result[0] = text.equals(clabel.getText());

-			}});

-		

-		return result[0];

-	}

-

-	private boolean handleLink(final Link link)

-	{

-		final boolean[] result = new boolean[]{false};

-		link.getDisplay().syncExec(new Runnable(){

-			@Override

-			public void run()

-			{

-				result[0] = text.equals(link.getText());

-			}});

-		

-		return result[0];

-	}

-	

-	private boolean handleImageHyperlink(final Hyperlink link)

-	{

-		final boolean[] result = new boolean[]{false};

-		link.getDisplay().syncExec(new Runnable(){

-			@Override

-			public void run()

-			{

-				result[0] = text.equals(link.getText());

-			}});

-		

-		return result[0];

-	}

-}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/matchers/SiblingTextMatcher.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/matchers/SiblingTextMatcher.java
deleted file mode 100644
index d3621e8..0000000
--- a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/matchers/SiblingTextMatcher.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.testutils.utils.abbot.matchers;

-import org.eclipse.swt.widgets.Control;

-import org.eclipse.swt.widgets.Widget;

-import org.eclipse.ui.PlatformUI;

-

-import abbot.swt.finder.generic.Matcher;

-import abbot.swt.finder.matchers.WidgetTextMatcher;

-

-/**

- * To find a widget by another labeled widget beneath. Labeled widget has to be placed before the widget to be searched.

- * 

- * @author Joerg Dehmel, Danail Branekov

- */

-public final class SiblingTextMatcher implements Matcher<Widget>

-{

-	private Matcher<Widget> textMatcher;

-

-	private Widget parent;

-

-	private boolean labelFound;

-

-	private boolean widgetFound;

-

-	private Class<?> targetWidgetClass;

-

-	/**

-	 * Constructor

-	 * 

-	 * @param pLabel

-	 *            the label of the labeled widget

-	 */

-	public SiblingTextMatcher(final String pLabel)

-	{

-		assert pLabel != null;

-		labelFound = false;

-		widgetFound = false;

-		textMatcher = new WidgetTextMatcher(pLabel);

-	}

-

-	/**

-	 * Constructor

-	 * 

-	 * @param pLabel

-	 *            the label of the labeled widget

-	 * @param pParent

-	 *            the parent of the widget searched or <code>null</code> in case parent check is not desired

-	 * @param targetWidgetClazz

-	 *            the class of the widget to be found or <code>null</code> in case class check is not desired

-	 */

-	public SiblingTextMatcher(final String pLabel, final Widget pParent, final Class<?> targetWidgetClazz)

-	{

-		this(pLabel);

-		parent = pParent;

-		this.targetWidgetClass = targetWidgetClazz;

-	}

-

-	/**

-	 * Constructor

-	 * 

-	 * @param pLabel

-	 *            the label of the labeled widget

-	 * @param pParent

-	 *            the parent of the widget searched or <code>null</code> in case parent check is not desired

-	 * @param targetWidgetClazz

-	 *            the class of the widget to be found or <code>null</code> in case class check is not desired

-	 * @param textMatcher custom {@link Matcher} implementation            

-	 */

-	public SiblingTextMatcher(final String pLabel, final Widget pParent, final Class<?> targetWidgetClazz, final Matcher<Widget> textM)

-	{

-		this(pLabel, pParent, targetWidgetClazz);

-		textMatcher = textM;

-	}

-	

-	public boolean matches(final Widget w)

-	{

-		final boolean[] ret = new boolean[1];

-		PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				if (belongsToParent(w) && !labelFound)

-				{

-					if (textMatcher.matches(w))

-					{

-						labelFound = true;

-					}

-				} else if (labelFound && !widgetFound && isOfTargetClass(w))

-				{

-					widgetFound = true;

-					ret[0] = true;

-				}

-			}

-		});

-		return ret[0];

-	}

-

-	private boolean belongsToParent(final Widget widget)

-	{

-		assert widget != null;

-		if (parent == null)

-		{

-			return true;

-		}

-		if (!(widget instanceof Control))

-		{

-			return false;

-		}

-		final Control control = (Control) widget;

-		Control directParent = control.getParent();

-		while (directParent != null)

-		{

-			if (directParent == parent)

-			{

-				return true;

-			}

-			directParent = directParent.getParent();

-		}

-		return false;

-	}

-

-	private boolean isOfTargetClass(final Widget widget)

-	{

-		assert widget != null;

-		if (targetWidgetClass == null)

-		{

-			return true;

-		}

-

-		if (!(widget instanceof Control))

-		{

-			return false;

-		}

-

-		return widget.getClass().equals(targetWidgetClass);

-	}

-}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/matchers/ToolItemMatcher.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/matchers/ToolItemMatcher.java
deleted file mode 100644
index acf84bd..0000000
--- a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/matchers/ToolItemMatcher.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.testutils.utils.abbot.matchers;

-

-import org.eclipse.swt.widgets.Control;

-import org.eclipse.swt.widgets.Display;

-import org.eclipse.swt.widgets.ToolItem;

-import org.eclipse.swt.widgets.Widget;

-

-import abbot.swt.finder.generic.Matcher;

-

-public class ToolItemMatcher implements Matcher<Widget>

-{

-	private final Widget parent;

-	private Display display;

-

-	public ToolItemMatcher(final Widget parent, final Display testDisplay)

-	{

-		this.parent = parent;

-		this.display = testDisplay;

-	}

-

-	private boolean belongsToParent(final ToolItem toolItem, final Widget parent)

-	{

-		final boolean result[] = new boolean[] { false };

-		display.syncExec(new Runnable()

-		{

-			public void run()

-			{

-				Control parentControl = toolItem.getParent();

-				while (parentControl != null)

-				{

-					if (parentControl == parent)

-					{

-						result[0] = true;

-					}

-					parentControl = parentControl.getParent();

-				}

-			}

-		});

-

-		return result[0];

-	}

-

-	public boolean matches(Widget w)

-	{

-		if(w instanceof ToolItem)

-		{

-			return belongsToParent((ToolItem) w, this.parent);

-		}

-		return false;

-	}

-}
\ No newline at end of file
diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/util/PDEUtil.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/util/PDEUtil.java
deleted file mode 100644
index 9a6438a..0000000
--- a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/util/PDEUtil.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.testutils.utils.abbot.util;

-

-import junit.framework.AssertionFailedError;

-

-public class PDEUtil

-{

-	private PDEUtil()

-	{

-		// prevent instantiation

-	}

-

-	/**

-	 * Checks whether the calling application is in foreground.

-	 * <p/>

-	 * 

-	 * @return true if the calling application currently is the active window in OS terms.

-	 */

-	private static boolean isDisplayShellActiveWindow()

-	{

-		// TODO invent implementation which works on all platforms

-		

-		// Bellow is a Windows implementation

-		// final boolean[] b = new boolean[1];

-		// if (Platform.getOS().equals(Platform.OS_WIN32)) {

-		// Display.getDefault().syncExec(new Runnable() {

-		// public void run() {

-		// IWorkbench wb = PlatformUI.getWorkbench();

-		// IWorkbenchWindow window = wb.getActiveWorkbenchWindow();

-		//

-		// int winCount = wb.getWorkbenchWindowCount();

-		// if (window == null && winCount > 0) {

-		// window = wb.getWorkbenchWindows()[0];

-		// }

-		// Shell shell = window.getShell();

-		// // shell.layout(true, true); // gain focus

-		// // maximize window TODO remove ?

-		//

-		// int hWnd = shell.handle;

-		// int activeHwnd = OS.GetForegroundWindow();

-		// b[0] = hWnd == activeHwnd;

-		// }

-		// });

-		// return b[0];

-		// }

-		// else {

-		// System.err.println(Platform.getOS() + " " + Platform.OS_WIN32);

-		// return true;

-		// }

-

-		return true;

-	}

-

-	/**

-	 * Does anything one could think about to prepare for UI tests.

-	 * <p/>

-	 * Currently calls consecutive:

-	 * <ol>

-	 * <li>{@link #assertDisplayIsActiveWindow()}</li>

-	 * <li>{@link #closeWelcomePage()}</li>

-	 * <li>{@link #restoreActivePage()}</li>

-	 * </ol>

-	 */

-	public static void prepareWorkbench()

-	{

-		assertDisplayIsActiveWindow();

-	}

-

-	/**

-	 * Asserts that the calling application is the active application in OS terms.

-	 * <p/>

-	 * 

-	 * @throws AssertionFailedError

-	 *             if the application is not in foreground. In that case the message of the error contains the title of the currently active

-	 *             application.

-	 */

-	private static void assertDisplayIsActiveWindow()

-	{

-		if (!isDisplayShellActiveWindow())

-		{

-			final String activeWindowTitle = getActiveWindowTitle();

-			throw new AssertionFailedError("The active window[" + activeWindowTitle + "] is not the test window");

-		}

-	}

-

-	private static String getActiveWindowTitle()

-	{

-		// TODO implement something that gets active window title on all platforms

-		

-		// Below is an example of windows implementation

-		// int WM_GETTEXT = 13;

-		// int WM_GETTEXTLENGTH = 14;

-		// int hWnd = OS.GetForegroundWindow();

-		// int length = OS.GetWindowTextLength(hWnd);

-		// length = OS.SendMessage(hWnd, WM_GETTEXTLENGTH, 0, 0);

-		// TCHAR lpString = new TCHAR(0, length);

-		// OS.SendMessage(hWnd, WM_GETTEXT, length + 1, lpString);

-		// return lpString.toString();

-

-		return "";

-	}

-}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/util/TimerUtils.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/util/TimerUtils.java
deleted file mode 100644
index 4834158..0000000
--- a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/util/TimerUtils.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.testutils.utils.abbot.util;

-

-import java.lang.reflect.Constructor;

-import java.text.DateFormat;

-

-public class TimerUtils {

-

-	/**

-	 * Holds the initial time before started the test execution to have the time

-	 * over the complete test run

-	 */

-	private long JDTD_TIME;

-	private long START_TIME;

-

-	private static TimerUtils instance = null;

-

-	public static TimerUtils getInstance() {

-		if (instance == null) {

-			instance = new TimerUtils();

-		}

-		return instance;

-	}

-

-	public void setSTART_TIME(long pStart_time) {

-		START_TIME = pStart_time;

-	}

-

-	public long getJDTD_TIME() {

-		return JDTD_TIME;

-	}

-

-	public void setJDTD_TIME(long pJdtd_time) {

-		//throw timeout before JDTD

-		double precaution = pJdtd_time * 0.1;

-		JDTD_TIME = (System.currentTimeMillis() + pJdtd_time - (long)precaution);

-	}

-

-	public final String formatNowTime(final long pNow) {

-

-		DateFormat dataformat = DateFormat.getTimeInstance(DateFormat.LONG);

-		return dataformat.format(pNow);

-

-	}

-

-	public final long getRemainingTime() {

-		long remTime = JDTD_TIME - System.currentTimeMillis();

-		return remTime;

-	}

-

-	@SuppressWarnings("unchecked")

-	public final <T extends Number> T getMaxExecutionTime(final T pTimeout) {

-		T result = pTimeout;
-		

-		if (JDTD_TIME == 0) {

-			return pTimeout;

-		} else {

-			long remainingTime = getRemainingTime();

-			if (remainingTime < pTimeout.longValue()) {

-				System.out.println("Change delay time from . " + pTimeout

-						+ " sec. to " + remainingTime + " sec.");

-				result = remainingTime < 0 || pTimeout.longValue() < 0 ? (T) convert(

-						0, pTimeout.getClass())

-						: (T) convert(new Long(remainingTime), pTimeout

-								.getClass());

-			}

-			return result;

-		}

-

-	}

-

-	private <T> T convert(Object value, Class<T> to) {

-		try { // first try valueOf Method...

-			return to.cast(to.getDeclaredMethod("valueOf",

-					new Class[] { String.class })

-					.invoke(null, value.toString()));

-		} catch (Exception e) { // if that fails

-			try { // try String based Constructor

-				Constructor<T> constructor = to

-						.getDeclaredConstructor(String.class);

-				return constructor.newInstance(value.toString());

-			} catch (Exception ee) {

-				throw new RuntimeException(String.format(

-						"Conversion from %s to %s failed for value %s", value

-								.getClass(), to, value));

-			}

-		}

-	}

-

-	public long[] getRequiredTime(int pTestCount, int pExecutedTestsCount) {

-		long ret[] = new long[2];

-		long remTime = getRemainingTime();

-		long reqTime;

-		if (pExecutedTestsCount > 0)

-			reqTime = (System.currentTimeMillis() - START_TIME)

-					/ pExecutedTestsCount;

-		else

-			reqTime = pTestCount == 0 ? remTime : remTime / pTestCount;

-

-		ret[0] = remTime;

-		ret[1] = reqTime;

-		return ret;

-	}

-

-}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/util/internal/UICleanupManager.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/util/internal/UICleanupManager.java
deleted file mode 100644
index 80ec21a..0000000
--- a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/abbot/util/internal/UICleanupManager.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.testutils.utils.abbot.util.internal;

-

-import java.util.Arrays;

-import java.util.HashSet;

-import java.util.Set;

-

-import org.eclipse.platform.discovery.testutils.internal.plugin.TestPlugin;

-import org.eclipse.platform.discovery.testutils.utils.abbot.ActiveSWTTestSuite;

-import org.eclipse.swt.SWT;

-import org.eclipse.swt.widgets.Display;

-import org.eclipse.swt.widgets.Shell;

-import org.eclipse.ui.PlatformUI;

-

-import abbot.swt.Robot;

-

-/**

- * Tool class providing the functionality to clean up the UI after a test has

- * been called. A typical scenario is to close all modal dialogs (which may have

- * not been expected by the test and hence have made it fail) to ensure that the

- * UI thread is not blocked and that following UI tests can start in a defined

- * state. Note that however there is no mean to avoid all interference between

- * UI test, just for the sheer complexity of the UI.

- * <p>

- * For the possible cleanup actions, see the

- * {@link UICleanupManager.CleanupMethod} constants.

- * </p>

- * <p>

- * This class is not public since it has inherited design flaws from legacy

- * classes using this class. Specifically, the fact that calls to

- * <code>setCleanupMethod</code> must be permitted after

- * <code>registerUIState</code> entails a potentially inefficient

- * implementation. However, not being public it can be easily refactored if

- * functionality of this class shall be made available in other projects.

- * </p>

- *

- * @see ActiveSWTTestSuite

- */

-public class UICleanupManager /* implements ISideEffectCleanupManager */{

-    /** Selected cleanup method. */

-    private CleanupMethod cleanupMethod;

-    /** List of shells that were open before the test. */

-    private Set<Shell> shellsBeforeExecution = null;

-    /** Name of test using this manager (for debug output). */

-    private String testDebugName;

-

-    /**

-     * Approaches for cleaning up spurious UI elements (modal dialogs, context

-     * menus, etc.) after the test execution.

-     */

-    public static enum CleanupMethod {

-        /**

-         * Register open shells before the test is executed and call

-         * <code>close()</code> on every shell that has been left open by the

-         * test, in addition to sending escapes.

-         * <p>

-         * Warning: This method is known to cause problems with the Graphical

-         * Editing Framework (GEF) as of Eclipse version 3.3, since GEF stores a

-         * shell in a static member.

-         * </p>

-         */

-        SHELL_CLOSE_AND_ESCAPES,

-        /**

-         * Send escape keys as a heuristic to close dialogs and context menus

-         * after the test execution.

-         */

-        ESCAPES

-    }

-

-    /**

-     * Constructs a manager instance using the most widely applicable cleanup

-     * method.

-     */

-    public UICleanupManager() {

-        this(CleanupMethod.ESCAPES);

-    }

-

-    /**

-     * Constructs a manager instance with the specified cleanup method.

-     *

-     * @param the

-     *            cleanup method to use. Must not be <code>null</code>.

-     */

-    public UICleanupManager(final CleanupMethod method) {

-        if (method == null) {

-            throw new NullPointerException("The method parameter must not be null.");

-        }

-        this.cleanupMethod = method;

-    }

-

-    /**

-     * Call this method before executing a test.

-     */

-    public void registerUIState() {

-        // register currently open shells; NB: this step must be done

-        // irrespective of the active cleanup method because users of this

-        // class require that setCleanupMethod may still be called after

-        // calling this method

-        final Display display = Display.getDefault();

-        display.syncExec(new Runnable() {

-            public void run() {

-                UICleanupManager.this.registerOpenShells(display);

-            }

-        });

-    }

-

-    /**

-     * Call this method after executing a test in order to provide a "clean" UI

-     * before the next test is started.

-     *

-     * @throws IllegalStateException

-     *             if {@link #registerUIState()} has not yet been called.

-     */

-    public void cleanUp() throws IllegalStateException {

-        if (shellsBeforeExecution == null)

-            throw new IllegalStateException("registerUIState() must be called before cleanUp().");

-

-        if (cleanupMethod == CleanupMethod.SHELL_CLOSE_AND_ESCAPES) {

-            // explicitly close those shells that were not open before the test method was run

-            final Display display = Display.getDefault();

-            display.syncExec(new Runnable() {

-                public void run() {

-                    UICleanupManager.this.closeLeftOverShells(display);

-                }

-            });

-        }

-

-        switch (cleanupMethod) {

-        case SHELL_CLOSE_AND_ESCAPES:

-        case ESCAPES:

-            // attempt to close dialogs and context menus

-            final Robot robot = new Robot(PlatformUI.getWorkbench().getDisplay());

-            for (int i = 0; i < 25; i++) {

-                robot.key(SWT.ESC);

-            }

-        }

-    }

-

-    /**

-     * Stores the currently open shells. Must be called within the UI thread.

-     *

-     * @param display

-     *            the default display.

-     */

-    private void registerOpenShells(final Display display) {

-        final Shell[] currentShells = display.getShells();

-        shellsBeforeExecution = new HashSet<Shell>(Arrays.asList(currentShells));

-    }

-

-    /**

-     * Closes shells that were not open when {@link #registerUIState()} was

-     * called. Must be called within the UI thread.

-     *

-     * @param display

-     *            the default display.

-     */

-    private void closeLeftOverShells(final Display display) {

-        final Shell[] openShells = display.getShells();

-        for (final Shell s : openShells) {

-            if (!shellsBeforeExecution.contains(s)) {

-                TestPlugin.logWarning("WARNING: " + testDebugName

-                        + ": There is a shell open which has not been open when the test was started: " + s);

-                ActiveSWTTestSuite.closeShells(new Shell[] { s });

-            }

-        }

-    }

-

-    public CleanupMethod getCleanupMethod() {

-        return cleanupMethod;

-    }

-

-    public void setCleanupMethod(final CleanupMethod method) throws IllegalStateException {

-        this.cleanupMethod = method;

-    }

-}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/Builder.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/Builder.java
new file mode 100644
index 0000000..eb586be
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/Builder.java
@@ -0,0 +1,26 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.testutils.utils.model;

+

+class Builder<T>

+{

+	private final T object;

+

+	Builder(T object)

+	{

+		this.object = object;

+	}

+

+	public T object()

+	{

+		return this.object;

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/ConflictBuilder.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/ConflictBuilder.java
new file mode 100644
index 0000000..0e8a755
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/ConflictBuilder.java
@@ -0,0 +1,28 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.testutils.utils.model;

+

+import org.eclipse.platform.discovery.runtime.api.IConflict;

+import org.mockito.Mockito;

+

+public class ConflictBuilder extends Builder<IConflict>

+{

+	public ConflictBuilder()

+	{

+		super(Mockito.mock(IConflict.class));

+	}

+

+	public ConflictBuilder conflictsToSubdestination(final String subdestinationId)

+	{

+		Mockito.stub(object().getconflictingSubdID()).toReturn(subdestinationId);

+		return this;

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/DescriptiveObjectBuilder.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/DescriptiveObjectBuilder.java
new file mode 100644
index 0000000..72be8ea
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/DescriptiveObjectBuilder.java
@@ -0,0 +1,34 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.testutils.utils.model;

+

+import org.eclipse.platform.discovery.runtime.api.IDescriptiveObject;

+import org.mockito.Mockito;

+

+public abstract class DescriptiveObjectBuilder<T extends IDescriptiveObject> extends Builder<T>

+{

+	public DescriptiveObjectBuilder(T object)

+	{

+		super(object);

+	}

+

+	public DescriptiveObjectBuilder<T> withId(final String id)

+	{

+		Mockito.stub(object().getId()).toReturn(id);

+		return this;

+	}

+

+	public DescriptiveObjectBuilder<T> withName(final String name)

+	{

+		Mockito.stub(object().getDisplayName()).toReturn(name);

+		return this;

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/DestProviderDescriptionBuilder.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/DestProviderDescriptionBuilder.java
new file mode 100644
index 0000000..e3f2cb1
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/DestProviderDescriptionBuilder.java
@@ -0,0 +1,35 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.testutils.utils.model;

+

+import org.eclipse.platform.discovery.runtime.api.IDestinationsProvider;

+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IDestinationsProviderDescription;

+import org.mockito.Mockito;

+

+public class DestProviderDescriptionBuilder extends DescriptiveObjectBuilder<IDestinationsProviderDescription>

+{

+	public DestProviderDescriptionBuilder()

+	{

+		super(Mockito.mock(IDestinationsProviderDescription.class));

+	}

+

+	public DestProviderDescriptionBuilder withProvider(final IDestinationsProvider destProviderInstance)

+	{

+		Mockito.stub(object().createProvider()).toReturn(destProviderInstance);

+		return this;

+	}

+

+	public DestProviderDescriptionBuilder withParefPageId(final String prefPageId)

+	{

+		Mockito.stub(object().getPreferencePageId()).toReturn(prefPageId);

+		return this;

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/DestinationCategoryDescriptionBuilder.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/DestinationCategoryDescriptionBuilder.java
new file mode 100644
index 0000000..f2dae32
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/DestinationCategoryDescriptionBuilder.java
@@ -0,0 +1,37 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.testutils.utils.model;

+

+import java.util.Arrays;

+

+import org.eclipse.platform.discovery.runtime.api.ISearchDestination;

+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IDestinationCategoryDescription;

+import org.mockito.Mockito;

+

+public class DestinationCategoryDescriptionBuilder extends DescriptiveObjectBuilder<IDestinationCategoryDescription>

+{

+	public DestinationCategoryDescriptionBuilder()

+	{

+		super(Mockito.mock(IDestinationCategoryDescription.class));

+	}

+

+	public DestinationCategoryDescriptionBuilder withDestinationProviders(final String... providersIds)

+	{

+		Mockito.stub(object().getDestinationProviderIds()).toReturn(Arrays.asList(providersIds));

+		return this;

+	}

+

+	public DestinationCategoryDescriptionBuilder withDestinationClass(final Class<ISearchDestination> destClass)

+	{

+		Mockito.stub(object().getDestinationsClass()).toReturn(destClass);

+		return this;

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/DestinationsProviderBuilder.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/DestinationsProviderBuilder.java
new file mode 100644
index 0000000..fe8bf62
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/DestinationsProviderBuilder.java
@@ -0,0 +1,32 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.testutils.utils.model;

+

+import java.util.Arrays;

+import java.util.HashSet;

+

+import org.eclipse.platform.discovery.runtime.api.IDestinationsProvider;

+import org.eclipse.platform.discovery.runtime.api.ISearchDestination;

+import org.mockito.Mockito;

+

+public class DestinationsProviderBuilder extends Builder<IDestinationsProvider>

+{

+	public DestinationsProviderBuilder()

+	{

+		super(Mockito.mock(IDestinationsProvider.class));

+	}

+

+	public DestinationsProviderBuilder withDestinations(final ISearchDestination... destinations)

+	{

+		Mockito.stub(object().getSearchDestinations()).toReturn(new HashSet<ISearchDestination>(Arrays.asList(destinations)));

+		return this;

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/ObjectTypeDescriptionBuilder.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/ObjectTypeDescriptionBuilder.java
new file mode 100644
index 0000000..4e22703
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/ObjectTypeDescriptionBuilder.java
@@ -0,0 +1,22 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.testutils.utils.model;

+

+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IObjectTypeDescription;

+import org.mockito.Mockito;

+

+public class ObjectTypeDescriptionBuilder extends DescriptiveObjectBuilder<IObjectTypeDescription>

+{

+	public ObjectTypeDescriptionBuilder()

+	{

+		super(Mockito.mock(IObjectTypeDescription.class));

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/SearchDestinationBuilder.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/SearchDestinationBuilder.java
new file mode 100644
index 0000000..ace74b4
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/SearchDestinationBuilder.java
@@ -0,0 +1,28 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.testutils.utils.model;

+

+import org.eclipse.platform.discovery.runtime.api.ISearchDestination;

+import org.mockito.Mockito;

+

+public class SearchDestinationBuilder extends Builder<ISearchDestination>

+{

+	public SearchDestinationBuilder()

+	{

+		super(Mockito.mock(ISearchDestination.class));

+	}

+

+	public SearchDestinationBuilder withDisplayName(final String displayName)

+	{

+		Mockito.stub(object().getDisplayName()).toReturn(displayName);

+		return this;

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/SearchProviderBuilder.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/SearchProviderBuilder.java
new file mode 100644
index 0000000..d2454a6
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/SearchProviderBuilder.java
@@ -0,0 +1,43 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.testutils.utils.model;

+

+import java.util.Arrays;

+import java.util.HashSet;

+

+import org.eclipse.platform.discovery.runtime.api.GroupingHierarchy;

+import org.eclipse.platform.discovery.runtime.api.ISearchDestination;

+import org.eclipse.platform.discovery.runtime.api.ISearchParameters;

+import org.eclipse.platform.discovery.runtime.api.ISearchProvider;

+import org.eclipse.platform.discovery.runtime.api.ISearchQuery;

+import org.mockito.Mockito;

+

+public class SearchProviderBuilder extends Builder<ISearchProvider>

+{

+	public SearchProviderBuilder()

+	{

+		super(Mockito.mock(ISearchProvider.class));

+	}

+	

+	public SearchProviderBuilder createsQuery(final ISearchQuery query)

+	{

+		Mockito.stub(object().createQuery(Mockito.any(ISearchParameters.class))).toReturn(query);

+		return this;

+	}

+	

+	@SuppressWarnings("unchecked")

+	public SearchProviderBuilder withGroupingHierarchies(final GroupingHierarchy... hierarchies)

+	{

+		Mockito.stub(object().getGroupingHierarchies(Mockito.any(ISearchDestination.class), Mockito.anySet())).toReturn(new HashSet<GroupingHierarchy>(Arrays.asList(hierarchies)));

+		return this;

+	}

+

+}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/SearchProviderDescriptionBuilder.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/SearchProviderDescriptionBuilder.java
new file mode 100644
index 0000000..5cdb6e7
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/SearchProviderDescriptionBuilder.java
@@ -0,0 +1,52 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.testutils.utils.model;

+

+import java.util.Arrays;

+import java.util.HashSet;

+

+import org.eclipse.platform.discovery.runtime.api.ISearchProvider;

+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IDestinationCategoryDescription;

+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IObjectTypeDescription;

+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.ISearchProviderDescription;

+import org.mockito.Mockito;

+

+public class SearchProviderDescriptionBuilder extends DescriptiveObjectBuilder<ISearchProviderDescription>

+{

+	public SearchProviderDescriptionBuilder()

+	{

+		super(Mockito.mock(ISearchProviderDescription.class));

+	}

+

+	public SearchProviderDescriptionBuilder supportsTextSearch(final boolean supportsTextSearch)

+	{

+		Mockito.stub(object().supportsTextSearch()).toReturn(supportsTextSearch);

+		return this;

+	}

+

+	public SearchProviderDescriptionBuilder withSearchProviderInstance(final ISearchProvider searchProvider)

+	{

+		Mockito.stub(object().createInstance()).toReturn(searchProvider);

+		return this;

+	}

+

+	public SearchProviderDescriptionBuilder withDestinationCategories(final IDestinationCategoryDescription... categories)

+	{

+		Mockito.stub(object().getSupportedDestinationCategories()).toReturn(new HashSet<IDestinationCategoryDescription>(Arrays.asList(categories)));

+		return this;

+	}

+

+	public SearchProviderDescriptionBuilder supportsObjectType(final IObjectTypeDescription objectType)

+	{

+		Mockito.stub(object().getObjectType()).toReturn(objectType);

+		return this;

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/SubdestinationBuilder.java b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/SubdestinationBuilder.java
index 5a2d3d7..8a79065 100644
--- a/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/SubdestinationBuilder.java
+++ b/tests/org.eclipse.platform.discovery.test.testutils/src/org/eclipse/platform/discovery/testutils/utils/model/SubdestinationBuilder.java
@@ -1,42 +1,50 @@
 /*******************************************************************************

- * Copyright (c) 2011 SAP AG, Walldorf

+ * Copyright (c) 2011 SAP AG, Walldorf.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * which accompanies this distribution, and is available at

  * http://www.eclipse.org/legal/epl-v10.html

  *

  * Contributors:

- *    SAP AG - initial API and implementation

+ *     SAP AG - initial API and implementation

  *******************************************************************************/

 package org.eclipse.platform.discovery.testutils.utils.model;

 

+import java.util.Arrays;

 import java.util.HashSet;

-import java.util.Set;

 

 import org.eclipse.platform.discovery.runtime.api.IConflict;

 import org.eclipse.platform.discovery.runtime.api.ISearchSubdestination;

-import static org.mockito.Mockito.*;

+import org.mockito.Mockito;

 

-public class SubdestinationBuilder {

-	

-	public ISearchSubdestination buildSubdestination(String id, String categoryId, String objectTypeId, String... conflicts) {

-		ISearchSubdestination result = mock(ISearchSubdestination.class);

-		when(result.getId()).thenReturn(id);

-		when(result.getDestinationCategoryId()).thenReturn(categoryId);

-		when(result.getObjectTypeId()).thenReturn(objectTypeId);

-		Set<IConflict> conflictsSet = buildConflicts(conflicts);

-		when(result.getConflictingSubd()).thenReturn(conflictsSet);

-		return result;

-	}

-	

-	private Set<IConflict> buildConflicts(String[] conflictIds) {

-		Set<IConflict> result = new HashSet<IConflict>();

-		for(String conflictId:conflictIds) {

-			IConflict conflict = mock(IConflict.class);

-			when(conflict.getconflictingSubdID()).thenReturn(conflictId);

-			result.add(conflict);

-		}

-		return result;

+public class SubdestinationBuilder extends DescriptiveObjectBuilder<ISearchSubdestination>

+{

+	public SubdestinationBuilder()

+	{

+		super(Mockito.mock(ISearchSubdestination.class));

 	}

 

+	public SubdestinationBuilder withDestCategoryId(final String destCategoryId)

+	{

+		Mockito.stub(object().getDestinationCategoryId()).toReturn(destCategoryId);

+		return this;

+	}

+

+	public SubdestinationBuilder forObjectType(final String objectTypeId)

+	{

+		Mockito.stub(object().getObjectTypeId()).toReturn(objectTypeId);

+		return this;

+	}

+

+	public SubdestinationBuilder defaultSelected(final boolean defaultSelected)

+	{

+		Mockito.stub(object().isDefaultSelected()).toReturn(defaultSelected);

+		return this;

+	}

+

+	public SubdestinationBuilder conflictsTo(IConflict... conflicts)

+	{

+		Mockito.stub(object().getConflictingSubd()).toReturn(new HashSet<IConflict>(Arrays.asList(conflicts)));

+		return this;

+	}

 }

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/META-INF/MANIFEST.MF b/tests/org.eclipse.platform.discovery.ui.test.comp/META-INF/MANIFEST.MF
index 1e254ae..4b53e01 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/META-INF/MANIFEST.MF
@@ -18,14 +18,12 @@
  org.eclipse.ui.forms,

  org.eclipse.ui.views.properties.tabbed,

  org.eclipse.platform.discovery.util,

- abbot.swt,

- abbot.swt.eclipse,

- org.eclipse.swtbot.eclipse.core;bundle-version="2.0.4",

- org.eclipse.swtbot.eclipse.finder;bundle-version="2.0.4",

- org.eclipse.swtbot.junit4_x;bundle-version="2.0.4",

- org.eclipse.swtbot.swt.finder;bundle-version="2.0.4",

- org.mockito;bundle-version="1.8.4",

- org.apache.log4j;bundle-version="1.2.13"

+ org.eclipse.swtbot.eclipse.core,

+ org.eclipse.swtbot.eclipse.finder,

+ org.eclipse.swtbot.junit4_x,

+ org.eclipse.swtbot.swt.finder,

+ org.mockito,

+ org.apache.log4j

 Export-Package: org.eclipse.platform.discovery.ui.test.comp,

  org.eclipse.platform.discovery.ui.test.comp.internal,

  org.eclipse.platform.discovery.ui.test.comp.prefpage,

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/AllAbbotTestsSuite.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/AllAbbotTestsSuite.java
deleted file mode 100644
index c16d9b3..0000000
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/AllAbbotTestsSuite.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.ui.test.comp;

-

-import junit.framework.Test;
-
-import org.eclipse.platform.discovery.testutils.utils.abbot.ActiveSWTTestSuite;
-import org.eclipse.platform.discovery.testutils.utils.abbot.util.PDEUtil;
-import org.eclipse.platform.discovery.ui.test.comp.internal.AdvancedSearchParamsDisplayerTest;
-import org.eclipse.platform.discovery.ui.test.comp.internal.DiscoveryTreeViewerFactoryAbbotTest;
-import org.eclipse.platform.discovery.ui.test.comp.internal.SearchConsoleViewTest;
-import org.eclipse.platform.discovery.ui.test.comp.internal.SearchFavoritesViewTest;
-import org.eclipse.platform.discovery.ui.test.comp.internal.SubdestinationsSelectedListenerTest;
-

-

-public class AllAbbotTestsSuite extends ActiveSWTTestSuite

-{

-	/**

-	 * Returns a test suite containing the tests to be run by Java Developer Test Dispatcher

-	 * 

-	 * @return - a suite of junit pde test

-	 */

-	public static Test suite()

-	{

-		final AllAbbotTestsSuite suite = new AllAbbotTestsSuite();

-		suite.addTestSuite(SearchConsoleViewTest.class);

-		suite.addTestSuite(SubdestinationsSelectedListenerTest.class);

-		suite.addTestSuite(AdvancedSearchParamsDisplayerTest.class);

-		suite.addTestSuite(SearchFavoritesViewTest.class);

-		suite.addTestSuite(DiscoveryTreeViewerFactoryAbbotTest.class);

-

-		return suite;

-	}

-	

-	@Override

-	protected void suiteSetUp() throws Exception

-	{

-		PDEUtil.prepareWorkbench();

-	}

-

-}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/AllSWTBotTests.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/AllSWTBotTests.java
index 7203677..feba0f1 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/AllSWTBotTests.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/AllSWTBotTests.java
@@ -1,12 +1,27 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

 package org.eclipse.platform.discovery.ui.test.comp;

 

+import org.eclipse.platform.discovery.ui.test.comp.internal.AdvancedSearchParamsDisplayerTest;

 import org.eclipse.platform.discovery.ui.test.comp.internal.ComboSelectorTest;

+import org.eclipse.platform.discovery.ui.test.comp.internal.DiscoveredItemsTreeTest;

 import org.eclipse.platform.discovery.ui.test.comp.internal.ErrorHandlerTest;

 import org.eclipse.platform.discovery.ui.test.comp.internal.InteractiveComboSelectorTest;

 import org.eclipse.platform.discovery.ui.test.comp.internal.OpenPropsViewActionTest;

+import org.eclipse.platform.discovery.ui.test.comp.internal.SearchConsoleViewTest;

 import org.eclipse.platform.discovery.ui.test.comp.internal.SearchDestinationsSelectorTest;

+import org.eclipse.platform.discovery.ui.test.comp.internal.SearchFavoritesViewTest;

 import org.eclipse.platform.discovery.ui.test.comp.internal.SlidingCompositeHorizontalTest;

 import org.eclipse.platform.discovery.ui.test.comp.internal.SlidingCompositeTest;

+import org.eclipse.platform.discovery.ui.test.comp.internal.SubdestinationsSelectorTest;

 import org.eclipse.platform.discovery.ui.test.comp.internal.TabbedSessionDisplayerTest;

 import org.eclipse.platform.discovery.ui.test.comp.internal.TextControlTest;

 import org.eclipse.platform.discovery.ui.view.ViewProgressMonitorTest;

@@ -16,7 +31,8 @@
 

 @RunWith(Suite.class)

 @SuiteClasses({ ErrorHandlerTest.class, SlidingCompositeTest.class, SlidingCompositeHorizontalTest.class, TabbedSessionDisplayerTest.class, OpenPropsViewActionTest.class, ComboSelectorTest.class, 

-		TextControlTest.class, SearchDestinationsSelectorTest.class, InteractiveComboSelectorTest.class, ViewProgressMonitorTest.class })

+		TextControlTest.class, SearchDestinationsSelectorTest.class, InteractiveComboSelectorTest.class, ViewProgressMonitorTest.class, SubdestinationsSelectorTest.class, 

+		DiscoveredItemsTreeTest.class, AdvancedSearchParamsDisplayerTest.class, SearchFavoritesViewTest.class, SearchConsoleViewTest.class })

 public class AllSWTBotTests {

 

 }

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/AdvancedSearchParamsDisplayerTest.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/AdvancedSearchParamsDisplayerTest.java
index c695387..547f059 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/AdvancedSearchParamsDisplayerTest.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/AdvancedSearchParamsDisplayerTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
+ * Copyright (c) 2010, 2011 SAP AG, Walldorf.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -8,413 +8,303 @@
  * Contributors:
  *     SAP AG - initial API and implementation
  *******************************************************************************/
-package org.eclipse.platform.discovery.ui.test.comp.internal;

-

+package org.eclipse.platform.discovery.ui.test.comp.internal;
+
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 
-import org.easymock.EasyMock;
+import junit.framework.Assert;
+
 import org.eclipse.platform.discovery.runtime.api.GroupingHierarchy;
 import org.eclipse.platform.discovery.runtime.api.ISearchDestination;
 import org.eclipse.platform.discovery.runtime.api.ISearchParameters;
 import org.eclipse.platform.discovery.runtime.api.ISearchSubdestination;
-import org.eclipse.platform.discovery.runtime.internal.ISearchProviderConfiguration;
 import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IObjectTypeDescription;
-import org.eclipse.platform.discovery.testutils.utils.abbot.matchers.EnhancedTextMatcher;
 import org.eclipse.platform.discovery.ui.api.IAdvancedSearchParamsUiContributor;
 import org.eclipse.platform.discovery.ui.api.IViewUiContext;
 import org.eclipse.platform.discovery.ui.internal.plugin.DiscoveryUIMessages;
-import org.eclipse.platform.discovery.ui.internal.search.advancedparams.AdvancedSearchParamsDisplayer;
 import org.eclipse.platform.discovery.ui.internal.search.advancedparams.IAdvancedSearchParamsUiContributorDescr;
 import org.eclipse.platform.discovery.ui.internal.view.impl.SearchParameters;
 import org.eclipse.platform.discovery.ui.internal.xp.IAdvancedSearchParamsUiContribXpParser;
+import org.eclipse.platform.discovery.ui.test.comp.internal.fixture.SearchConsoleTestFixture;
+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.AdvancedSearchParamsPageObject;
 import org.eclipse.platform.discovery.util.api.env.IDiscoveryEnvironment;
 import org.eclipse.platform.discovery.util.internal.property.IPropertyAttributeListener;
 import org.eclipse.platform.discovery.util.internal.property.PropertyAttributeChangedEvent;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Widget;
 import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
 
-import abbot.swt.finder.generic.ClassMatcher;
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-

-

-public class AdvancedSearchParamsDisplayerTest extends SearchConsoleTestFixture

-{

-	private static final Object CUSTOM_SEARCH_PARAM_ID_1 = new Object();

-	private static final Object CUSTOM_SEARCH_PARAM_ID_2 = new Object();

-	private static final Object CUSTOM_SEARCH_PARAM_VALUE_1 = new Object();

-	private static final Object CUSTOM_SEARCH_PARAM_VALUE_2 = new Object();

-	

-	private IAdvancedSearchParamsUiContribXpParser xpParser;

-	private MyUiContributor searchParamsUiContributor;

-	private IAdvancedSearchParamsUiContributorDescr searchParamsUiContribDescr;

-	private AdvancedSearchParamsDisplayer displayer;

-	private Composite containingComposite;

-	private Composite parentComposite;

-

-	private final static String TEST_BUTTON_TEXT = "Custom B"; //$NON-NLS-1$

-

-	@Override

-	public Display setUpPDE() throws Exception

-	{

-		final Display d = super.setUpPDE();

-		setupUiContributors();

-		setupXpParser();

-

-		return d;

-	}

-

-	private void setupUiContributors()

-	{

-		searchParamsUiContributor = new MyUiContributor();

-

-		searchParamsUiContribDescr = createThreadSafeNiceMock(IAdvancedSearchParamsUiContributorDescr.class);

-		EasyMock.expect(searchParamsUiContribDescr.getSearchProviderId()).andStubReturn(unsupportingTextSearchProviderDescription.getId());

-		EasyMock.expect(searchParamsUiContribDescr.createContributor()).andStubReturn(searchParamsUiContributor);

-		EasyMock.replay(searchParamsUiContribDescr);

-	}

-

-	private void setupXpParser()

-	{

-		xpParser = createThreadSafeNiceMock(IAdvancedSearchParamsUiContribXpParser.class);

-		EasyMock.expect(xpParser.readContributions()).andStubReturn(Arrays.asList(new IAdvancedSearchParamsUiContributorDescr[] { searchParamsUiContribDescr }));

-		EasyMock.replay(xpParser);

-	}

-

-	private void startDisplayer()

-	{

-		testShell = createTestShell();

-		getDisplay().asyncExec(new Runnable()

-		{

-

-			public void run()

-			{

-				final FormToolkit formToolkit = new FormToolkit(getDisplay());

-				testShell.setLayout(new FillLayout());

-				parentComposite = formToolkit.createComposite(testShell, SWT.BORDER);

-				parentComposite.setLayout(new FormLayout());

-				parentComposite.setLayoutData(fillingFormData());

-

-				displayer = new AdvancedSearchParamsDisplayer(parentComposite, formToolkit)

-				{

-					@Override

-					protected ISearchProviderConfiguration searchProviderConfiguration()

-					{

-						return searchProviderConfiguration;

-					}

-

-					@Override

-					protected Composite createParametersContainingComposite(final Composite parent)

-					{

-						containingComposite = super.createParametersContainingComposite(parent);

-						return containingComposite;

-					}

-

-					@Override

-					protected IAdvancedSearchParamsUiContribXpParser createAdvancedSearchUiContribXpParser()

-					{

-						return xpParser;

-					}

-				};

-				testShell.open();

-				testShell.layout();

-			}

-		});

-		waitForShell(TEST_SHELL_TEXT);

-	}

-

-	public void testUiIsCreatedOnUpdatingDisplayer()

-	{

-		startDisplayer();

-		updateDisplayer(objectType1, destination1);

-		assertTrue("Unexpected UI contributor", displayer.getUiContributor() == searchParamsUiContributor); //$NON-NLS-1$

-		assertEquals("One UI creation expected", 1, searchParamsUiContributor.createdUiCount); //$NON-NLS-1$

-	}

-

-	public void testOldSearchParametersCompositeIsDisposedOnUpdate()

-	{

-		startDisplayer();

-		updateDisplayer(objectType1, destination1);

-		final Composite firstComposite = containingComposite;

-		updateDisplayer(objectType1, destination1);

-		final Composite secondComposite = containingComposite;

-		assertEquals("Two UI creations expected", 2, searchParamsUiContributor.createdUiCount); //$NON-NLS-1$

-

-		assertNotNull(firstComposite);

-		assertNotNull(secondComposite);

-		assertTrue("First params composite was not disposed", firstComposite.isDisposed()); //$NON-NLS-1$

-		assertTrue("Params composite was not recreated", firstComposite != secondComposite); //$NON-NLS-1$

-	}

-

-	public void testSectionIsDisposedNoDestinationSpecified() throws MultipleFoundException, NotFoundException

-	{

-		startDisplayer();

-		updateDisplayer(objectType1, destination1);

-		final Composite[] sectionParent = new Composite[1];

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				sectionParent[0] = containingComposite.getParent();

-			}

-		});

-		updateDisplayer(objectType1, null);

-

-		assertNull("No contributor expected when no UI displayed", displayer.getUiContributor()); //$NON-NLS-1$

-

-		try

-		{

-			QUICK_FINDER.find(new ClassMatcher<Widget>(Section.class));

-			fail("NotFoundException expected");

-		}

-		catch(NotFoundException e)

-		{

-			//expected

-		}

-		

-		final boolean[] containingCompositeDisposed = new boolean[]{false, false};

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				containingCompositeDisposed[0] = containingComposite.isDisposed();

-				containingCompositeDisposed[1] = sectionParent[0].isDisposed();

-			}

-		});

-

-		assertTrue("Containing composite is not disposed", containingCompositeDisposed[0]); //$NON-NLS-1$

-		assertTrue("Section is not disposed", containingCompositeDisposed[1]); //$NON-NLS-1$

-	}

-

-	public void testCustomUIIsDisplayedByDefault() throws MultipleFoundException

-	{

-		startDisplayer();

-		updateDisplayer(objectType1, destination1);

-		try

-		{

-			QUICK_FINDER.find(new EnhancedTextMatcher(TEST_BUTTON_TEXT, Button.class));

-		} catch (NotFoundException e)

-		{

-			fail("Custom ui was not created"); //$NON-NLS-1$

-		}

-	}

-

-	public void testCustomUIHidesWhenNoCustomUi() throws MultipleFoundException

-	{

-		startDisplayer();

-		updateDisplayer(objectType1, destination1);

-		updateDisplayer(objectType2, destination3);

-		try

-		{

-			QUICK_FINDER.find(new EnhancedTextMatcher(TEST_BUTTON_TEXT, Button.class));

-			fail("Custom ui was not hidden"); //$NON-NLS-1$

-		} catch (NotFoundException e)

-		{

-			// expected

-		}

-	}

-

-	public void testSectionTitleChanges() throws MultipleFoundException, NotFoundException

-	{

-		startDisplayer();

-		updateDisplayer(objectType1, destination1);

-		final Label expandLabel = (Label) FINDER.find(new EnhancedTextMatcher(DiscoveryUIMessages.CUSTOM_PARAMS_SECTION_EXPAND_TITLE, Label.class));

-		LABEL_T.actionClick(expandLabel);

-		final Label colapseLabel = (Label) FINDER.find(new EnhancedTextMatcher(DiscoveryUIMessages.CUSTOM_PARAMS_SECTION_COLAPSE_TITLE, Label.class));

-		LABEL_T.actionClick(colapseLabel);

-		QUICK_FINDER.find(new EnhancedTextMatcher(DiscoveryUIMessages.CUSTOM_PARAMS_SECTION_EXPAND_TITLE, Label.class));

-	}

-	

-	public void testVisibilityIsHandledByCustomUI() throws MultipleFoundException, NotFoundException

-	{

-		startDisplayer();

-		updateDisplayer(objectType1, destination1);

-		assertFalse(searchParamsUiContributor.visible);

-		final Label expandLabel = (Label) FINDER.find(new EnhancedTextMatcher(DiscoveryUIMessages.CUSTOM_PARAMS_SECTION_EXPAND_TITLE, Label.class));

-		LABEL_T.actionClick(expandLabel);

-		assertTrue(searchParamsUiContributor.visible);

-		final Label colapseLabel = (Label) FINDER.find(new EnhancedTextMatcher(DiscoveryUIMessages.CUSTOM_PARAMS_SECTION_COLAPSE_TITLE, Label.class));

-		LABEL_T.actionClick(colapseLabel);

-		assertFalse(searchParamsUiContributor.visible);

-	}

-

-	public void testSetEnabled() throws MultipleFoundException, NotFoundException

-	{

-		startDisplayer();

-		updateDisplayer(objectType1, destination1);

-		final Section section = getCustomParamsSection();

-		assertFalse("Section should not be disposed", isSectionDisposed(section)); //$NON-NLS-1$

-		assertFalse("Section should be shrinked", isSectionExpanded(section)); //$NON-NLS-1$

-		final Label expandLabel = (Label) FINDER.find(new EnhancedTextMatcher(DiscoveryUIMessages.CUSTOM_PARAMS_SECTION_EXPAND_TITLE, Label.class));

-		LABEL_T.actionClick(expandLabel);

-		assertTrue("Section should be expanded", isSectionExpanded(section)); //$NON-NLS-1$

-

-		setDisplayerEnabled(displayer, false);

-		assertTrue("Section should be disposed", isSectionDisposed(section)); //$NON-NLS-1$

-

-		setDisplayerEnabled(displayer, true);

-		final Section section2 = getCustomParamsSection();

-		assertFalse(section.equals(section2));

-		assertTrue("Old section should be disposed", isSectionDisposed(section)); //$NON-NLS-1$

-		assertFalse("New section should not be disposed", isSectionDisposed(section2)); //$NON-NLS-1$

-	}

-	

-	public void testUpdateSearchParametersWithCustomParams()

-	{

-		startDisplayer();

-		updateDisplayer(objectType1, destination1);

-		final ISearchDestination searchDestination = EasyMock.createMock(ISearchDestination.class);

-		final ISearchParameters searchParams = new SearchParameters("a", searchDestination, "A", new GroupingHierarchy("A", "A"), new HashSet<ISearchSubdestination>()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$

-		displayer.setParams(searchParams);

-		final Map<Object, Object> customParams = searchParams.getCustomParameters();

-		assertEquals("Two custom parameters expected", 2, customParams.size()); //$NON-NLS-1$

-		assertTrue("Unexpected custom parameter", customParams.get(CUSTOM_SEARCH_PARAM_ID_1) == CUSTOM_SEARCH_PARAM_VALUE_1); //$NON-NLS-1$

-		assertTrue("Unexpected custom parameter", customParams.get(CUSTOM_SEARCH_PARAM_ID_2) == CUSTOM_SEARCH_PARAM_VALUE_2); //$NON-NLS-1$

-	}

-	

-	public void testSectionExapndNotifiesResizeListener() throws MultipleFoundException, NotFoundException

-	{

-		final Point oldSectionSize[] = new Point[1];

-		final Point newSectionSize[] = new Point[1];

-		

-		startDisplayer();

-		updateDisplayer(objectType1, destination1);

-		

-		displayer.registerSizePropertyChangeListener(new IPropertyAttributeListener<Point>()

-		{

-			@Override

-			public void attributeChanged(final PropertyAttributeChangedEvent<Point> event)

-			{

-				oldSectionSize[0] = event.getOldAttribute();

-				newSectionSize[0] = event.getNewAttribute();

-			}

-		}, true);

-

-		assertNotNull(newSectionSize[0]);

-		assertTrue(newSectionSize[0].y > 0);

-		

-		final Label expandLabel = (Label) FINDER.find(new EnhancedTextMatcher(DiscoveryUIMessages.CUSTOM_PARAMS_SECTION_EXPAND_TITLE, Label.class));

-		LABEL_T.actionClick(expandLabel);

-		

-		assertNotNull(oldSectionSize[0]);

-		assertTrue(newSectionSize[0].y > oldSectionSize[0].y);

-		

-		final Label colapseLabel = (Label) FINDER.find(new EnhancedTextMatcher(DiscoveryUIMessages.CUSTOM_PARAMS_SECTION_COLAPSE_TITLE, Label.class));

-		LABEL_T.actionClick(colapseLabel);

-		QUICK_FINDER.find(new EnhancedTextMatcher(DiscoveryUIMessages.CUSTOM_PARAMS_SECTION_EXPAND_TITLE, Label.class));

-		assertTrue(newSectionSize[0].y < oldSectionSize[0].y);

-	}

-	

-

-	private void updateDisplayer(final IObjectTypeDescription objectType, final ISearchDestination destination)

-	{

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				displayer.update(objectType, destination, environment, viewUiContext);

-			}

-		});

-	}

-

-	private class MyUiContributor implements IAdvancedSearchParamsUiContributor

-	{

-		public int createdUiCount = 0;

-		public boolean visible = false;

-		

-		public void createUi(Composite parent, ISearchDestination searchDestination, FormToolkit formToolkit, IDiscoveryEnvironment env, final IViewUiContext uiContext)

-		{

-			createdUiCount++;

-			final Button b = formToolkit.createButton(parent, TEST_BUTTON_TEXT, SWT.PUSH);

-			b.setLayoutData(fillingFormData());

-		}

-

-		@Override

-		public Map<Object, Object> getParameters()

-		{

-			final Map<Object, Object> result = new HashMap<Object, Object>();

-			result.put(CUSTOM_SEARCH_PARAM_ID_1, CUSTOM_SEARCH_PARAM_VALUE_1);

-			result.put(CUSTOM_SEARCH_PARAM_ID_2, CUSTOM_SEARCH_PARAM_VALUE_2);

-			return result;

-		}

-

-		@Override

-		public void handleVisibilityChange(boolean visible)

-		{

-			this.visible = visible;

-		}

-

-		@Override

-		public void setEnabled(boolean enable)

-		{

-		}

-	}

-

-	private FormData fillingFormData()

-	{

-		final FormData fd = new FormData();

-		fd.top = new FormAttachment(0, 0);

-		fd.left = new FormAttachment(0, 0);

-		fd.right = new FormAttachment(100, 0);

-

-		return fd;

-	}

-

-	private Section getCustomParamsSection() throws MultipleFoundException, NotFoundException

-	{

-		return (Section) FINDER.find(new ClassMatcher<Widget>(Section.class));

-	}

-

-	private boolean isSectionDisposed(final Section section)

-	{

-		final boolean[] disposed = new boolean[1];

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				disposed[0] = section.isDisposed();

-			}

-		});

-

-		return disposed[0];

-	}

-

-	private boolean isSectionExpanded(final Section section)

-	{

-		final boolean[] expanded = new boolean[1];

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				expanded[0] = section.isExpanded();

-			}

-		});

-

-		return expanded[0];

-	}

-

-	private void setDisplayerEnabled(final AdvancedSearchParamsDisplayer d, final boolean enabled)

-	{

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				d.setEnabled(enabled);

-			}

-		});

-	}

-}

+public class AdvancedSearchParamsDisplayerTest
+{
+	private final static String TEST_BUTTON_TEXT = "Custom B"; //$NON-NLS-1$
+	private static final Object CUSTOM_SEARCH_PARAM_ID_1 = new Object();
+	private static final Object CUSTOM_SEARCH_PARAM_ID_2 = new Object();
+	private static final Object CUSTOM_SEARCH_PARAM_VALUE_1 = new Object();
+	private static final Object CUSTOM_SEARCH_PARAM_VALUE_2 = new Object();
+
+	private static SearchConsoleTestFixture fixture;
+	private MyUiContributor searchParamsUiContributor;
+	private AdvancedSearchParamsPageObject<Button> paramsPageObject;
+
+	@Mock
+	private IAdvancedSearchParamsUiContributorDescr searchParamsUiContribDescr;
+
+	@Mock
+	private IAdvancedSearchParamsUiContribXpParser xpParser;
+
+	@BeforeClass
+	public static void initFixture()
+	{
+		fixture = new SearchConsoleTestFixture();
+	}
+	
+	@Before
+	public void setUp()
+	{
+		MockitoAnnotations.initMocks(this);
+		setupUiContributors();
+		setupXpParser();
+
+		paramsPageObject = new AdvancedSearchParamsPageObject<Button>(fixture.searchProviderConfiguration, xpParser, searchParamsUiContributor.buttonMatcher());
+		paramsPageObject.open();
+	}
+
+	@After
+	public void tearDown()
+	{
+		paramsPageObject.close();
+	}
+
+	private void setupUiContributors()
+	{
+		searchParamsUiContributor = new MyUiContributor();
+
+		final String searchProviderId = fixture.unsupportingTextSearchProviderDescription.getId();
+		Mockito.stub(searchParamsUiContribDescr.getSearchProviderId()).toReturn(searchProviderId);
+		Mockito.stub(searchParamsUiContribDescr.createContributor()).toReturn(searchParamsUiContributor);
+	}
+
+	private void setupXpParser()
+	{
+		Mockito.stub(xpParser.readContributions()).toReturn(Arrays.asList(new IAdvancedSearchParamsUiContributorDescr[] { searchParamsUiContribDescr }));
+	}
+
+	@Test
+	public void testUiIsCreatedOnUpdatingDisplayer()
+	{
+		setInput(fixture.objectType1, fixture.destination1);
+		Assert.assertSame("Unexpected UI contributor", searchParamsUiContributor, paramsPageObject.getUiContributor()); //$NON-NLS-1$
+		Assert.assertEquals("One UI creation expected", 1, searchParamsUiContributor.createdUiCount); //$NON-NLS-1$
+	}
+
+	@Test
+	public void testOldSearchParametersCompositeIsDisposedOnUpdate()
+	{
+		setInput(fixture.objectType1, fixture.destination1);
+		final Composite firstComposite = paramsPageObject.getParametersComposite();
+		setInput(fixture.objectType1, fixture.destination1);
+		final Composite secondComposite = paramsPageObject.getParametersComposite();
+		Assert.assertEquals("Two UI creations expected", 2, searchParamsUiContributor.createdUiCount); //$NON-NLS-1$
+
+		Assert.assertNotNull(firstComposite);
+		Assert.assertNotNull(secondComposite);
+		Assert.assertTrue("First params composite was not disposed", firstComposite.isDisposed()); //$NON-NLS-1$
+		Assert.assertTrue("Params composite was not recreated", firstComposite != secondComposite); //$NON-NLS-1$
+	}
+
+	@Test
+	public void testSectionIsDisposedNoDestinationSpecified()
+	{
+		setInput(fixture.objectType1, fixture.destination1);
+		final Composite initialParametersComposite = paramsPageObject.getParametersComposite();
+		final Composite initialParametersCompositeParent = paramsPageObject.getParametersCompositeParent();
+		setInput(fixture.objectType1, null);
+
+		Assert.assertNull("No contributor expected when no UI displayed", paramsPageObject.getUiContributor()); //$NON-NLS-1$
+		Assert.assertFalse("Section unexpectedly displayed", paramsPageObject.isSectionVisible());
+		Assert.assertTrue("Containing composite is not disposed", initialParametersComposite.isDisposed()); //$NON-NLS-1$
+		Assert.assertTrue("Section is not disposed", initialParametersCompositeParent.isDisposed()); //$NON-NLS-1$
+	}
+
+	@Test
+	public void testCustomUIIsDisplayedByDefault()
+	{
+		setInput(fixture.objectType1, fixture.destination1);
+		Assert.assertTrue("Custom UI not available", paramsPageObject.isCustomUiAvailable());
+	}
+
+	@Test
+	public void testCustomUIHidesWhenNoCustomUi()
+	{
+		setInput(fixture.objectType1, fixture.destination1);
+		setInput(fixture.objectType2, fixture.destination3);
+		Assert.assertFalse("Custom UI unexpectedly available", paramsPageObject.isCustomUiAvailable());
+	}
+
+	@Test
+	public void testSectionTitleChanges()
+	{
+		setInput(fixture.objectType1, fixture.destination1);
+		Assert.assertEquals("Unexpected section title", DiscoveryUIMessages.CUSTOM_PARAMS_SECTION_EXPAND_TITLE, paramsPageObject.getSectionTitle());
+		paramsPageObject.showCustomUi();
+		Assert.assertEquals("Unexpected section title", DiscoveryUIMessages.CUSTOM_PARAMS_SECTION_COLAPSE_TITLE, paramsPageObject.getSectionTitle());
+		paramsPageObject.hideCustomUi();
+		Assert.assertEquals("Unexpected section title", DiscoveryUIMessages.CUSTOM_PARAMS_SECTION_EXPAND_TITLE, paramsPageObject.getSectionTitle());
+	}
+
+	@Test
+	public void testVisibilityIsHandledByCustomUI()
+	{
+		setInput(fixture.objectType1, fixture.destination1);
+		Assert.assertFalse("Custom UI shown right after setting input", searchParamsUiContributor.visible);
+
+		paramsPageObject.showCustomUi();
+		Assert.assertTrue("Custom UI is not shown", searchParamsUiContributor.visible);
+
+		paramsPageObject.hideCustomUi();
+		Assert.assertFalse("Custom UI is still visible", searchParamsUiContributor.visible);
+	}
+
+	@Test
+	public void testSetEnabled()
+	{
+		setInput(fixture.objectType1, fixture.destination1);
+		paramsPageObject.showCustomUi();
+
+		paramsPageObject.disable();
+		Assert.assertFalse("Section should be not available when displayer disabled", paramsPageObject.isSectionVisible());
+
+		paramsPageObject.enable();
+		Assert.assertTrue("Section should be visible when displayer enabled", paramsPageObject.isSectionVisible());
+	}
+
+	@Test
+	public void testUpdateSearchParametersWithCustomParams()
+	{
+		setInput(fixture.objectType1, fixture.destination1);
+		final ISearchDestination searchDestination = Mockito.mock(ISearchDestination.class);
+		final ISearchParameters searchParams = new SearchParameters("a", searchDestination, "A", new GroupingHierarchy("A", "A"), new HashSet<ISearchSubdestination>()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		paramsPageObject.setParams(searchParams);
+
+		final Map<Object, Object> customParams = searchParams.getCustomParameters();
+		Assert.assertEquals("Two custom parameters expected", 2, customParams.size()); //$NON-NLS-1$
+		Assert.assertTrue("Unexpected custom parameter", customParams.get(CUSTOM_SEARCH_PARAM_ID_1) == CUSTOM_SEARCH_PARAM_VALUE_1); //$NON-NLS-1$
+		Assert.assertTrue("Unexpected custom parameter", customParams.get(CUSTOM_SEARCH_PARAM_ID_2) == CUSTOM_SEARCH_PARAM_VALUE_2); //$NON-NLS-1$
+	}
+
+	@Test
+	public void testSectionExapndNotifiesResizeListener()
+	{
+		final Point oldSectionSize[] = new Point[1];
+		final Point newSectionSize[] = new Point[1];
+
+		setInput(fixture.objectType1, fixture.destination1);
+
+		paramsPageObject.registerSizePropertyChangeListener(new IPropertyAttributeListener<Point>()
+		{
+			@Override
+			public void attributeChanged(final PropertyAttributeChangedEvent<Point> event)
+			{
+				oldSectionSize[0] = event.getOldAttribute();
+				newSectionSize[0] = event.getNewAttribute();
+			}
+		}, true);
+
+		Assert.assertNotNull("Listener not notified upon registration", newSectionSize[0]);
+		Assert.assertTrue("Listener not notified upon registration", newSectionSize[0].y > 0);
+
+		paramsPageObject.showCustomUi();
+		Assert.assertNotNull("Listener not notified upon expanding the section", oldSectionSize[0]);
+		Assert.assertTrue("Listener not notified upon expanding the section", newSectionSize[0].y > oldSectionSize[0].y);
+
+		paramsPageObject.hideCustomUi();
+		Assert.assertTrue("Listener not notified upon collapsing the section", newSectionSize[0].y < oldSectionSize[0].y);
+	}
+
+	private void setInput(final IObjectTypeDescription objectType, final ISearchDestination destination)
+	{
+		paramsPageObject.setInput(objectType, destination, fixture.environment, fixture.viewUiContext);
+	}
+
+	private class MyUiContributor implements IAdvancedSearchParamsUiContributor
+	{
+		public int createdUiCount = 0;
+		public boolean visible = false;
+
+		public void createUi(Composite parent, ISearchDestination searchDestination, FormToolkit formToolkit, IDiscoveryEnvironment env, final IViewUiContext uiContext)
+		{
+			createdUiCount++;
+			final Button b = formToolkit.createButton(parent, TEST_BUTTON_TEXT, SWT.PUSH);
+			b.setLayoutData(fillingFormData());
+		}
+
+		@Override
+		public Map<Object, Object> getParameters()
+		{
+			final Map<Object, Object> result = new HashMap<Object, Object>();
+			result.put(CUSTOM_SEARCH_PARAM_ID_1, CUSTOM_SEARCH_PARAM_VALUE_1);
+			result.put(CUSTOM_SEARCH_PARAM_ID_2, CUSTOM_SEARCH_PARAM_VALUE_2);
+			return result;
+		}
+
+		@Override
+		public void handleVisibilityChange(boolean visible)
+		{
+			this.visible = visible;
+		}
+
+		@Override
+		public void setEnabled(boolean enable)
+		{
+		}
+
+		private FormData fillingFormData()
+		{
+			final FormData fd = new FormData();
+			fd.top = new FormAttachment(0, 0);
+			fd.left = new FormAttachment(0, 0);
+			fd.right = new FormAttachment(100, 0);
+
+			return fd;
+		}
+
+		Matcher<Button> buttonMatcher()
+		{
+			return new BaseMatcher<Button>()
+			{
+				@Override
+				public boolean matches(Object item)
+				{
+					if (item instanceof Button)
+					{
+						final String buttonText = ((Button) item).getText();
+						return TEST_BUTTON_TEXT.equals(buttonText);
+					}
+					return false;
+				}
+
+				@Override
+				public void describeTo(Description description)
+				{
+				}
+			};
+		}
+	}
+}
diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/ComboSelectorTest.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/ComboSelectorTest.java
index 80c69ec..c6c7857 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/ComboSelectorTest.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/ComboSelectorTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
+ * Copyright (c) 2010, 2011 SAP AG, Walldorf.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -30,9 +30,6 @@
 import org.mockito.ArgumentMatcher;
 import org.mockito.Mockito;
 
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-
 public class ComboSelectorTest
 {
 	private static final String FIRST_OBJECT_LABEL = "First";
@@ -105,6 +102,21 @@
 		Mockito.verify(listener, Mockito.times(1)).selectionChanged(Mockito.argThat(eventWithSelection(SECOND_OBJECT_LABEL)));
 	}
 
+	@Test
+	public void testSetEnabled()
+	{
+		assertTrue("Combo should be enabled by default", selector.isComboEnabled());
+		assertTrue("Label should be enabled by default", selector.isLabelEnabled());
+
+		selector.setEnabled(false);
+		assertFalse("Combo should be disabled now", selector.isComboEnabled());
+		assertFalse("Label should be disabled now", selector.isLabelEnabled());
+
+		selector.setEnabled(true);
+		assertTrue("Combo should be enabled now", selector.isComboEnabled());
+		assertTrue("Label should be enabled now", selector.isLabelEnabled());
+	}
+	
 	private Matcher<SelectionChangedEvent> eventWithSelection(final String expectedSelection)
 	{
 		return new ArgumentMatcher<SelectionChangedEvent>()
@@ -119,18 +131,4 @@
 			}
 		};
 	}
-
-	public void testSetEnabled() throws NotFoundException, MultipleFoundException
-	{
-		assertTrue("Combo should be enabled by default", selector.isComboEnabled());
-		assertTrue("Label should be enabled by default", selector.isLabelEnabled());
-
-		selector.setEnabled(false);
-		assertFalse("Combo should be disabled now", selector.isComboEnabled());
-		assertFalse("Label should be disabled now", selector.isLabelEnabled());
-
-		selector.setEnabled(true);
-		assertTrue("Combo should be enabled now", selector.isComboEnabled());
-		assertTrue("Label should be enabled now", selector.isLabelEnabled());
-	}
 }
diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/DicoveryViewTestFixture.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/DicoveryViewTestFixture.java
deleted file mode 100644
index 0405fee..0000000
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/DicoveryViewTestFixture.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.ui.test.comp.internal;

-

-import org.eclipse.platform.discovery.testutils.utils.abbot.AbstractUITest;
-import org.eclipse.platform.discovery.testutils.utils.abbot.IAbbotTestUiStarter;
-import org.eclipse.platform.discovery.testutils.utils.abbot.matchers.ToolItemMatcher;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.ToolItem;
-
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-import abbot.swt.tester.ButtonTester;
-import abbot.swt.tester.ComboTester;
-import abbot.swt.tester.TextTester;
-import abbot.swt.tester.ToolItemTester;
-import abbot.swt.tester.TreeItemTester;
-import abbot.swt.tester.TreeTester;
-

-

-public class DicoveryViewTestFixture extends AbstractUITest

-{

-	protected Shell testShell;

-	protected final String TEST_SHELL_TEXT = "TEST SHELL";

-

-	protected ComboTester comboTester;

-	protected TextTester textTester;

-	protected TreeTester treeTester;

-	protected TreeItemTester treeItemTester;

-	protected ButtonTester buttonTester;

-	protected ToolItemTester toolItemTester;

-	

-	@Override

-	public Display setUpPDE() throws Exception

-	{

-		super.setUpPDE();

-		

-		comboTester = ComboTester.getComboTester();

-		treeTester = TreeTester.getTreeTester();

-		treeItemTester = TreeItemTester.getTreeItemTester();

-		textTester = TextTester.getTextTester();

-		buttonTester = ButtonTester.getButtonTester();

-		toolItemTester = ToolItemTester.getToolItemTester();

-

-		return getDisplay();

-	}

-	

-	@Override

-	protected IAbbotTestUiStarter getUiStarter()

-	{

-		if (testShell == null || testShell.isDisposed())

-		{

-			return null;

-		}

-

-		return new IAbbotTestUiStarter()

-		{

-			public void closeEnclosingDialog(Display display)

-			{

-				display.syncExec(new Runnable()

-				{

-					public void run()

-					{

-						testShell.close();

-					}

-				});

-			}

-		};

-	}

-

-	protected Shell createTestShell()

-	{

-		final Shell[] shell = new Shell[1];

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				shell[0] = new Shell(getDisplay());

-				shell[0].setText(TEST_SHELL_TEXT);

-			}

-		});

-		return shell[0];

-	}

-

-	@Override

-	public void tearDownPDE() throws Exception

-	{

-		super.tearDownPDE();

-		testShell = null;

-	}

-

-	protected ToolItem getMonitorCancelButton() throws NotFoundException, MultipleFoundException

-	{

-		return (ToolItem) FINDER.find(new ToolItemMatcher(testShell,getDisplay()));

-	}

-

-

-}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/DiscoveredItemsTreeTest.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/DiscoveredItemsTreeTest.java
new file mode 100644
index 0000000..9d9e449
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/DiscoveredItemsTreeTest.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.platform.discovery.ui.test.comp.internal;
+
+import java.text.MessageFormat;
+
+import junit.framework.Assert;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.platform.discovery.ui.api.IFormTextBuilder;
+import org.eclipse.platform.discovery.ui.api.IGenericViewCustomization;
+import org.eclipse.platform.discovery.ui.api.ITooltipProvider;
+import org.eclipse.platform.discovery.ui.api.impl.GenericViewCustomizationImpl;
+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.DiscoveredItemsInShellPageObject;
+import org.eclipse.platform.discovery.util.api.env.IDiscoveryEnvironment;
+import org.eclipse.platform.discovery.util.internal.longop.CurrentThreadOperationRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class DiscoveredItemsTreeTest
+{
+	private static final String TOOLTIP_TEMPLATE = "Tooltip for {0}";
+
+	private IGenericViewCustomization viewCustomization;
+	private Object displayedItem;
+
+	private DiscoveredItemsInShellPageObject viewerPageObject;
+
+	@Before
+	public void setUp() throws Exception
+	{
+		displayedItem = new Object();
+		viewCustomization = createViewCustomization();
+		viewerPageObject = new DiscoveredItemsInShellPageObject(discoveryEnv(), viewCustomization);
+		viewerPageObject.open();
+		viewerPageObject.tree().setInput(displayedItem);
+	}
+
+	@After
+	public void tearDown()
+	{
+		viewerPageObject.close();
+	}
+
+	private IGenericViewCustomization createViewCustomization()
+	{
+		return new GenericViewCustomizationImpl()
+		{
+			@Override
+			public ITreeContentProvider getContentProvider()
+			{
+				return new MyContentProvider();
+			}
+
+			@Override
+			public ILabelProvider getLabelProvider()
+			{
+				return new LabelProvider();
+			}
+
+			@Override
+			public ITooltipProvider getTooltipProvider()
+			{
+				return new ITooltipProvider()
+				{
+					@Override
+					public void createTooltipContent(IFormTextBuilder tooltipTextBuilder, Object element)
+					{
+						tooltipTextBuilder.appendText(tooltipText(element));
+					}
+				};
+			}
+		};
+	}
+
+	private IDiscoveryEnvironment discoveryEnv()
+	{
+		final IDiscoveryEnvironment env = Mockito.mock(IDiscoveryEnvironment.class);
+		final IProgressMonitor monitor = new NullProgressMonitor();
+		Mockito.when(env.progressMonitor()).thenReturn(monitor);
+		Mockito.when(env.operationRunner()).thenReturn(new CurrentThreadOperationRunner(monitor));
+		return env;
+	}
+
+	private class MyContentProvider extends ArrayContentProvider implements ITreeContentProvider
+	{
+		@Override
+		public Object[] getChildren(Object parentElement)
+		{
+			return getElements(parentElement);
+		}
+
+		@Override
+		public Object getParent(Object element)
+		{
+			return null;
+		}
+
+		@Override
+		public boolean hasChildren(Object element)
+		{
+			return getElements(element).length > 0;
+		}
+	}
+	
+	@Test
+	public void testItemIsDisplayed()
+	{
+		Assert.assertTrue("Item is not displayed", viewerPageObject.tree().isTreeItemDisplayed(displayedItem.toString()));
+	}
+
+	@Test
+	public void testTooltip()
+	{
+		hoverOnTreeItem(displayedItem.toString());
+		Assert.assertTrue("Tooltip not displayed", viewerPageObject.tree().isTooltipDisplayed(displayedItem.toString()));
+		moveAwayFromTreeItem(displayedItem.toString());
+		Assert.assertFalse("Tooltip still displayed", viewerPageObject.tree().isTooltipDisplayed(displayedItem.toString()));
+	}
+
+	private String tooltipText(final Object object)
+	{
+		return MessageFormat.format(TOOLTIP_TEMPLATE, object.toString());
+	}
+
+	private void hoverOnTreeItem(final Object object)
+	{
+		viewerPageObject.tree().discoveredTreeItem(object.toString()).hoverMouse();
+	}
+
+	private void moveAwayFromTreeItem(final Object object)
+	{
+		viewerPageObject.tree().discoveredTreeItem(object.toString()).moveMouseAway();
+	}
+}
diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/DiscoveryTreeViewerFactoryAbbotTest.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/DiscoveryTreeViewerFactoryAbbotTest.java
deleted file mode 100644
index f708286..0000000
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/DiscoveryTreeViewerFactoryAbbotTest.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.ui.test.comp.internal;

-

-import java.text.MessageFormat;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.easymock.EasyMock;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.platform.discovery.core.api.IContributedAction;
-import org.eclipse.platform.discovery.testutils.utils.abbot.matchers.EnhancedTextMatcher;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.Assertions;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.ConditionCheckException;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.IWaitCondition;
-import org.eclipse.platform.discovery.ui.api.IFormTextBuilder;
-import org.eclipse.platform.discovery.ui.api.IGenericViewCustomization;
-import org.eclipse.platform.discovery.ui.api.IResultsViewAccessor;
-import org.eclipse.platform.discovery.ui.api.ITooltipProvider;
-import org.eclipse.platform.discovery.ui.api.impl.GenericViewCustomizationImpl;
-import org.eclipse.platform.discovery.ui.internal.view.result.impl.DiscoveryTreeViewerFactory;
-import org.eclipse.platform.discovery.util.api.env.IDiscoveryEnvironment;
-import org.eclipse.platform.discovery.util.api.env.IErrorHandler;
-import org.eclipse.platform.discovery.util.api.longop.ILongOperationRunner;
-import org.eclipse.platform.discovery.util.internal.longop.CurrentThreadOperationRunner;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-
-import abbot.swt.WidgetLocator;
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-import abbot.swt.tester.LabelTester;
-

-

-public class DiscoveryTreeViewerFactoryAbbotTest extends DicoveryViewTestFixture

-{

-	private static final String TOOLTIP_TEMPLATE = "Tooltip for {0}";

-

-	private IGenericViewCustomization viewCustomization;

-	private IResultsViewAccessor vAccessor;

-

-	private Object element1;

-

-	@Override

-	public Display setUpPDE() throws Exception

-	{

-		super.setUpPDE();

-

-		element1 = new Object();

-

-		viewCustomization = createViewCustomization();

-

-		return getDisplay();

-	}

-

-	private IGenericViewCustomization createViewCustomization()

-	{

-		return new GenericViewCustomizationImpl()

-		{

-			@Override

-			public ITreeContentProvider getContentProvider()

-			{

-				return new MyContentProvider();

-			}

-

-			@Override

-			public ILabelProvider getLabelProvider()

-			{

-				return new LabelProvider();

-			}

-

-			@Override

-			public ITooltipProvider getTooltipProvider()

-			{

-				return new ITooltipProvider()

-				{

-					@Override

-					public void createTooltipContent(IFormTextBuilder tooltipTextBuilder, Object element)

-					{

-						tooltipTextBuilder.appendText(MessageFormat.format(TOOLTIP_TEMPLATE, element.toString()));

-					}

-				};

-			}

-		};

-	}

-

-	private void openTestView()

-	{

-		testShell = createTestShell();

-		getDisplay().asyncExec(new Runnable()

-		{

-			public void run()

-			{

-				testShell.setLayout(new FillLayout());

-				vAccessor = createDiscoveryTreeViewer(testShell);

-				vAccessor.getTreeViewer().setInput(Arrays.asList(new Object[] { element1 }));

-				testShell.open();

-				testShell.layout();

-			}

-

-		});

-

-		waitForShell(TEST_SHELL_TEXT);

-	}

-

-	private IResultsViewAccessor createDiscoveryTreeViewer(final Composite parent)

-	{

-		final DiscoveryTreeViewerFactory f = new DiscoveryTreeViewerFactory();

-		final Set<IGenericViewCustomization> viewC = new HashSet<IGenericViewCustomization>();

-		viewC.add(viewCustomization);

-

-		return f.createTreeViewer(parent, viewC, new HashSet<IContributedAction>(), discoveryEnv());

-	}

-

-	private IDiscoveryEnvironment discoveryEnv()

-	{

-		return new IDiscoveryEnvironment()

-		{

-

-			@Override

-			public IErrorHandler errorHandler()

-			{

-				return EasyMock.createMock(IErrorHandler.class);

-			}

-

-			@Override

-			public ILongOperationRunner operationRunner()

-			{

-				return new CurrentThreadOperationRunner(progressMonitor());

-			}

-

-			@Override

-			public IProgressMonitor progressMonitor()

-			{

-				return new NullProgressMonitor();

-			}

-		};

-	}

-

-	private class MyContentProvider extends ArrayContentProvider implements ITreeContentProvider

-	{

-		@Override

-		public Object[] getChildren(Object parentElement)

-		{

-			return getElements(parentElement);

-		}

-

-		@Override

-		public Object getParent(Object element)

-		{

-			return null;

-		}

-

-		@Override

-		public boolean hasChildren(Object element)

-		{

-			return getElements(element).length > 0;

-		}

-	}

-

-	public void testTooltipIsShowingOnMouseHover() throws NotFoundException, MultipleFoundException

-	{

-		openTestView();

-		final TreeItem ti = treeItemForElement(element1);

-		treeItemTester.mouseMove(ti, 5, 5);

-		waitForTooltipVisible(element1);

-	}

-

-	public void testTooltipIsHiddenOnMoveAway() throws NotFoundException, MultipleFoundException

-	{

-		testTooltipIsShowingOnMouseHover();

-		final TreeItem ti = treeItemForElement(element1);

-		final Point tiLocation = getWidgetLocation(ti);

-		final Rectangle tiRect = treeItemTester.getBounds(ti);

-		treeItemTester.mouseMove(tiLocation.x + tiRect.width + 10, tiLocation.y + tiRect.height + 10);

-		waitForTooltipInvisible(element1);

-	}

-	

-	private Point getWidgetLocation(final Widget w)

-	{

-		final Point[] result = new Point[1];

-		getDisplay().syncExec(new Runnable()

-		{

-			@Override

-			public void run()

-			{

-				result[0] = WidgetLocator.getLocation(w);

-			}

-		});

-		

-		return result[0];

-	}

-	

-	private TreeItem treeItemForElement(final Object element) throws NotFoundException, MultipleFoundException

-	{

-		return (TreeItem) FINDER.find(new EnhancedTextMatcher(element.toString(), TreeItem.class));

-	}

-

-	private boolean isTooltipVisible(final Object item) throws MultipleFoundException

-	{

-		try

-		{

-			final Label tooltipLabel = (Label) QUICK_FINDER.find(new EnhancedTextMatcher(item.toString(), Label.class));

-			final Shell parentShell = parentShell(tooltipLabel);

-			return LabelTester.getLabelTester().isVisible(tooltipLabel) && ((TESTER.getStyle(parentShell) & SWT.TOOL) > 0); // A tooltip's shell has the SWT.TOOL style

-		} catch (NotFoundException e)

-		{

-			return false;

-		}

-	}

-

-	private void waitForTooltipVisible(final Object item)

-	{

-		Assertions.waitAssert(new IWaitCondition()

-		{

-			@Override

-			public boolean checkCondition() throws ConditionCheckException

-			{

-				try

-				{

-					return isTooltipVisible(item);

-				} catch (MultipleFoundException e)

-				{

-					throw new ConditionCheckException(e);

-				}

-			}

-		}, "Tooltip did not show");

-	}

-

-	private void waitForTooltipInvisible(final Object item)

-	{

-		Assertions.waitAssert(new IWaitCondition()

-		{

-			@Override

-			public boolean checkCondition() throws ConditionCheckException

-			{

-				try

-				{

-					return !isTooltipVisible(item);

-				} catch (MultipleFoundException e)

-				{

-					throw new ConditionCheckException(e);

-				}

-			}

-		}, "Tooltip did not hide");

-	}

-

-	private Shell parentShell(final Control control)

-	{

-		final Control[] parent = new Control[] { null };

-

-		getDisplay().syncExec(new Runnable()

-		{

-			@Override

-			public void run()

-			{

-				parent[0] = control.getParent();

-			}

-		});

-		if (parent[0] instanceof Shell)

-		{

-			return (Shell) parent[0];

-		}

-

-		return parentShell(parent[0]);

-	}

-}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/InteractiveComboSelectorTest.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/InteractiveComboSelectorTest.java
index e824a1f..a4d933c 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/InteractiveComboSelectorTest.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/InteractiveComboSelectorTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
+ * Copyright (c) 2010, 2011 SAP AG, Walldorf.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -24,9 +24,6 @@
 import org.junit.Test;
 import org.mockito.Mockito;
 
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-
 public class InteractiveComboSelectorTest
 {
 	private static final String OBJECT1_LABEL = "Object1";
@@ -63,7 +60,7 @@
 	}
 
 	@Test
-	public void testSelectorIsDisabledWhenEmptyInputIsSet() throws NotFoundException, MultipleFoundException
+	public void testSelectorIsDisabledWhenEmptyInputIsSet()
 	{
 		assertTrue("Selector should be enabled by default", selector.isEnabled());
 		selector.setInput(new ArrayList<IDisplayableObject>());
@@ -74,7 +71,7 @@
 	}
 
 	@Test
-	public void testSelectorPreservesSelectedItemOnSelectionChange() throws NotFoundException, MultipleFoundException
+	public void testSelectorPreservesSelectedItemOnSelectionChange()
 	{
 		selector.select(OBJECT2_LABEL);
 		objectsSet.remove(object1);
diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchConsoleTestFixture.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchConsoleTestFixture.java
deleted file mode 100644
index 73eddc8..0000000
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchConsoleTestFixture.java
+++ /dev/null
@@ -1,514 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.ui.test.comp.internal;

-

-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.easymock.EasyMock;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.platform.discovery.core.internal.ISearchSession;
-import org.eclipse.platform.discovery.runtime.api.GroupingHierarchy;
-import org.eclipse.platform.discovery.runtime.api.IDestinationsProvider;
-import org.eclipse.platform.discovery.runtime.api.ISearchDestination;
-import org.eclipse.platform.discovery.runtime.api.ISearchProvider;
-import org.eclipse.platform.discovery.runtime.api.ISearchSubdestination;
-import org.eclipse.platform.discovery.runtime.internal.DestinationCategoryNotFoundException;
-import org.eclipse.platform.discovery.runtime.internal.ISearchProviderConfiguration;
-import org.eclipse.platform.discovery.runtime.internal.ProviderNotFoundException;
-import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IDestinationCategoryDescription;
-import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IDestinationsProviderDescription;
-import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IObjectTypeDescription;
-import org.eclipse.platform.discovery.runtime.internal.model.descriptions.ISearchProviderDescription;
-import org.eclipse.platform.discovery.testutils.utils.abbot.matchers.EnhancedTextMatcher;
-import org.eclipse.platform.discovery.testutils.utils.abbot.matchers.SiblingTextMatcher;
-import org.eclipse.platform.discovery.ui.api.IViewUiContext;
-import org.eclipse.platform.discovery.ui.internal.plugin.DiscoveryUIMessages;
-import org.eclipse.platform.discovery.util.api.env.IDiscoveryEnvironment;
-import org.eclipse.platform.discovery.util.api.env.IErrorHandler;
-import org.eclipse.platform.discovery.util.api.longop.ILongOperationRunner;
-import org.eclipse.platform.discovery.util.internal.session.ISessionManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-

-

-public abstract class SearchConsoleTestFixture extends DicoveryViewTestFixture

-{

-	private static final String TEST_SEARCH_DEST_PROVIDER_PREFERENCE_PAGE_ID = "org.eclipse.platform.discovery.ui.test.comp.page1";

-	

-	protected final static int VIEWERS_OFFSET = 60;

-	

-	protected IObjectTypeDescription objectType1;

-	protected IObjectTypeDescription objectType2;

-	protected IObjectTypeDescription objectType3;
-	protected IObjectTypeDescription objectTypeNoDestinations;
-

-	protected final String OBJECT_TYPE_ID1 = "org.eclipse.platform.discovery.objecttype1";

-	protected final String OBJECT_TYPE_ID2 = "org.eclipse.platform.discovery.objecttype2";

-	protected final String OBJECT_TYPE_ID3 = "org.eclipse.platform.discovery.objecttype3";
-	protected final String OBJECT_TYPE_NO_DESTINATIONS_ID = "org.eclipse.platform.discovery.nodestinations_objecttype";

-	protected final String OBJECT_TYPE_NAME_1 = "First object type";

-	protected final String OBJECT_TYPE_NAME_2 = "Second object type";

-	protected final String OBJECT_TYPE_NAME_3 = "Third object type";
-	protected final String OBJECT_TYPE_NO_DESTINATIONS_NAME = "Destination-less object type";
-

-

-	protected IDestinationsProviderDescription destProviderDescr_cat1;

-	protected IDestinationsProviderDescription destProviderDescr_cat2;

-	protected IDestinationsProviderDescription destProviderDescr_cat3;

-

-	protected IDestinationsProvider destProvider_cat1;

-	protected IDestinationsProvider destProvider_cat2;

-	protected IDestinationsProvider destProvider_cat3;

-	

-	protected ISearchDestination destination1;

-	protected ISearchDestination destination2;

-	protected ISearchDestination destination3;

-	protected ISearchDestination destination4;

-	protected ISearchDestination destination5;

-	protected final String DESTINATION_NAME1 = "First destination";

-	protected final String DESTINATION_NAME2 = "Second destination";

-	protected final String DESTINATION_NAME3 = "Third destination";

-	protected final String DESTINATION_NAME4 = "Fourth destination";

-	protected final String DESTINATION_NAME5 = "Fifth destination";

-

-	protected IDestinationCategoryDescription category1;

-	protected IDestinationCategoryDescription category2;

-	protected IDestinationCategoryDescription category3;

-	protected final static String CATEGORY_ID_1 = "category1";

-	protected final static String CATEGORY_ID_2 = "category2";

-	protected final static String CATEGORY_ID_3 = "category3";

-	protected final static String CATEGORY_NAME_1 = "First category";

-	protected final static String CATEGORY_NAME_2 = "Second category";

-	protected final static String CATEGORY_NAME_3 = "Third category";

-

-	protected ISearchSubdestination subdestination1;

-	protected ISearchSubdestination subdestination2;

-	protected static final String SUBDESTINATION_NAME_1 = "Subdestination 1";

-	protected static final String SUBDESTINATION_NAME_2 = "Subdestination 2";

-	protected Map<ISearchSubdestination, Boolean> subdestinationsActivityMap;

-

-	protected ISearchProviderDescription supportingTextSearchProviderDescription;

-	protected ISearchProviderDescription unsupportingTextSearchProviderDescription;
-	protected ISearchProviderDescription searchProviderForObjTypeWithNoDestinations_Description;
-	protected final static String SUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID = "SUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID";

-	protected final static String UNSUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID = "UNSUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID";
-	protected final static String SEARCH_PROVIDER_NO_DESTINATIONS_ID = "SEARCH_PROVIDER_NO_DESTINATIONS_ID";
-

-	protected ISearchProvider supportingTextSearchProviderInstance;

-	protected ISearchProvider unsupportingTextSearchProviderInstance;
-	protected ISearchProvider searchProviderForObjTypeWithNoDestinations_Instance;
-

-	protected ISearchProviderConfiguration searchProviderConfiguration;

-

-	protected GroupingHierarchy groupingHierarchy1;

-	protected GroupingHierarchy groupingHierarchy2;

-	

-	protected IErrorHandler errorHandler;

-	protected ILongOperationRunner operationRunner;

-	protected IDiscoveryEnvironment environment;

-	protected ISessionManager<ISearchSession> sessionManager;

-	protected NullProgressMonitor nullProgressMonitor;

-	protected FormToolkit formToolkit;

-	protected IViewUiContext viewUiContext;

-

-	

-	@SuppressWarnings("unchecked")

-	@Override

-	public Display setUpPDE() throws Exception

-	{

-		super.setUpPDE();

-

-		getDisplay().syncExec(new Runnable()

-		{

-			@Override

-			public void run()

-			{

-				formToolkit = new FormToolkit(getDisplay());

-			}

-		});

-		

-		errorHandler = createThreadSafeNiceMock(IErrorHandler.class);

-		operationRunner = createThreadSafeNiceMock(ILongOperationRunner.class);

-		environment = createThreadSafeNiceMock(IDiscoveryEnvironment.class);

-		sessionManager = createThreadSafeNiceMock(ISessionManager.class);

-		nullProgressMonitor = new NullProgressMonitor();

-		EasyMock.expect(environment.errorHandler()).andStubReturn(errorHandler);

-		EasyMock.expect(environment.operationRunner()).andStubReturn(operationRunner);

-		EasyMock.expect(environment.progressMonitor()).andStubReturn(nullProgressMonitor);

-		

-		viewUiContext = EasyMock.createMock(IViewUiContext.class);

-		EasyMock.expect(viewUiContext.getSecondColumnPosition()).andStubReturn(60);

-		EasyMock.expect(viewUiContext.controlsSpacing()).andStubReturn(60);

-		EasyMock.replay(environment, viewUiContext);

-		

-		setupObjectTypes();

-		setupDestinations();

-		setupDestinationProviders();

-		setupDestinationCategories();

-		setupSubdestinations();

-		setupGroupingHierarchy();

-		setupProviderInstances();

-		setupProviderDescriptions();

-		searchProviderConfiguration = createTestSearchProviderConfig();

-

-		return getDisplay();

-	}

-	

-

-	private void setupObjectTypes()

-	{

-		objectType1 = createThreadSafeNiceMock(IObjectTypeDescription.class);

-		EasyMock.expect(objectType1.getId()).andStubReturn(OBJECT_TYPE_ID1);

-		EasyMock.expect(objectType1.getDisplayName()).andStubReturn(OBJECT_TYPE_NAME_1);

-

-		objectType2 = createThreadSafeNiceMock(IObjectTypeDescription.class);

-		EasyMock.expect(objectType2.getId()).andStubReturn(OBJECT_TYPE_ID2);

-		EasyMock.expect(objectType2.getDisplayName()).andStubReturn(OBJECT_TYPE_NAME_2);

-		

-		objectType3 = createThreadSafeNiceMock(IObjectTypeDescription.class);

-		EasyMock.expect(objectType3.getId()).andStubReturn(OBJECT_TYPE_ID3);

-		EasyMock.expect(objectType3.getDisplayName()).andStubReturn(OBJECT_TYPE_NAME_3);
-		
-		objectTypeNoDestinations = createThreadSafeNiceMock(IObjectTypeDescription.class);
-		EasyMock.expect(objectTypeNoDestinations.getId()).andStubReturn(OBJECT_TYPE_NO_DESTINATIONS_ID);
-		EasyMock.expect(objectTypeNoDestinations.getDisplayName()).andStubReturn(OBJECT_TYPE_NO_DESTINATIONS_NAME);

-

-		EasyMock.replay(objectType1, objectType2, objectType3, objectTypeNoDestinations);

-	}

-

-	private void setupDestinations()

-	{

-		destination1 = createThreadSafeNiceMock(ISearchDestination.class);

-		EasyMock.expect(destination1.getDisplayName()).andStubReturn(DESTINATION_NAME1);

-		destination2 = createThreadSafeNiceMock(ISearchDestination.class);

-		EasyMock.expect(destination2.getDisplayName()).andStubReturn(DESTINATION_NAME2);

-		destination3 = createThreadSafeNiceMock(ISearchDestination.class);

-		EasyMock.expect(destination3.getDisplayName()).andStubReturn(DESTINATION_NAME3);

-		destination4 = createThreadSafeNiceMock(ISearchDestination.class);

-		EasyMock.expect(destination4.getDisplayName()).andStubReturn(DESTINATION_NAME4);

-		destination5 = createThreadSafeNiceMock(ISearchDestination.class);

-		EasyMock.expect(destination5.getDisplayName()).andStubReturn(DESTINATION_NAME5);

-

-		EasyMock.replay(destination1, destination2, destination3, destination4, destination5);

-	}

-

-	private void setupSubdestinations()

-	{

-		subdestination1 = createThreadSafeNiceMock(ISearchSubdestination.class);

-		EasyMock.expect(subdestination1.getDisplayName()).andStubReturn(SUBDESTINATION_NAME_1);

-		subdestination2 = createThreadSafeNiceMock(ISearchSubdestination.class);

-		EasyMock.expect(subdestination2.getDisplayName()).andStubReturn(SUBDESTINATION_NAME_2);

-		EasyMock.replay(subdestination1, subdestination2);

-

-		subdestinationsActivityMap = new HashMap<ISearchSubdestination, Boolean>();

-		subdestinationsActivityMap.put(subdestination1, false);

-		subdestinationsActivityMap.put(subdestination2, false);

-	}

-

-	protected Text getKeywordsSearchText() throws NotFoundException, MultipleFoundException

-	{

-		return (Text) FINDER.find(new SiblingTextMatcher(DiscoveryUIMessages.SEARCH_KEYWORD_LABEL, null, Text.class));

-	}

-

-	protected Label getSubdestinationsButton() throws NotFoundException, MultipleFoundException

-	{

-		return (Label) FINDER.find(new SiblingTextMatcher(DiscoveryUIMessages.SEARCH_KEYWORD_LABEL, null, Label.class));

-	}

-	

-	protected Button getSearchButton() throws NotFoundException, MultipleFoundException

-	{

-		return (Button) FINDER.find(new EnhancedTextMatcher(DiscoveryUIMessages.SEARCH_BUTTON_LABEL, Button.class));

-	}

-	

-

-	private ISearchProviderConfiguration createTestSearchProviderConfig()

-	{

-		return new ISearchProviderConfiguration()

-		{

-			public void activateSubdestination(IObjectTypeDescription searchObjectType, IDestinationCategoryDescription destinationCategory,

-											ISearchProviderDescription searchProviderDescription, ISearchSubdestination subDestination,

-											boolean activate)

-			{

-				subdestinationsActivityMap.put(subDestination, new Boolean(activate));

-

-			}

-

-			public ISearchProviderDescription getActiveSearchProvider(IObjectTypeDescription objectType,

-											IDestinationCategoryDescription destinationCategory) throws ProviderNotFoundException

-			{
-				if (destinationCategory==null) 
-				{
-					if(objectType.getId().equals(objectTypeNoDestinations.getId())) {
-						return searchProviderForObjTypeWithNoDestinations_Description;
-					}else{
-						throw new ProviderNotFoundException("Provider not found");
-					}
-				}
-				if (objectType.getId().equals(objectType2.getId()) && (destinationCategory.getId().equals(CATEGORY_ID_2)))

-				{

-					return supportingTextSearchProviderDescription;

-				}
-				if (objectType.getId().equals(objectType1.getId()) && (destinationCategory.getId().equals(CATEGORY_ID_1)))

-				{

-					return unsupportingTextSearchProviderDescription;

-				}
-				if (objectType.getId().equals(objectType3.getId()) && (destinationCategory.getId().equals(CATEGORY_ID_3)))

-				{

-					return supportingTextSearchProviderDescription;

-				}

-

-				throw new ProviderNotFoundException("Provider not found");

-			}

-

-			public List<IDestinationCategoryDescription> getAvailableDestinationCategoriesForObjectType(IObjectTypeDescription objectType)

-			{

-				if (objectType.getId().equals(objectType1.getId()))

-				{

-					return Arrays.asList(new IDestinationCategoryDescription[] { category1 });

-				} else if (objectType.getId().equals(objectType2.getId()))

-				{

-					return Arrays.asList(new IDestinationCategoryDescription[] { category2 });

-				} else if (objectType.getId().equals(objectType3.getId()))

-				{

-					return Arrays.asList(new IDestinationCategoryDescription[] { category3 });

-				}
-				
-				return Collections.emptyList();

-			}

-

-			public List<ISearchSubdestination> getAvailableSearchSubdestinations(IObjectTypeDescription objectType,

-											IDestinationCategoryDescription destinationCategory, ISearchProviderDescription searchProvider)

-			{

-				if (objectType.getId().equals(OBJECT_TYPE_ID1))

-				{

-					return Arrays.asList(subdestination1, subdestination2);

-				}

-				return new ArrayList<ISearchSubdestination>();

-			}

-

-			public List<IDestinationCategoryDescription> getDestinationCategories()

-			{

-				return Arrays.asList(new IDestinationCategoryDescription[] { category1, category2 ,category3});

-			}

-

-			public List<IDestinationCategoryDescription> getDestinationCategoriesForDestination(ISearchDestination destination)

-											throws DestinationCategoryNotFoundException

-			{

-				if (destination.equals(destination1))

-				{

-					return Arrays.asList(new IDestinationCategoryDescription[] { category1 });

-				} if (destination.equals(destination5))

-				{

-					return Arrays.asList(new IDestinationCategoryDescription[] { category3 });

-				}else

-				{

-					return Arrays.asList(new IDestinationCategoryDescription[] { category2 });

-				}

-			}

-

-			public boolean isSubdestinationActive(ISearchSubdestination subdestination, IObjectTypeDescription objectType,

-											IDestinationCategoryDescription destCategory, ISearchProviderDescription searchProvider)

-			{

-				return subdestinationsActivityMap.get(subdestination);

-			}

-

-			public List<ISearchProviderDescription> getAvailableSearchProviderDescriptions(IObjectTypeDescription searchObjectType)

-			{

-				fail("Unexpected invocation");

-				return null;

-			}

-

-			public List<IObjectTypeDescription> getObjectTypes()

-			{

-				return Arrays.asList(new IObjectTypeDescription[] { objectType1, objectType2, objectType3, objectTypeNoDestinations });

-			}

-

-			public List<IDestinationsProviderDescription> getDestinationProvidersForCategory(IDestinationCategoryDescription category)

-			{

-				if (category.equals(category1))

-				{

-					return Arrays.asList(new IDestinationsProviderDescription[]{destProviderDescr_cat1});

-				} if (category.equals(category2))

-				{

-					return Arrays.asList(new IDestinationsProviderDescription[]{destProviderDescr_cat2});

-				}else

-				{

-					return Arrays.asList(new IDestinationsProviderDescription[]{destProviderDescr_cat3});

-				}

-			}

-

-			public List<ISearchDestination> getSearchDestinations(IDestinationCategoryDescription category,

-											IDestinationsProvider providerDescription)

-			{

-				return new ArrayList<ISearchDestination>(providerDescription.getSearchDestinations());

-			}

-

-			public List<IDestinationsProviderDescription> getAvailableDestinationProviders()

-			{

-				return Arrays.asList(new IDestinationsProviderDescription[]{destProviderDescr_cat1, destProviderDescr_cat2, destProviderDescr_cat3});

-			}

-		};

-	}

-

-	private void setupGroupingHierarchy()

-	{

-		groupingHierarchy1 = new GroupingHierarchy("Grouping 1", "Grouping 1");

-		groupingHierarchy2 = new GroupingHierarchy("Grouping 2", "Grouping 2");

-	}

-	

-	@SuppressWarnings({ "unchecked", "rawtypes" })

-	private void setupProviderInstances()

-	{

-		final Set<GroupingHierarchy> h = new HashSet<GroupingHierarchy>();

-		h.add(groupingHierarchy1);

-		h.add(groupingHierarchy2);

-		supportingTextSearchProviderInstance = EasyMock.createMock(ISearchProvider.class);

-		EasyMock.expect(supportingTextSearchProviderInstance.getGroupingHierarchies((ISearchDestination)EasyMock.anyObject(), (Set)EasyMock.anyObject())).andStubReturn(h);

-		

-		unsupportingTextSearchProviderInstance = EasyMock.createMock(ISearchProvider.class);

-		EasyMock.expect(unsupportingTextSearchProviderInstance.getGroupingHierarchies((ISearchDestination)EasyMock.anyObject(), (Set)EasyMock.anyObject())).andStubReturn(new HashSet<GroupingHierarchy>());
-		
-		searchProviderForObjTypeWithNoDestinations_Instance = EasyMock.createMock(ISearchProvider.class);

-		EasyMock.expect(searchProviderForObjTypeWithNoDestinations_Instance.getGroupingHierarchies((ISearchDestination)EasyMock.anyObject(), (Set)EasyMock.anyObject())).andStubReturn(new HashSet<GroupingHierarchy>());
-

-		EasyMock.replay(supportingTextSearchProviderInstance, unsupportingTextSearchProviderInstance, searchProviderForObjTypeWithNoDestinations_Instance);
-

-	}

-	

-	private void setupProviderDescriptions()

-	{

-		supportingTextSearchProviderDescription = createThreadSafeNiceMock(ISearchProviderDescription.class);

-		EasyMock.expect(supportingTextSearchProviderDescription.supportsTextSearch()).andStubReturn(true);

-		EasyMock.expect(supportingTextSearchProviderDescription.getId()).andStubReturn(SUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID);

-		EasyMock.expect(supportingTextSearchProviderDescription.createInstance()).andStubReturn(supportingTextSearchProviderInstance);
-		EasyMock.expect(supportingTextSearchProviderDescription.getSupportedDestinationCategories()).andStubReturn(
-				new HashSet<IDestinationCategoryDescription>(Arrays.asList(category2, category3)));
-

-		

-		unsupportingTextSearchProviderDescription = createThreadSafeNiceMock(ISearchProviderDescription.class);

-		EasyMock.expect(unsupportingTextSearchProviderDescription.supportsTextSearch()).andStubReturn(false);

-		EasyMock.expect(unsupportingTextSearchProviderDescription.getId()).andStubReturn(UNSUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID);

-		EasyMock.expect(unsupportingTextSearchProviderDescription.createInstance()).andStubReturn(unsupportingTextSearchProviderInstance);
-		EasyMock.expect(supportingTextSearchProviderDescription.getSupportedDestinationCategories()).andStubReturn(
-				new HashSet<IDestinationCategoryDescription>(Arrays.asList(category1)));
-		
-		searchProviderForObjTypeWithNoDestinations_Description = createThreadSafeNiceMock(ISearchProviderDescription.class);
-		EasyMock.expect(searchProviderForObjTypeWithNoDestinations_Description.supportsTextSearch()).andStubReturn(true);
-		EasyMock.expect(searchProviderForObjTypeWithNoDestinations_Description.getId()).andStubReturn(SEARCH_PROVIDER_NO_DESTINATIONS_ID);
-		EasyMock.expect(searchProviderForObjTypeWithNoDestinations_Description.createInstance()).andStubReturn(searchProviderForObjTypeWithNoDestinations_Instance);
-		EasyMock.expect(searchProviderForObjTypeWithNoDestinations_Description.getSupportedDestinationCategories()).andStubReturn(new HashSet<IDestinationCategoryDescription>());
-

-

-		EasyMock.replay(supportingTextSearchProviderDescription, unsupportingTextSearchProviderDescription, searchProviderForObjTypeWithNoDestinations_Description);

-	}

-

-	private void setupDestinationCategories()

-	{

-		category1 = createThreadSafeNiceMock(IDestinationCategoryDescription.class);

-		EasyMock.expect(category1.getId()).andStubReturn(CATEGORY_ID_1);

-		EasyMock.expect(category1.getDisplayName()).andStubReturn(CATEGORY_NAME_1);
-		EasyMock.expect(category1.getDestinationProviderIds()).andStubReturn(list(UNSUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID));

-		
-		category2 = createThreadSafeNiceMock(IDestinationCategoryDescription.class);

-		EasyMock.expect(category2.getId()).andStubReturn(CATEGORY_ID_2);

-		EasyMock.expect(category2.getDisplayName()).andStubReturn(CATEGORY_NAME_2);
-		EasyMock.expect(category2.getDestinationProviderIds()).andStubReturn(list(SUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID));

-		

-		category3 = createThreadSafeNiceMock(IDestinationCategoryDescription.class);

-		EasyMock.expect(category3.getId()).andStubReturn(CATEGORY_ID_3);

-		EasyMock.expect(category3.getDisplayName()).andStubReturn(CATEGORY_NAME_3);
-		EasyMock.expect(category3.getDestinationProviderIds()).andStubReturn(list(SUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID));

-

-		EasyMock.replay(category1, category2, category3);

-	}

-

-	private List<String> list(String... strings) {
-		return Arrays.asList(strings);
-	}
-
-
-	protected void selectFirstPossibleDestination(final Tree destinationsTree)

-	{

-		final TreeItem[] treeItems = treeTester.getItems(destinationsTree);

-		treeItemTester.actionClick(treeItems[0]);

-		treeItemTester.key(SWT.ARROW_DOWN);

-		// UI changes after destination selection sometimes occur a bit slow. Wait some time to let them happen

-		waitFor(100);

-	}

-	

-	private void setupDestinationProviders()

-	{

-		destProvider_cat1 = createThreadSafeNiceMock(IDestinationsProvider.class);

-		EasyMock.expect(destProvider_cat1.getSearchDestinations()).andStubReturn(new HashSet<ISearchDestination>(Arrays.asList(new ISearchDestination[] { destination1, destination2 })));

-		destProviderDescr_cat1 = createThreadSafeNiceMock(IDestinationsProviderDescription.class);

-		EasyMock.expect(destProviderDescr_cat1.createProvider()).andStubReturn(destProvider_cat1);

-		EasyMock.expect(destProviderDescr_cat1.getPreferencePageId()).andStubReturn(TEST_SEARCH_DEST_PROVIDER_PREFERENCE_PAGE_ID);

-		

-		destProvider_cat2 = createThreadSafeNiceMock(IDestinationsProvider.class);

-		EasyMock.expect(destProvider_cat2.getSearchDestinations()).andStubReturn(new HashSet<ISearchDestination>(Arrays.asList(new ISearchDestination[] { destination3, destination4 })));

-		destProviderDescr_cat2 = createThreadSafeNiceMock(IDestinationsProviderDescription.class);

-		EasyMock.expect(destProviderDescr_cat2.createProvider()).andStubReturn(destProvider_cat2);

-		EasyMock.expect(destProviderDescr_cat2.getPreferencePageId()).andStubReturn(null);

-		

-		destProvider_cat3 = createThreadSafeNiceMock(IDestinationsProvider.class);

-		EasyMock.expect(destProvider_cat3.getSearchDestinations()).andStubReturn(new HashSet<ISearchDestination>(Arrays.asList(new ISearchDestination[] { destination5 })));

-		destProviderDescr_cat3 = createThreadSafeNiceMock(IDestinationsProviderDescription.class);

-		EasyMock.expect(destProviderDescr_cat3.createProvider()).andStubReturn(destProvider_cat3);

-		EasyMock.expect(destProviderDescr_cat3.getPreferencePageId()).andStubReturn(null);

-	

-		EasyMock.replay(destProvider_cat1, destProvider_cat2, destProvider_cat3, destProviderDescr_cat1, destProviderDescr_cat2, destProviderDescr_cat3);

-	}

-	

-	protected Combo getObjectTypesCombo() throws NotFoundException, MultipleFoundException

-	{

-		return (Combo) FINDER.find(new SiblingTextMatcher(DiscoveryUIMessages.SEARCH_FOR_LIST_VIEWER_LABEL, null, Combo.class));

-	}

-	

-	protected Combo getGroupByCombo() throws NotFoundException, MultipleFoundException

-	{

-		return (Combo) FINDER.find(new SiblingTextMatcher(DiscoveryUIMessages.GROUP_BY_LABEL, null, Combo.class));

-	}

-	

-	protected Tree getDestinationCategoriesTree() throws NotFoundException, MultipleFoundException

-	{

-		return (Tree) FINDER.find(new SiblingTextMatcher(DiscoveryUIMessages.SEARCH_IN_LIST_VIEWER_LABEL, null, Tree.class));

-	}

-	

-	@Override

-	public void tearDownPDE() throws Exception

-	{

-		super.tearDownPDE();

-	}

-	

-	protected static <T> T createThreadSafeNiceMock(final Class<T> clazz)

-	{

-		final T mock = EasyMock.createNiceMock(clazz);

-		EasyMock.makeThreadSafe(mock, true);

-		return mock;

-	}

-}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchConsoleViewTest.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchConsoleViewTest.java
index bfa2a3d..0d026fb 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchConsoleViewTest.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchConsoleViewTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
+ * Copyright (c) 2010, 2011 SAP AG, Walldorf.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -8,627 +8,300 @@
  * Contributors:
  *     SAP AG - initial API and implementation
  *******************************************************************************/
-package org.eclipse.platform.discovery.ui.test.comp.internal;

-

-import java.util.HashSet;
-import java.util.Set;
+package org.eclipse.platform.discovery.ui.test.comp.internal;
 
-import org.easymock.EasyMock;
+import java.text.MessageFormat;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
 import org.eclipse.platform.discovery.core.api.ISearchContext;
-import org.eclipse.platform.discovery.core.api.SearchEvent;
 import org.eclipse.platform.discovery.core.internal.ISearchSession;
-import org.eclipse.platform.discovery.core.internal.SearchConsoleController;
-import org.eclipse.platform.discovery.core.internal.console.ISearchConsoleControllerOutputView;
-import org.eclipse.platform.discovery.core.internal.events.handlers.ISearchEventHandler;
 import org.eclipse.platform.discovery.runtime.api.ISearchDestination;
 import org.eclipse.platform.discovery.runtime.api.ISearchParameters;
-import org.eclipse.platform.discovery.runtime.api.SearchFailedException;
-import org.eclipse.platform.discovery.runtime.internal.ISearchProviderConfiguration;
-import org.eclipse.platform.discovery.runtime.internal.ProviderNotFoundException;
-import org.eclipse.platform.discovery.testutils.utils.abbot.matchers.EnhancedTextMatcher;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.Assertions;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.ConditionCheckException;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.IWaitCondition;
+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IDestinationCategoryDescription;
+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IObjectTypeDescription;
 import org.eclipse.platform.discovery.ui.api.IGenericViewCustomization;
-import org.eclipse.platform.discovery.ui.api.ISearchConsoleCustomization;
 import org.eclipse.platform.discovery.ui.api.IViewUiContext;
-import org.eclipse.platform.discovery.ui.api.impl.DefaultSessionIds;
 import org.eclipse.platform.discovery.ui.internal.plugin.DiscoveryUIMessages;
 import org.eclipse.platform.discovery.ui.internal.search.advancedparams.IAdvancedSearchParamsDisplayer;
-import org.eclipse.platform.discovery.ui.internal.view.SearchConsoleView;
 import org.eclipse.platform.discovery.ui.internal.view.impl.ITabbedSessionDisplayer;
 import org.eclipse.platform.discovery.ui.internal.view.impl.SearchConsoleSelectionProvider;
-import org.eclipse.platform.discovery.util.api.env.IDiscoveryEnvironment;
-import org.eclipse.platform.discovery.util.internal.session.ISessionManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.platform.discovery.ui.test.comp.internal.fixture.SearchConsoleTestFixture;
+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.SearchConsolePageObject;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
 
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-

-

-public class SearchConsoleViewTest extends SearchConsoleTestFixture

-{

-	private MyConsoleView testView;

-	private IViewSite viewSite;

-	private IAdvancedSearchParamsDisplayer searchParamsDisplayer;

-	

-	private final static String KEYWORD_SEARCH_PARAMETER = "my keyword param"; //$NON-NLS-1$

-	private final static String testSessionId = "testsessionid"; //$NON-NLS-1$

-	

-	private Set<ISearchConsoleCustomization> viewCustomizations;

-	protected ITabbedSessionDisplayer<ISearchContext>sessionDisplayer;

-	protected IViewUiContext uiContext;

-	

-	private Shell activeShell;

-	private MySearchConsoleController viewController;

-

-	@SuppressWarnings("unchecked")

-	@Override

-	public Display setUpPDE() throws Exception

-	{

-		super.setUpPDE();

-

-		viewCustomizations = new HashSet<ISearchConsoleCustomization>();

-		uiContext = createThreadSafeNiceMock(IViewUiContext.class);

-	

-		getDisplay().syncExec(new Runnable()

-		{

-

-			@Override

-			public void run()

-			{

-				activeShell = getDisplay().getActiveShell();

-			}

-		});

-		

-		viewSite = createThreadSafeNiceMock(IViewSite.class);

-		EasyMock.expect(viewSite.getShell()).andStubReturn(activeShell);

-		EasyMock.replay(viewSite);

-		

-		searchParamsDisplayer = createThreadSafeNiceMock(IAdvancedSearchParamsDisplayer.class);

-		EasyMock.expect(searchParamsDisplayer.isEnabled()).andStubReturn(true);

-		EasyMock.replay(searchParamsDisplayer);

-		sessionDisplayer = createThreadSafeNiceMock(ITabbedSessionDisplayer.class);

-

-		return getDisplay();

-	}

-

-	public void testSelectingObjectsChangesDestinations() throws NotFoundException, MultipleFoundException

-	{

-		createViewToTest();

-

-		final Combo objectTypesCombo = getObjectTypesCombo();

-		final Tree destinationsTree = getDestinationCategoriesTree();

-

-		assertEquals("No objects selected expected by default", -1, comboTester.getSelectionIndex(objectTypesCombo)); //$NON-NLS-1$

-		assertEquals("No destination categories expected to be visible by default", 0, treeTester.getItemCount(destinationsTree)); //$NON-NLS-1$

-

-		// select the first object type

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_1);

-		selectFirstPossibleDestination(destinationsTree);

-

-		// select the second object type

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_2);

-		selectFirstPossibleDestination(destinationsTree);

-	}

-	

-	public void testSelectingObjectsNotifiesUpperComositeSizeListener() throws NotFoundException, MultipleFoundException

-	{

-		createViewToTest();

-		final Combo objectTypesCombo = getObjectTypesCombo();

-		

-		EasyMock.reset(searchParamsDisplayer);

-		searchParamsDisplayer.update(EasyMock.eq(objectType1), (ISearchDestination)EasyMock.eq(null), EasyMock.isA(IDiscoveryEnvironment.class), EasyMock.eq(uiContext));

-		EasyMock.expect(searchParamsDisplayer.isEnabled()).andStubReturn(true);

-		EasyMock.expectLastCall();

-		EasyMock.replay(searchParamsDisplayer);

-		

-		// select the first object type

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_1);

-		EasyMock.verify(searchParamsDisplayer);

-	}

-

-	public void testExpandingDestinationCategories() throws NotFoundException, MultipleFoundException

-	{

-		createViewToTest();

-

-		final Combo objectTypesCombo = getObjectTypesCombo();

-		final Tree destinationsTree = getDestinationCategoriesTree();

-

-		assertEquals("No objects selected expected by default", -1, comboTester.getSelectionIndex(objectTypesCombo)); //$NON-NLS-1$

-		assertEquals("No destination categories expected to be visible by default", 0, treeTester.getItemCount(destinationsTree)); //$NON-NLS-1$

-

-		// select the first object type

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_1);

-		selectFirstPossibleDestination(destinationsTree);

-		assertNotNull("Destination 1 not visible", QUICK_FINDER.find(new EnhancedTextMatcher(DESTINATION_NAME1))); //$NON-NLS-1$

-		assertNotNull("Destination 2 not visible", QUICK_FINDER.find(new EnhancedTextMatcher(DESTINATION_NAME1))); //$NON-NLS-1$

-		try

-		{

-			QUICK_FINDER.find(new EnhancedTextMatcher(DESTINATION_NAME3));

-			fail("Destination 3 visible"); //$NON-NLS-1$

-		} catch (NotFoundException e)

-		{

-			// expected

-		}

-

-		// select the second object type

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_2);

-		selectFirstPossibleDestination(destinationsTree);

-		try

-		{

-			QUICK_FINDER.find(new EnhancedTextMatcher(DESTINATION_NAME1));

-			fail("Destination 1 visible"); //$NON-NLS-1$

-		} catch (NotFoundException e)

-		{

-			// expected

-		}

-		try

-		{

-			QUICK_FINDER.find(new EnhancedTextMatcher(DESTINATION_NAME2));

-			fail("Destination 2 visible"); //$NON-NLS-1$

-		} catch (NotFoundException e)

-		{

-			// expected

-		}

-		assertNotNull("Destination 3 not visible", QUICK_FINDER.find(new EnhancedTextMatcher(DESTINATION_NAME3))); //$NON-NLS-1$

-	}

-

-	public void testUiComponentsEnableProgressively() throws NotFoundException, MultipleFoundException

-	{

-		createViewToTest();

-

-		final Combo objectTypesCombo = getObjectTypesCombo();

-		final Tree destinationsTree = getDestinationCategoriesTree();

-		final Text keywordsText = getKeywordsSearchText();

-		final Label subDestinationsButton = getSubdestinationsButton();

-		final Button searchButton = getSearchButton();

-		final Combo groupByCombo = getGroupByCombo();

-

-		assertTrue("Search for list should be enabled", comboTester.getEnabled(objectTypesCombo)); //$NON-NLS-1$

-		assertFalse("Search in tree should be disabled", treeTester.getEnabled(destinationsTree)); //$NON-NLS-1$

-		assertFalse("Keywords text should be disabled", textTester.getEnabled(keywordsText)); //$NON-NLS-1$

-		assertFalse("Subdestinations should be disabled", buttonTester.getEnabled(subDestinationsButton)); //$NON-NLS-1$

-		assertFalse("Search button should be disabled", buttonTester.getEnabled(searchButton)); //$NON-NLS-1$

-		assertFalse("Group by combo should be disabled", comboTester.getEnabled(groupByCombo)); //$NON-NLS-1$

-

-		// select the first object type

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_1);

-		assertTrue("Search in list should be enabled", treeTester.getEnabled(destinationsTree)); //$NON-NLS-1$

-		assertFalse("Keywords text should be disabled", textTester.getEnabled(keywordsText)); //$NON-NLS-1$

-		assertFalse("Subdestinations should be disabled", buttonTester.getEnabled(subDestinationsButton)); //$NON-NLS-1$

-		assertFalse("Search button should be disabled", buttonTester.getEnabled(searchButton)); //$NON-NLS-1$

-		assertFalse("Group by combo should be disabled", comboTester.getEnabled(groupByCombo)); //$NON-NLS-1$

-

-		// select first destination

-		selectFirstPossibleDestination(destinationsTree);

-		assertFalse("Keywords text should be disabled", textTester.getEnabled(keywordsText)); //$NON-NLS-1$

-		assertTrue("Subdestinations should be enabled", buttonTester.getEnabled(subDestinationsButton)); //$NON-NLS-1$

-		assertTrue("Search button should be enabled", buttonTester.getEnabled(searchButton)); //$NON-NLS-1$

-		assertFalse("Group by combo should not be disabled", comboTester.getEnabled(groupByCombo)); //$NON-NLS-1$

-		

-		// Select the second object type and third destination. This would determine a search provider which has grouping hierarchy capability and supports text search

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_2);

-		selectFirstPossibleDestination(destinationsTree);

-		assertTrue("Group by combo should be enabled", comboTester.getEnabled(groupByCombo)); //$NON-NLS-1$

-		assertTrue("Keywords text should be enabled", textTester.getEnabled(keywordsText)); //$NON-NLS-1$

-		

-		// Select the first object type and first destination. This would determine a search provider which has no grouping hierarchy capability and does not support text search

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_1);

-		selectFirstPossibleDestination(destinationsTree);

-		assertFalse("Group by combo should be disabled", comboTester.getEnabled(groupByCombo)); //$NON-NLS-1$

-		assertFalse("Keywords text should be disabled", textTester.getEnabled(keywordsText)); //$NON-NLS-1$

-	}

-	

-	public void testGroupingHieararchyComboDisplaysFirstElementByDefault() throws NotFoundException, MultipleFoundException

-	{

-		createViewToTest();

-		

-		final Combo objectTypesCombo = getObjectTypesCombo();

-		final Tree destinationsTree = getDestinationCategoriesTree();

-		final Combo groupByCombo = getGroupByCombo();

-		

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_2);

-		selectFirstPossibleDestination(destinationsTree);

-		assertEquals("Group by combo does not display the item expected", groupingHierarchy1.getDisplayName(), comboTester.getText(groupByCombo)); //$NON-NLS-1$

-	}

-

-	public void testSubdestinationsButtonEnablement() throws NotFoundException, MultipleFoundException

-	{

-		createViewToTest();

-

-		final Combo objectTypesCombo = getObjectTypesCombo();

-		final Tree destinationsTree = getDestinationCategoriesTree();

-		final Label subDestinationsButton = getSubdestinationsButton();

-

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_1);

-		selectFirstPossibleDestination(destinationsTree);

-

-		assertTrue("Subdestinations button should be enabled when subdestinations available", isEnabled(subDestinationsButton)); //$NON-NLS-1$

-

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_2);

-		selectFirstPossibleDestination(destinationsTree);

-		assertFalse("Subdestinations button should not be enabled when subdestinations available", isEnabled(subDestinationsButton)); //$NON-NLS-1$

-	}

-

-	public void testChangingObjectTypesDisablesKeywordandSubdestinationsSection() throws NotFoundException, MultipleFoundException

-	{

-		createViewToTest();

-

-		final Combo objectTypesCombo = getObjectTypesCombo();

-		final Tree destinationsTree = getDestinationCategoriesTree();

-		final Text keywordsText = getKeywordsSearchText();

-		final Label subDestinationsButton = getSubdestinationsButton();

-

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_2);

-		selectFirstPossibleDestination(destinationsTree);

-		assertTrue("Keywords text should be enabled", textTester.getEnabled(keywordsText)); //$NON-NLS-1$

-		assertFalse("Subdestinations should be disabled", buttonTester.getEnabled(subDestinationsButton)); //$NON-NLS-1$

-		

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_1);

-		selectFirstPossibleDestination(destinationsTree);

-		assertFalse("Keywords text should be disabled after object type change", textTester.getEnabled(keywordsText)); //$NON-NLS-1$

-		assertTrue("Subdestinations should be enabled", buttonTester.getEnabled(subDestinationsButton)); //$NON-NLS-1$

-	}

-

-	public void testKeywordsEnablementChangesWhenActiveProivdersChange() throws NotFoundException, MultipleFoundException, InterruptedException

-	{

-		createViewToTest();

-

-		final Combo objectTypesCombo = getObjectTypesCombo();

-		final Tree destinationsTree = getDestinationCategoriesTree();

-		final Text keywordsText = getKeywordsSearchText();

-

-		// By default, there is nothing selected, the  keyword text is set to SearchConsoleView_NoObjectTypeSelectedHint

-		assertEquals("The keyword text should be set to \"" + DiscoveryUIMessages.SearchConsoleView_NoObjectTypeSelectedHint + "\" when disabled", DiscoveryUIMessages.SearchConsoleView_NoObjectTypeSelectedHint, textTester.getText(keywordsText)); //$NON-NLS-1$ //$NON-NLS-2$

-		assertFalse("Keywords text should not be enabled", isEnabled(keywordsText)); //$NON-NLS-1$

-		

-		// Select object 3

-		// When there is only one destination it should be selected by default and the keyword text is set to DiscoveryUIMessages.SearchConsoleView_EnterKeywordHint

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_3);

-//		assertEquals("The keyword text should be set to \"" + DiscoveryUIMessages.SearchConsoleView_EnterKeywordHint + "\"", DiscoveryUIMessages.SearchConsoleView_EnterKeywordHint, textTester.getText(keywordsText)); //$NON-NLS-1$ //$NON-NLS-2$

-		assertTrue("Keywords text should not be enabled", isEnabled(keywordsText)); //$NON-NLS-1$

-		

-		// Select object 1

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_2);

-		// When there is no destination selected, the  keyword text is set to DiscoveryUIMessages.SearchConsoleView_NoDestinationSelectedHint when the current search provider does not support text search 

-		assertEquals("The keyword text should be set to \"" + DiscoveryUIMessages.SearchConsoleView_NoDestinationSelectedHint + "\" when disabled", DiscoveryUIMessages.SearchConsoleView_NoDestinationSelectedHint, textTester.getText(keywordsText)); //$NON-NLS-1$ //$NON-NLS-2$

-		assertFalse("Keywords text should not be enabled", isEnabled(keywordsText)); //$NON-NLS-1$

-		

-		selectFirstPossibleDestination(destinationsTree);

-		assertTrue("Keywords text should be enabled", isEnabled(keywordsText)); //$NON-NLS-1$

-		textTester.actionKeyString(keywordsText, "HELLO!"); //$NON-NLS-1$

-

-		// Select object 2

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_1);

-		selectFirstPossibleDestination(destinationsTree);

-		assertFalse("Keywords text should not be enabled", isEnabled(keywordsText)); //$NON-NLS-1$

-		// When the keyword text is disabled, its text is set to DiscoveryUIMessages.SearchConsoleView_UnsuuportedTextSearch when the current search provider does not support text search 

-		assertEquals("The keyword text should be set to \"" + DiscoveryUIMessages.SearchConsoleView_UnsupportedTextSearch + "\" when disabled", DiscoveryUIMessages.SearchConsoleView_UnsupportedTextSearch, textTester.getText(keywordsText)); //$NON-NLS-1$ //$NON-NLS-2$

-		

-	}

-

-	public void testSearch() throws NotFoundException, MultipleFoundException, ProviderNotFoundException, SearchFailedException

-	{

-		createViewToTest();

-		

-		final Combo objectTypesList = getObjectTypesCombo();

-		final Tree destinationsTree = getDestinationCategoriesTree();

-		final Button searchButton = getSearchButton();

-

-		// select the first object type

-		comboTester.actionSelectItem(objectTypesList, OBJECT_TYPE_NAME_1);

-		// select first destination

-		selectFirstPossibleDestination(destinationsTree);

-		

-		assertTrue("Search button should be visible", buttonTester.isVisible(searchButton)); //$NON-NLS-1$

-		EasyMock.reset(searchParamsDisplayer);

-		searchParamsDisplayer.setParams(EasyMock.isA(ISearchParameters.class));

-		EasyMock.expectLastCall();

-		EasyMock.replay(searchParamsDisplayer);

-		buttonTester.actionClick(searchButton);

-		

-		assertNotNull("Search handler not invoked", viewController.lastSearchEvent); //$NON-NLS-1$

-		assertEquals("Unexpected object type", OBJECT_TYPE_ID1, viewController.lastSearchEvent.getSearchParameters().getObjectTypeId()); //$NON-NLS-1$

-		assertEquals("Unexpected destination", DESTINATION_NAME1, viewController.lastSearchEvent.getSearchParameters().getSearchDestination().getDisplayName()); //$NON-NLS-1$

-		

-		EasyMock.verify(searchParamsDisplayer);

-	}

-	

-	public void testSearchPropagatesKeywordTextToSearchParam() throws NotFoundException, MultipleFoundException, ProviderNotFoundException, SearchFailedException

-	{

-		createViewToTest();

-

-		final Combo objectTypesCombo = getObjectTypesCombo();

-		final Tree destinationsTree = getDestinationCategoriesTree();

-		final Text keywordsText = getKeywordsSearchText();

-		final Button searchButton = getSearchButton();

-

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_2);

-		selectFirstPossibleDestination(destinationsTree);

-		assertTrue("Keywords text should be enabled", isEnabled(keywordsText)); //$NON-NLS-1$

-		textTester.actionKeyString(keywordsText, KEYWORD_SEARCH_PARAMETER);

-		

-		EasyMock.reset(searchParamsDisplayer);

-		searchParamsDisplayer.setParams(EasyMock.isA(ISearchParameters.class));

-		EasyMock.expectLastCall();

-		EasyMock.replay(searchParamsDisplayer);

-		

-		buttonTester.actionClick(searchButton);

-		assertNotNull("Search was not invoked", viewController.lastSearchEvent);

-		assertEquals("Keyword search parameter not properly set", KEYWORD_SEARCH_PARAMETER, viewController.lastSearchEvent.getSearchParameters().getKeywordString()); //$NON-NLS-1$

-		EasyMock.verify(searchParamsDisplayer);

-	}

-

-	

-	public void testChangingDestinationsUpdatesAdvancedSearchParams() throws NotFoundException, MultipleFoundException

-	{

-		createViewToTest();

-

-		final Combo objectTypesCombo = getObjectTypesCombo();

-		final Tree destinationsTree = getDestinationCategoriesTree();

-		

-		EasyMock.reset(searchParamsDisplayer);

-		searchParamsDisplayer.update(EasyMock.eq(objectType1), EasyMock.eq(destination1), EasyMock.isA(IDiscoveryEnvironment.class), EasyMock.eq(uiContext));

-		EasyMock.expectLastCall();

-		EasyMock.expect(searchParamsDisplayer.isEnabled()).andStubReturn(true);

-		EasyMock.replay(searchParamsDisplayer);

-		

-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NAME_1);

-		selectFirstPossibleDestination(destinationsTree);

-		

-		EasyMock.verify(searchParamsDisplayer);

-	}

-	

-	public void testShowResultCallsDisplayer() throws NotFoundException, MultipleFoundException

-	{

-		final ISearchSession session = createThreadSafeNiceMock(ISearchSession.class);

-		EasyMock.expect(session.getId()).andStubReturn(testSessionId);

-		EasyMock.replay(session);

-		final ISearchContext searchContext = createThreadSafeNiceMock(ISearchContext.class); 

-		EasyMock.expect(searchContext.searchProviderId()).andStubReturn(SUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID);

-		EasyMock.expect(searchContext.session()).andStubReturn(session);

-		EasyMock.replay(searchContext);

-		

-		final ISearchConsoleCustomization customizationToUse = EasyMock.createMock(ISearchConsoleCustomization.class);

-		EasyMock.expect(customizationToUse.acceptSearchProvider(SUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID)).andStubReturn(true);

-		EasyMock.replay(customizationToUse);

-		

-		final ISearchConsoleCustomization customizationNotToUse = EasyMock.createMock(ISearchConsoleCustomization.class);

-		EasyMock.expect(customizationNotToUse.acceptSearchProvider(SUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID)).andStubReturn(false);

-		EasyMock.replay(customizationNotToUse);

-

-		viewCustomizations.add(customizationNotToUse);

-		viewCustomizations.add(customizationToUse);

-		

-		sessionDisplayer.display(EasyMock.same(session));

-		EasyMock.expectLastCall();

-		EasyMock.expectLastCall();

-		EasyMock.replay(sessionDisplayer);

-		

-		createViewToTest();

-		testView.registerViewCustomization(customizationNotToUse);

-		testView.registerViewCustomization(customizationToUse);

-		getDisplay().syncExec(new Runnable()

-		{

-			@Override

-			public void run()

-			{

-				testView.showResult(searchContext);

-			}

-		});

-		

-		EasyMock.verify(sessionDisplayer);

-	}

-		

-	public void testViewRegistersProperSelectionProvider()

-	{

-		viewSite = EasyMock.createMock(IViewSite.class);

-		viewSite.setSelectionProvider(EasyMock.isA(SearchConsoleSelectionProvider.class));

-		EasyMock.expectLastCall();

-		EasyMock.expect(viewSite.getShell()).andStubReturn(activeShell);

-		EasyMock.replay(viewSite);

-		

-		createViewToTest();

-		EasyMock.verify(viewSite);

-	}

-	

-	public void testManageDestinationsHyperLink()

-	{

-		createViewToTest();

-		try

-		{

-			Hyperlink hl = findManageDestinationsLink();

-			TESTER.click(hl);

-			//pref page window is open

-			

-			Widget w = FINDER.find(new EnhancedTextMatcher("DiscoveryUiTestPreferencePage")); //$NON-NLS-1$

-			TESTER.click(w);

-			FINDER.find(new EnhancedTextMatcher("MyTestLabel")); //$NON-NLS-1$

-			FINDER.find(new EnhancedTextMatcher("Button1")); //$NON-NLS-1$

-			

-			//close pref page window

-			Button cancelButton = (Button)FINDER.find(new EnhancedTextMatcher("Cancel", Button.class)); //$NON-NLS-1$

-			assertNotNull(cancelButton);

-			TESTER.click(cancelButton);

-		}

-		catch (Exception e) {

-			fail("Unexpexted exception was thrown: "+e.getMessage()); //$NON-NLS-1$

-		}

-	}
-	
-	public void testObjectTypeWithNoDestinations() throws NotFoundException, MultipleFoundException
+public class SearchConsoleViewTest
+{
+	private SearchConsolePageObject consolePageObject;
+	private static SearchConsoleTestFixture fixture;
+
+	@Mock
+	private IAdvancedSearchParamsDisplayer searchParamsDisplayer;
+
+	private final static String KEYWORD_SEARCH_PARAMETER = "my keyword param"; //$NON-NLS-1$
+	private final static String testSessionId = "testsessionid"; //$NON-NLS-1$
+
+	protected ITabbedSessionDisplayer<ISearchContext> sessionDisplayer;
+	protected IViewUiContext uiContext;
+
+	@BeforeClass
+	public static void initFixture()
 	{
-		createViewToTest();
-		final Combo objectTypesCombo = getObjectTypesCombo();
-		comboTester.actionSelectItem(objectTypesCombo, OBJECT_TYPE_NO_DESTINATIONS_NAME);
-		Text keywordSearchText = getKeywordsSearchText();
-		assertTrue("keyword text should be enabled", textTester.isEnabled(keywordSearchText));
-		assertEquals("did not expect a search criteria", "", textTester.getText(keywordSearchText));
-		assertTrue("keyword text should be editable", textTester.getEditable(keywordSearchText));
-		assertFalse("Search should be disabled because there is no search criteria", buttonTester.isEnabled(getSearchButton()));
-		
-		textTester.actionKeyString(getKeywordsSearchText(), "asd");
-		assertTrue("Search should be enabled because search criteria was provided", buttonTester.isEnabled(getSearchButton()));
+		fixture = new SearchConsoleTestFixture();
 	}
 	
+	@SuppressWarnings("unchecked")
+	@Before
+	public void setUp()
+	{
+		MockitoAnnotations.initMocks(this);
+
+		sessionDisplayer = Mockito.mock(ITabbedSessionDisplayer.class);
+		searchParamsDisplayer = Mockito.mock(IAdvancedSearchParamsDisplayer.class);
+
+		consolePageObject = new SearchConsolePageObject(fixture.searchProviderConfiguration, sessionDisplayer, searchParamsDisplayer, fixture.environment, fixture.viewUiContext);
+		consolePageObject.open();
+	}
+
+	@After
+	public void tearDown()
+	{
+		consolePageObject.close();
+	}
+
+	@Test
+	public void testSelectingObjectsChangesDestinations()
+	{
+		Assert.assertNull("No objects selected expected by default", consolePageObject.getSelectedObject());
+		Assert.assertEquals("No destination categories expected to be visible by default", 0, consolePageObject.getCategories().size());
+
+		// select the first object type
+		selectObject(fixture.objectType1);
+		consolePageObject.expandDestinations();
+		assertSingleCategoryVisible(fixture.category1);
+		assertDestinationsVisible(fixture.category1, fixture.destination1, fixture.destination2);
+
+		// select the second object type
+		selectObject(fixture.objectType2);
+		consolePageObject.expandDestinations();
+		assertSingleCategoryVisible(fixture.category2);
+		assertDestinationsVisible(fixture.category2, fixture.destination3, fixture.destination4);
+	}
+	
+	private void assertDestinationsVisible(final IDestinationCategoryDescription category, final ISearchDestination... expectedDestinations)
+	{
+		final Collection<String> visibleDestinations = consolePageObject.getDestinationsForCategory(category.getDisplayName());
+		Assert.assertEquals(MessageFormat.format("Unexpected destinations caount for category {0}", category.getDisplayName()), expectedDestinations.length, visibleDestinations.size());
+		for(ISearchDestination expectedDest : expectedDestinations)
+		{
+			Assert.assertTrue(MessageFormat.format("Destination {0} not visible", expectedDest.getDisplayName()), visibleDestinations.contains(expectedDest.getDisplayName()));
+		}
+	}
+
+	private void assertSingleCategoryVisible(final IDestinationCategoryDescription category)
+	{
+		final Collection<String> visibleCategories = consolePageObject.getCategories();
+		Assert.assertTrue(MessageFormat.format("Category {0} not available", category.getDisplayName()), visibleCategories.contains(category.getDisplayName()));
+		Assert.assertEquals("Expected to display exactly one category", 1, visibleCategories.size());
+	}
+
+	@Test
+	public void testSelectingObjectsNotifiesAdvancedParametersComponent()
+	{
+		selectObject(fixture.objectType1);
+		Mockito.verify(searchParamsDisplayer, Mockito.atLeastOnce()).update(fixture.objectType1, null, fixture.environment, fixture.viewUiContext);
+	}
+
+	@Test
+	public void testUiComponentsEnableProgressively()
+	{
+		Assert.assertTrue("Search for list should be enabled", consolePageObject.canSelectObject());
+		Assert.assertFalse("Search in tree should be disabled", consolePageObject.canSelectDestination());
+		Assert.assertFalse("Keywords text should be disabled", consolePageObject.canEnterSearchText());
+		Assert.assertFalse("Subdestinations should be disabled", consolePageObject.canSelectSubdestination());
+		Assert.assertFalse("Search button should be disabled", consolePageObject.canSearch());
+		Assert.assertFalse("Group by combo should be disabled", consolePageObject.canSelectHierarchy());
+
+		// select the first object type
+		selectObject(fixture.objectType1);
+		Assert.assertTrue("Search in list should be enabled", consolePageObject.canSelectDestination());
+		Assert.assertFalse("Keywords text should be disabled", consolePageObject.canEnterSearchText());
+		Assert.assertFalse("Subdestinations should be disabled", consolePageObject.canSelectSubdestination());
+		Assert.assertFalse("Search button should be disabled", consolePageObject.canSearch());
+		Assert.assertFalse("Group by combo should be disabled", consolePageObject.canSelectHierarchy());
+
+		// select first destination
+		consolePageObject.selectFirstPossibleDestination();
+		Assert.assertFalse("Keywords text should be disabled", consolePageObject.canEnterSearchText());
+		Assert.assertTrue("Subdestinations should be enabled", consolePageObject.canSelectDestination());
+		Assert.assertTrue("Search button should be enabled", consolePageObject.canSearch());
+		Assert.assertFalse("Group by combo should not be disabled", consolePageObject.canSelectHierarchy());
+
+		// Select the second object type and third destination. This would select a search provider which has grouping hierarchy capability and
+		// supports text search
+		selectObject(fixture.objectType2);
+		consolePageObject.selectFirstPossibleDestination();
+		Assert.assertTrue("Group by combo should be enabled", consolePageObject.canSelectHierarchy());
+		Assert.assertTrue("Keywords text should be enabled", consolePageObject.canEnterSearchText());
+
+		// Select the first object type and first destination. This would determine a search provider which has no grouping hierarchy capability and
+		// does not support text search
+		selectObject(fixture.objectType1);
+		consolePageObject.selectFirstPossibleDestination();
+		Assert.assertFalse("Group by combo should be disabled", consolePageObject.canSelectHierarchy());
+		Assert.assertFalse("Keywords text should be disabled", consolePageObject.canEnterSearchText());
+	}
+
+	@Test
+	public void testGroupingHieararchyComboDisplaysFirstElementByDefault()
+	{
+		selectObject(fixture.objectType2);
+		consolePageObject.selectFirstPossibleDestination();
+		Assert.assertEquals("Group by combo does not display the item expected", fixture.groupingHierarchy1.getDisplayName(), consolePageObject.getSelectedGroupingHierarchy());
+	}
+
+	@Test
+	public void testSubdestinationsButtonEnablement()
+	{
+		selectObject(fixture.objectType1);
+		consolePageObject.selectFirstPossibleDestination();
+		Assert.assertTrue("Subdestinations button should be enabled when subdestinations available", consolePageObject.canSelectSubdestination());
+
+		selectObject(fixture.objectType2);
+		consolePageObject.selectFirstPossibleDestination();
+		Assert.assertFalse("Subdestinations button should not be enabled when subdestinations not available", consolePageObject.canSelectSubdestination());
+	}
+
+	private void selectObject(final IObjectTypeDescription object)
+	{
+		consolePageObject.selectObject(object.getDisplayName());
+	}
+
+	@Test
+	public void testChangingObjectTypesDisablesKeywordAndSubdestinationsSection()
+	{
+		selectObject(fixture.objectType2);
+		consolePageObject.selectFirstPossibleDestination();
+		Assert.assertTrue("Keywords text should be enabled", consolePageObject.canEnterSearchText());
+		Assert.assertFalse("Subdestinations should be disabled", consolePageObject.canSelectSubdestination());
+
+		selectObject(fixture.objectType1);
+		consolePageObject.selectFirstPossibleDestination();
+		Assert.assertFalse("Keywords text should be disabled after object type change", consolePageObject.canEnterSearchText());
+		Assert.assertTrue("Subdestinations should be enabled", consolePageObject.canSelectSubdestination());
+	}
+
+	@Test
+	public void testKeywordsEnablementChangesWhenActiveProvidersChange()
+	{
+		// By default, there is nothing selected, the keyword text is set to SearchConsoleView_NoObjectTypeSelectedHint
+		Assert.assertEquals(MessageFormat.format("The keyword text should be set to \"{0}\" when disabled", DiscoveryUIMessages.SearchConsoleView_NoObjectTypeSelectedHint), DiscoveryUIMessages.SearchConsoleView_NoObjectTypeSelectedHint, consolePageObject.getKeyword());
+		Assert.assertFalse("Keywords text should not be enabled", consolePageObject.canEnterSearchText());
+
+		// Select object 3
+		// When there is only one destination it should be selected by default and the keyword text is set to
+		// DiscoveryUIMessages.SearchConsoleView_EnterKeywordHint
+		selectObject(fixture.objectType3);
+		Assert.assertEquals(MessageFormat.format("The keyword text should be set to \"{0}\"", DiscoveryUIMessages.SearchConsoleView_EnterKeywordHint), DiscoveryUIMessages.SearchConsoleView_EnterKeywordHint, consolePageObject.getKeyword());
+		Assert.assertTrue("Keywords text should not be enabled", consolePageObject.canEnterSearchText());
+
+		// Select object 2
+		selectObject(fixture.objectType2);
+		// When there is no destination selected, the keyword text is set to DiscoveryUIMessages.SearchConsoleView_NoDestinationSelectedHint when the current search provider does not support text search
+		Assert.assertEquals(MessageFormat.format("The keyword text should be set to \"{0}\" when disabled", DiscoveryUIMessages.SearchConsoleView_NoDestinationSelectedHint), DiscoveryUIMessages.SearchConsoleView_NoDestinationSelectedHint, consolePageObject.getKeyword());
+		Assert.assertFalse("Keywords text should not be enabled", consolePageObject.canEnterSearchText());
+
+		consolePageObject.selectFirstPossibleDestination();
+		Assert.assertTrue("Keywords text should be enabled", consolePageObject.canEnterSearchText());
+		consolePageObject.enterKeyword("HELLO!");
+
+		// Select object 1
+		selectObject(fixture.objectType1);
+		consolePageObject.selectFirstPossibleDestination();
+		Assert.assertFalse("Keywords text should not be enabled", consolePageObject.canEnterSearchText());
+		// When the keyword text is disabled, its text is set to DiscoveryUIMessages.SearchConsoleView_UnsuuportedTextSearch when the current search
+		// provider does not support text search
+		Assert.assertEquals(MessageFormat.format("The keyword text should be set to \"{0}\" when disabled", DiscoveryUIMessages.SearchConsoleView_UnsupportedTextSearch), DiscoveryUIMessages.SearchConsoleView_UnsupportedTextSearch, consolePageObject.getKeyword());
+	}
+
+	@Test
+	public void testSearch()
+	{
+		selectObject(fixture.objectType2);
+		consolePageObject.selectDestination(fixture.category2.getDisplayName(), fixture.destination4.getDisplayName());
+		consolePageObject.enterKeyword(KEYWORD_SEARCH_PARAMETER);
+		consolePageObject.search();
+
+		consolePageObject.verifySearchPerformed(fixture.objectType2.getId(), fixture.destination4.getDisplayName(), KEYWORD_SEARCH_PARAMETER);
+		Mockito.verify(searchParamsDisplayer).setParams(Mockito.any(ISearchParameters.class));
+	}
+
+	@Test
+	public void testChangingDestinationsUpdatesAdvancedSearchParams()
+	{
+		Mockito.stub(searchParamsDisplayer.isEnabled()).toReturn(true);
+		selectObject(fixture.objectType1);
+		consolePageObject.selectFirstPossibleDestination();
+		Mockito.verify(searchParamsDisplayer).update(fixture.objectType1, fixture.destination1, fixture.environment, fixture.viewUiContext);
+	}
+
+	@Test
+	public void testShowResultInSession()
+	{
+		final ISearchSession session = Mockito.mock(ISearchSession.class);
+		Mockito.stub(session.getId()).toReturn(testSessionId);
+
+		final String searchProviderId = fixture.supportingTextSearchProviderDescription.getId();
+		final ISearchContext searchContext = Mockito.mock(ISearchContext.class);
+		Mockito.stub(searchContext.searchProviderId()).toReturn(searchProviderId);
+		Mockito.stub(searchContext.session()).toReturn(session);
+
+		consolePageObject.showResult(searchContext);
+		Mockito.verify(sessionDisplayer).display(session);
+	}
+
+	@Test
+	public void testViewRegistersProperSelectionProvider()
+	{
+		Mockito.verify(consolePageObject.getViewSiteMock()).setSelectionProvider(Mockito.any(SearchConsoleSelectionProvider.class));
+	}
+
+	@Test
+	public void testManageDestinations()
+	{
+		consolePageObject.verifyManageDestinationsWorksCorrectly();
+	}
+
+	@Test
+	public void testObjectTypeWithNoDestinations()
+	{
+		selectObject(fixture.objectTypeNoDestinations);
+		Assert.assertTrue("keyword text should be enabled", consolePageObject.canEnterSearchText());
+		Assert.assertFalse("Search should be disabled because there is no search criteria", consolePageObject.canSearch());
+
+		consolePageObject.enterKeyword("asd");
+		Assert.assertTrue("Search should be enabled because search criteria was provided", consolePageObject.canSearch());
+	}
+
+	@Test
 	public void testRegisteringIllegalViewCustomization()
 	{
-		createViewToTest();
-		
-		final IGenericViewCustomization illegalCustomization = EasyMock.createMock(IGenericViewCustomization.class);
+		final IGenericViewCustomization illegalCustomization = Mockito.mock(IGenericViewCustomization.class);
 		try
 		{
-			testView.registerViewCustomization(illegalCustomization);
-			fail("IllegalArgumentException for illegal customization"); //$NON-NLS-1$
+			consolePageObject.registerViewCustomization(illegalCustomization);
+			Assert.fail("IllegalArgumentException for illegal customization"); //$NON-NLS-1$
 		}
-		catch(IllegalArgumentException e)
+		catch (IllegalArgumentException e)
 		{
-			//expected
+			// expected
 		}
 	}
-	
-	
-	private Hyperlink findManageDestinationsLink()

-	{

-		final Hyperlink[] result = new Hyperlink[1];

-		Assertions.waitAssert(new IWaitCondition()

-		{

-			@Override

-			public boolean checkCondition() throws ConditionCheckException

-			{

-				Hyperlink hl;

-				try

-				{

-					//hl = (Hyperlink)FINDER.find(new ClassMatcher<Widget>(Hyperlink.class));

-					hl = (Hyperlink)FINDER.find(new EnhancedTextMatcher(DiscoveryUIMessages.SearchConsoleView_MANAGED_CONFIGS_LINK, true, Hyperlink.class));

-				} catch (NotFoundException e)

-				{

-					return false;

-				} catch (MultipleFoundException e)

-				{

-					return false;

-				}

-				

-				result[0] = hl;

-				

-				return true;

-			}

-		}, "Hyperlink not found");

-		

-		return result[0];

-	}

-	

-	private MyConsoleView createTestView()

-	{

-		final MyConsoleView[] v = new MyConsoleView[1];

-		getDisplay().syncExec(new Runnable(){

-			public void run()

-			{

-				v[0] = new MyConsoleView();

-				v[0].setEnvironment(environment);

-				v[0].setUiContext(uiContext);

-			}});

-		return v[0];

-	}

-

-	private void createViewToTest()

-	{

-		testShell = createTestShell();

-		testView = createTestView();

-		openView(testView, testShell);

-	}

-	

-	private void openView(final SearchConsoleView view, final Shell shell)

-	{

-		final String[] shellName = new String[1];

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				shellName[0] = shell.getText();

-			}

-		});

-		getDisplay().asyncExec(new Runnable()

-		{

-

-			public void run()

-			{

-				shell.setLayout(new FillLayout(SWT.HORIZONTAL));

-				view.createPartControl(shell);

-				shell.open();

-				shell.layout();

-				view.setDefaultSessionId(DefaultSessionIds.mainSearchSessionId);

-				view.setEnvironment(environment);

-				viewController = new MySearchConsoleController(searchProviderConfiguration, view, environment, null, DefaultSessionIds.mainSearchSessionId);

-				view.registerController(viewController);

-				view.initializationCompleted();

-			}

-		});

-		waitForShell(shellName[0]);

-	}

-	

-	private class MyConsoleView extends SearchConsoleView

-	{

-		protected ISearchProviderConfiguration getSearchProviderConfiguration()

-		{

-			return searchProviderConfiguration;

-		};

-		

-		@Override

-		protected ITabbedSessionDisplayer<ISearchContext> createSessionsDisplayer()

-		{

-			return sessionDisplayer;

-		}

-		

-		@Override

-		public IWorkbenchPartSite getSite()

-		{

-			return viewSite;

-		}

-		

-		@Override

-		protected IAdvancedSearchParamsDisplayer createAdvancedSearchParamsDisplayer( Composite parent, FormToolkit formToolkit) {

-			return searchParamsDisplayer;

-		}

-	}

-	

-	private class MySearchConsoleController extends SearchConsoleController

-	{

-		public SearchEvent lastSearchEvent;

-		

-		public MySearchConsoleController(ISearchProviderConfiguration providerConfiguration, ISearchConsoleControllerOutputView searchConsoleView, IDiscoveryEnvironment consoleEnv,

-										ISessionManager<ISearchSession> sessionManager, String defaultSessionId)

-		{

-			super(providerConfiguration, searchConsoleView, consoleEnv, sessionManager, defaultSessionId);

-		}

-		

-		@Override

-		protected ISearchEventHandler createSearchEventHandler()

-		{

-			return new ISearchEventHandler()

-			{

-				@Override

-				public void handleSearch(SearchEvent event) throws ProviderNotFoundException, SearchFailedException

-				{

-					lastSearchEvent = event;

-				}

-			};

-		}

-		

-	}

-}

+}
diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchDestinationsSelectorTest.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchDestinationsSelectorTest.java
index cae9f8a..8bdede6 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchDestinationsSelectorTest.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchDestinationsSelectorTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
+ * Copyright (c) 2010, 2011 SAP AG, Walldorf.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -30,9 +30,6 @@
 import org.junit.Test;
 import org.mockito.Mockito;
 
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-
 public class SearchDestinationsSelectorTest
 {
 	private static final String DESTINATION_NAME_1 = "My First Destination";
@@ -62,7 +59,7 @@
 	}
 
 	@Test
-	public void testUpdatingSelector() throws NotFoundException, MultipleFoundException
+	public void testUpdatingSelector()
 	{
 		selector.selectFirstPossibleDestination();
 		verifyDisplayedItems(CATEGORY_NAME, DESTINATION_NAME_1);
@@ -75,7 +72,7 @@
 	}
 
 	@Test
-	public void testUpdatingCurrentlySelectedItem() throws NotFoundException, MultipleFoundException
+	public void testUpdatingCurrentlySelectedItem()
 	{
 		selector.selectFirstPossibleDestination();
 		verifyDisplayedItems(CATEGORY_NAME, DESTINATION_NAME_1);
@@ -89,11 +86,12 @@
 		verifyDisplayedItems(CATEGORY_NAME, DESTINATION_NAME_2);
 	}
 
-	public void testSelectionIsPreservedWhenSameDestinationsAreShown() throws NotFoundException, MultipleFoundException
+	@Test
+	public void testSelectionIsPreservedWhenSameDestinationsAreShown()
 	{
 		destinationsToShow.add(destination_2);
 		selector.update();
-		selector.select(DESTINATION_NAME_2);
+		selector.selectDestination(DESTINATION_NAME_2);
 
 		destinationsToShow.remove(destination_1);
 		selector.update();
diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchFavoritesViewTest.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchFavoritesViewTest.java
index 95e21a9..405de5e 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchFavoritesViewTest.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SearchFavoritesViewTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
+ * Copyright (c) 2010, 2011 SAP AG, Walldorf.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -8,546 +8,211 @@
  * Contributors:
  *     SAP AG - initial API and implementation
  *******************************************************************************/
-package org.eclipse.platform.discovery.ui.test.comp.internal;

-

-import java.lang.reflect.InvocationTargetException;
+package org.eclipse.platform.discovery.ui.test.comp.internal;
+
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Set;
 
-import org.easymock.EasyMock;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import junit.framework.Assert;
+
 import org.eclipse.jface.util.LocalSelectionTransfer;
 import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.platform.discovery.core.api.ISearchContext;
 import org.eclipse.platform.discovery.core.api.ISearchFavoritesMasterController;
 import org.eclipse.platform.discovery.core.internal.ContextStructuredSelection;
 import org.eclipse.platform.discovery.core.internal.IContextStructuredSelection;
-import org.eclipse.platform.discovery.runtime.api.ISearchDestination;
-import org.eclipse.platform.discovery.runtime.api.ISearchParameters;
-import org.eclipse.platform.discovery.testutils.utils.abbot.matchers.SiblingTextMatcher;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.Assertions;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.ConditionCheckException;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.IWaitCondition;
 import org.eclipse.platform.discovery.ui.api.ISearchFavoritesViewCustomization;
-import org.eclipse.platform.discovery.ui.api.impl.GenericViewCustomizationImpl;
-import org.eclipse.platform.discovery.ui.internal.dnd.LocalContextSelectionTransfer;
-import org.eclipse.platform.discovery.ui.internal.view.SearchFavoritesView;
+import org.eclipse.platform.discovery.ui.test.comp.internal.fixture.SearchConsoleTestFixture;
+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.SearchFavoritesPageObject;
 import org.eclipse.platform.discovery.util.api.env.IDiscoveryEnvironment;
-import org.eclipse.platform.discovery.util.api.env.IErrorHandler;
-import org.eclipse.platform.discovery.util.api.longop.ILongOperation;
-import org.eclipse.platform.discovery.util.api.longop.ILongOperationRunner;
-import org.eclipse.platform.discovery.util.api.longop.LongOpCanceledException;
-import org.eclipse.swt.SWT;
 import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
 import org.eclipse.swt.dnd.DropTargetAdapter;
 import org.eclipse.swt.dnd.DropTargetEvent;
 import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPartSite;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
 
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-import abbot.swt.tester.ControlTester;
-

-

-public class SearchFavoritesViewTest extends DicoveryViewTestFixture

-{

-	private ISearchFavoritesViewCustomization viewCustomization;

-	private ITreeContentProvider favoritesContentProvider;

-	private ILabelProvider labelProvider;

-	private Object favoritesItemSource;

-	private Object firstFavoriteItem;

-	private Object secondFavoriteItem;

-	private Object favoritesGroup;

-	private SearchFavoritesView favoritesView;

-

-	private TreeViewer dragSourceViewer;

-	private ITreeContentProvider dragSourceContentProvider;

-	private IDiscoveryEnvironment discoveryEnv;

-	private IWorkbenchPartSite wbPartSite;

-	private IViewSite viewSite;

-

-	private final static String FAVORITES_LABEL = "This is the favorites view";

-

-	@Override

-	public Display setUpPDE() throws Exception

-	{

-		super.setUpPDE();

-

-		favoritesItemSource = new Object();

-		firstFavoriteItem = new Object();

-		secondFavoriteItem = new Object();

-		favoritesGroup = new Object();

-		wbPartSite = EasyMock.createMock(IWorkbenchPartSite.class);

-		viewSite = EasyMock.createMock(IViewSite.class);

-		

-		setupContentProvider();

-		setupLabelProvider();

-		

-		setupViewCustomization();

-		setupEnvironment();

-

-		return getDisplay();

-	}

-

-	private void setupEnvironment()

-	{

-		discoveryEnv = new IDiscoveryEnvironment()

-		{

-			public IErrorHandler errorHandler()

-			{

-				return EasyMock.createMock(IErrorHandler.class);

-			}

-

-			public ILongOperationRunner operationRunner()

-			{

-				return new ILongOperationRunner()

-				{

-					public <T> T run(ILongOperation<T> op) throws LongOpCanceledException, InvocationTargetException

-					{

-						try

-						{

-							return op.run(new NullProgressMonitor());

-						} catch (Exception e)

-						{

-							throw new InvocationTargetException(e);

-						}

-					}

-				};

-			}

-

-			public IProgressMonitor progressMonitor()

-			{

-				return new NullProgressMonitor();

-			}

-		};

-	}

-

-	private void setupLabelProvider()

-	{

-		labelProvider = new LabelProvider()

-		{

-			@Override

-			public String getText(Object element)

-			{

-				return element.toString();

-			}

-		};

-	}

-

-	private void setupContentProvider()

-	{

-		favoritesContentProvider = new ITreeContentProvider()

-		{

-			public Object[] getChildren(Object parentElement)

-			{

-				return new Object[0];

-			}

-

-			public Object getParent(Object element)

-			{

-				return null;

-			}

-

-			public boolean hasChildren(Object element)

-			{

-				return false;

-			}

-

-			public Object[] getElements(Object inputElement)

-			{

-				fail("Unexpected invocation");

-				return null;

-			}

-

-			public void dispose()

-			{

-			}

-

-			public void inputChanged(Viewer viewer, Object oldInput, Object newInput)

-			{

-				fail("Unexpected invocation");

-			}

-		};

-

-		dragSourceContentProvider = new ITreeContentProvider()

-		{

-

-			public Object[] getChildren(Object parentElement)

-			{

-				return new Object[0];

-			}

-

-			public Object getParent(Object element)

-			{

-				return null;

-			}

-

-			public boolean hasChildren(Object element)

-			{

-				return false;

-			}

-

-			public Object[] getElements(Object inputElement)

-			{

-				return new Object[] { favoritesItemSource };

-			}

-

-			public void dispose()

-			{

-			}

-

-			public void inputChanged(Viewer viewer, Object oldInput, Object newInput)

-			{

-			}

-		};

-	}

-

-	private void setupViewCustomization()

-	{

-		viewCustomization = new TestCustomization()

-		{

-			public ITreeContentProvider getContentProvider()

-			{

-				return favoritesContentProvider;

-			}

-

-			public ILabelProvider getLabelProvider()

-			{

-				return labelProvider;

-			}

-

-			public Set<Object> itemsFor(Object biSrc)

-			{

-				if(biSrc == favoritesItemSource)

-				{

-					return new HashSet<Object>(Arrays.asList(new Object[]{firstFavoriteItem, secondFavoriteItem}));

-				}

-				

-				return new HashSet<Object>(Arrays.asList(new Object[]{biSrc}));

-			}

-

-			@Override

-			public Object itemGroup(Object item)

-			{

-				return favoritesGroup;

-			}

-		};

-	}

-

-	private void openTestView()

-	{

-		testShell = createTestShell();

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				testShell.setLayout(new FillLayout(SWT.VERTICAL));

-				final Label l = new Label(testShell, SWT.NONE);

-				l.setText(FAVORITES_LABEL);

-

-				wbPartSite.setSelectionProvider(EasyMock.isA(ISelectionProvider.class));

-				EasyMock.expectLastCall();

-				EasyMock.replay(wbPartSite);

-				

-			

-				IActionBars actionBars = EasyMock.createNiceMock(IActionBars.class);

-				EasyMock.expect(viewSite.getActionBars()).andReturn(actionBars);

-				EasyMock.expect(actionBars.getToolBarManager()).andReturn(null);

-				EasyMock.replay(viewSite, actionBars);

-				

-				favoritesView = new SearchFavoritesView(){

-					@Override

-					public IWorkbenchPartSite getSite()

-					{

-						return wbPartSite;

-					}

-					

-					@Override

-					public IViewSite getViewSite()

-					{

-						return viewSite;

-					}

-				};

-				favoritesView.createPartControl(testShell);

-				favoritesView.setEnvironment(discoveryEnv);

-				dragSourceViewer = createDragSourceViewer(testShell);

-				testShell.layout(true, true);

-			}

-		});

-

-		getDisplay().asyncExec(new Runnable()

-		{

-			public void run()

-			{

-				testShell.open();

-				testShell.layout();

-			}

-		});

-

-		waitForShell(TEST_SHELL_TEXT);

-	}

-

-	private TreeViewer createDragSourceViewer(final Composite parent)

-	{

-		final TreeViewer viewer = new TreeViewer(parent, SWT.BORDER);

-		viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

-

-		viewer.setContentProvider(dragSourceContentProvider);

-		viewer.setLabelProvider(labelProvider);

-		viewer.addDragSupport(DND.DROP_COPY | DND.DROP_MOVE, new Transfer[] { LocalContextSelectionTransfer.getTransfer() }, new DragSourceAdapter()

-		{

-			@Override

-			public void dragSetData(DragSourceEvent event)

-			{

-				if(LocalContextSelectionTransfer.getTransfer().isSupportedType(event.dataType))

-				{

-					final IContextStructuredSelection selection = structuredSelection();

-					LocalContextSelectionTransfer.getTransfer().setSelection(selection);

-					event.data = selection;

-				}

-			}

-

-			@Override

-			public void dragStart(DragSourceEvent event)

-			{

-				event.doit = !dragSourceViewer.getSelection().isEmpty();

-				if(event.doit)

-				{

-					LocalContextSelectionTransfer.getTransfer().setSelection(structuredSelection());

-					LocalSelectionTransfer.getTransfer().setSelection(structuredSelection());

-				}

-			}

-			

-			@SuppressWarnings("unchecked")

-			private IContextStructuredSelection structuredSelection()

-			{

-				final Iterator<Object> it = ((IStructuredSelection)dragSourceViewer.getSelection()).iterator();

-				final List<Object> selectedObjects = new ArrayList<Object>();

-				while(it.hasNext())

-				{

-					selectedObjects.add(it.next());

-				}

-				final ISearchDestination destination = EasyMock.createNiceMock(ISearchDestination.class);

-			

-				final ISearchParameters parameters = EasyMock.createNiceMock(ISearchParameters.class);

-				EasyMock.expect(parameters.getSearchDestination()).andStubReturn(destination);

-				

-				final ISearchContext ctx = EasyMock.createNiceMock(ISearchContext.class);

-				EasyMock.expect(ctx.searchParameters()).andStubReturn(parameters);

-				EasyMock.replay(destination, parameters, ctx);

-				return new ContextStructuredSelection(selectedObjects, ctx);

-			}

-		});

-		viewer.setInput(new Object[0]);

-		viewer.refresh();

-

-		return viewer;

-	}

-

-	public void testViewIsBusyWhenOpened() throws NotFoundException, MultipleFoundException

-	{

-		openTestView();

-

-		// wait while the progress bar appears

-		waitFor(1000);

-		final ToolItem cancelButton = getMonitorCancelButton();

-		assertTrue("Cancel button not enabled", toolItemTester.getEnabled(cancelButton));

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				favoritesView.initializationCompleted();

-			}

-		});

-

-		final ControlTester cTester = ControlTester.getControlTester();

-		assertFalse("Cancel was not hidden", cTester.isVisible(getControl(cancelButton)));

-	}

-

-	public void testDragAndDrop() throws NotFoundException, MultipleFoundException

-	{

-		openTestView();

-		dragToFavoritesFromTestViewTest(false);

-	}

-

-	

-	private void dragToFavoritesFromTestViewTest(final boolean dragTo) throws NotFoundException, MultipleFoundException

-	{

-		final boolean[] itemAdded = new boolean[] { false };

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				favoritesView.registerViewCustomization(viewCustomization);

-				favoritesView.registerController(new ISearchFavoritesMasterController() 

-				{

-					@Override

-					public void importData(final Object data) {

-						itemAdded[0] = true;

-						if(dragTo)

-						{

-							getDisplay().syncExec(new Runnable()

-							{

-								@SuppressWarnings("unchecked")

-								@Override

-								public void run()

-								{

-									assertTrue(data instanceof IContextStructuredSelection);

-									final ContextStructuredSelection selection = (ContextStructuredSelection)data;

-									final Set<Object> affectedObjects = new HashSet<Object>();

-									affectedObjects.addAll(selection.toList());

-									favoritesView.showFavorites(affectedObjects);

-								}

-							});

-						}

-						else

-						{

-							assertTrue(data instanceof IContextStructuredSelection);

-							ContextStructuredSelection selection = (ContextStructuredSelection)data;

-							assertFalse(selection.isEmpty());

-							assertEquals(1, selection.size());

-						}

-					}

-					

-					@Override

-					public IDiscoveryEnvironment getEnvironment() {

-						return null;

-					}

-					

-					@Override

-					public void deleteItems(Set<Object> data) {

-					}

-

-					@Override

-					public boolean isImportPossible(Object data) {

-						return true;

-					}

-			

-				});

-				favoritesView.initializationCompleted();

-				favoritesView.showFavorites(new HashSet<Object>());

-				testShell.layout(true, true);

-			}

-		});

-

-		final Tree sourceTree = getDragSourceTree();

-		final Tree dropTargetTree = getSearchFavoritesTree();

-

-		final TreeItem[] sourceItems = treeTester.getItems(sourceTree);

-		assertEquals("One item expected", 1, sourceItems.length);

-

-		treeItemTester.actionClick(sourceItems[0]);

-		dragObject(sourceItems[0], dropTargetTree);

-		

-		Assertions.waitAssert(new IWaitCondition()

-		{

-			public boolean checkCondition() throws ConditionCheckException

-			{

-				return itemAdded[0];

-			}

-		}, "Item was not added");

-	}

-

-	private void dragObject(final Widget itemToDrag, final Widget destination)

-	{

-		treeItemTester.dragDrop(itemToDrag, destination, SWT.BUTTON1);

-	}

-

-	public void testDragFromSearchFavorites() throws NotFoundException, MultipleFoundException

-	{

-		openTestView();

-		dragToFavoritesFromTestViewTest(true);

-

-		final Set<Object> droppedObjects = new HashSet<Object>();

-		getDisplay().syncExec(new Runnable()

-		{

-			@Override

-			public void run()

-			{

-				dragSourceViewer.addDropSupport(DND.DROP_COPY | DND.DROP_MOVE, new Transfer[] { LocalSelectionTransfer.getTransfer() }, new DropTargetAdapter()

-				{

-					@SuppressWarnings("unchecked")

-					@Override

-					public void drop(DropTargetEvent event)

-					{

-						if(LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType))

-						{

-							final IStructuredSelection sel = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();

-							final Iterator<Object> it = sel.iterator();

-							while (it.hasNext())

-							{

-								droppedObjects.add(it.next());

-							}

-						}

-					}

-				});

-			}

-		});

-

-		final Tree destinationView = getDragSourceTree();

-		final Tree searchFavoritesTree = getSearchFavoritesTree();

-		final TreeItem ti = treeTester.getItems(searchFavoritesTree)[0];

-		dragObject(ti, destinationView);

-

-		Assertions.waitAssert(new IWaitCondition()

-		{

-			@Override

-			public boolean checkCondition() throws ConditionCheckException

-			{

-				return droppedObjects.size() == 1 && droppedObjects.contains(treeItemTester.getData(ti));

-			}

-		}, "item not dropped");

-	}

-	

-	private Control getControl(final ToolItem ti)

-	{

-		final Control[] result = new Control[1];

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				result[0] = ti.getParent();

-			}

-		});

-		return result[0];

-	}

-

-	private Tree getSearchFavoritesTree() throws NotFoundException, MultipleFoundException

-	{

-		return (Tree) FINDER.find(new SiblingTextMatcher(FAVORITES_LABEL, null, Tree.class));

-	}

-

-	private Tree getDragSourceTree()

-	{

-		return dragSourceViewer.getTree();

-	}

-	

-	private abstract class TestCustomization extends GenericViewCustomizationImpl implements ISearchFavoritesViewCustomization

-	{

-	}

-}

+public class SearchFavoritesViewTest
+{
+	private static SearchConsoleTestFixture fixture;
+	
+	private ISearchFavoritesViewCustomization viewCustomization;
+	private ITreeContentProvider dragHelperViewerContentProvider;
+	private ITreeContentProvider favoritesContentProvider;
+	private ILabelProvider labelProvider;
+
+	private Object favoritesItemSource;
+	private Object firstFavoriteItem;
+	private Object secondFavoriteItem;
+	private Object favoritesGroup;
+
+	private SearchFavoritesPageObject searchFavorites;
+	private IDiscoveryEnvironment environment;
+
+	@BeforeClass
+	public static void initFixture()
+	{
+		fixture = new SearchConsoleTestFixture();
+	}
+	
+	@Before
+	public void setUp()
+	{
+		favoritesItemSource = new String("favoritesItemSource");
+		firstFavoriteItem = new String("firstFavoriteItem");
+		secondFavoriteItem = new String("secondFavoriteItem");
+		favoritesGroup = new String("favoritesGroup");
+
+		setupContentProvider();
+		setupLabelProvider();
+		setupViewCustomization();
+
+		environment = fixture.environment;
+		searchFavorites = new SearchFavoritesPageObject(viewCustomization, dragHelperViewerContentProvider, environment);
+		searchFavorites.open();
+	}
+
+	@After
+	public void tearDown()
+	{
+		searchFavorites.close();
+	}
+
+	private void setupLabelProvider()
+	{
+		labelProvider = Mockito.mock(ILabelProvider.class);
+		Mockito.stub(labelProvider.getText(Mockito.any())).toAnswer(new Answer<String>()
+		{
+			@Override
+			public String answer(InvocationOnMock invocation) throws Throwable
+			{
+				return invocation.getArguments()[0].toString();
+			}
+		});
+	}
+
+	private void setupContentProvider()
+	{
+		favoritesContentProvider = Mockito.mock(ITreeContentProvider.class);
+		Mockito.stub(favoritesContentProvider.getChildren(Mockito.any())).toReturn(new Object[0]);
+		Mockito.stub(favoritesContentProvider.getParent(Mockito.any())).toReturn(null);
+		Mockito.stub(favoritesContentProvider.hasChildren(Mockito.any())).toReturn(false);
+
+		dragHelperViewerContentProvider = Mockito.mock(ITreeContentProvider.class);
+		Mockito.stub(dragHelperViewerContentProvider.getChildren(Mockito.any())).toReturn(new Object[0]);
+		Mockito.stub(dragHelperViewerContentProvider.getParent(Mockito.any())).toReturn(null);
+		Mockito.stub(dragHelperViewerContentProvider.hasChildren(Mockito.any())).toReturn(false);
+		Mockito.stub(dragHelperViewerContentProvider.getElements(Mockito.any())).toReturn(new Object[] { firstFavoriteItem, secondFavoriteItem });
+	}
+
+	private void setupViewCustomization()
+	{
+		viewCustomization = Mockito.mock(ISearchFavoritesViewCustomization.class);
+		Mockito.stub(viewCustomization.getContentProvider()).toReturn(favoritesContentProvider);
+		Mockito.stub(viewCustomization.getLabelProvider()).toReturn(labelProvider);
+		Mockito.stub(viewCustomization.itemGroup(Mockito.any())).toReturn(favoritesGroup);
+		Mockito.stub(viewCustomization.itemsFor(Mockito.any())).toAnswer(new Answer<Set<Object>>()
+		{
+			@Override
+			public Set<Object> answer(InvocationOnMock invocation) throws Throwable
+			{
+				final Object biSrc = invocation.getArguments()[0];
+				if (biSrc == favoritesItemSource)
+				{
+					return new HashSet<Object>(Arrays.asList(new Object[] { firstFavoriteItem, secondFavoriteItem }));
+				}
+
+				return new HashSet<Object>(Arrays.asList(new Object[] { biSrc }));
+			}
+		});
+	}
+
+	@Test
+	public void testViewIsBusyWhenOpened()
+	{
+		Assert.assertTrue("Operation is not running", searchFavorites.isOperationRunning());
+		searchFavorites.completeInitialization();
+		Assert.assertFalse("Operation is still running", searchFavorites.isOperationRunning());
+	}
+
+	@Test
+	public void testDragToFavorites()
+	{
+		searchFavorites.registerController(new FavoritesController());
+		searchFavorites.dragToFavorites(firstFavoriteItem);
+		Assert.assertTrue("Grouping item not displayed", searchFavorites.isFavoritesRootItemDisplayed(favoritesGroup));
+		Assert.assertTrue("First favorite item not displayed", searchFavorites.isFavoritesItemDisplayed(firstFavoriteItem, favoritesGroup));
+	}
+
+	@Test
+	public void testDragFromFavorites()
+	{
+		searchFavorites.registerController(new FavoritesController());
+		final Set<Object> favoritesToShow = new HashSet<Object>();
+		favoritesToShow.add(firstFavoriteItem);
+		searchFavorites.showFavorites(favoritesToShow);
+
+		final Collection<Object> droppedObjects = new ArrayList<Object>();
+		searchFavorites.getDragHelper().addDropSupport(DND.DROP_COPY | DND.DROP_MOVE, new Transfer[] { LocalSelectionTransfer.getTransfer() }, new DropTargetAdapter()
+		{
+			@SuppressWarnings("unchecked")
+			@Override
+			public void drop(DropTargetEvent event)
+			{
+				if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType))
+				{
+					final IStructuredSelection sel = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
+					final Iterator<Object> it = sel.iterator();
+					while (it.hasNext())
+					{
+						droppedObjects.add(it.next());
+					}
+				}
+			}
+		});
+		searchFavorites.dragFromFavorites(favoritesGroup, firstFavoriteItem);
+		Assert.assertEquals("One dropped item expected", 1, droppedObjects.size());
+		Assert.assertEquals("Unexpected item dropped", firstFavoriteItem, droppedObjects.iterator().next());
+	}
+
+	private class FavoritesController implements ISearchFavoritesMasterController
+	{
+		@Override
+		public IDiscoveryEnvironment getEnvironment()
+		{
+			return environment;
+		}
+
+		@Override
+		public void deleteItems(Set<Object> data)
+		{
+		}
+
+		@SuppressWarnings("unchecked")
+		@Override
+		public void importData(Object data)
+		{
+			Assert.assertTrue(data instanceof IContextStructuredSelection);
+			final ContextStructuredSelection selection = (ContextStructuredSelection) data;
+			final Set<Object> affectedObjects = new HashSet<Object>();
+			affectedObjects.addAll(selection.toList());
+			searchFavorites.showFavorites(affectedObjects);
+		}
+
+		@Override
+		public boolean isImportPossible(Object data)
+		{
+			return true;
+		}
+	}
+}
diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SubdestinationsSelectedListenerTest.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SubdestinationsSelectedListenerTest.java
deleted file mode 100644
index 97d1fb4..0000000
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SubdestinationsSelectedListenerTest.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.platform.discovery.ui.test.comp.internal;

-

-import java.util.Arrays;
-import java.util.List;
-
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.eclipse.platform.discovery.runtime.api.ISearchDestination;
-import org.eclipse.platform.discovery.runtime.api.ISearchSubdestination;
-import org.eclipse.platform.discovery.runtime.internal.ISearchProviderConfiguration;
-import org.eclipse.platform.discovery.runtime.internal.ProviderNotFoundException;
-import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IDestinationCategoryDescription;
-import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IObjectTypeDescription;
-import org.eclipse.platform.discovery.runtime.internal.model.descriptions.ISearchProviderDescription;
-import org.eclipse.platform.discovery.testutils.utils.abbot.AbstractUITest;
-import org.eclipse.platform.discovery.testutils.utils.abbot.IAbbotTestUiStarter;
-import org.eclipse.platform.discovery.testutils.utils.abbot.matchers.EnhancedTextMatcher;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.Assertions;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.ConditionCheckException;
-import org.eclipse.platform.discovery.testutils.utils.junit.util.assertions.IWaitCondition;
-import org.eclipse.platform.discovery.ui.api.ISearchParametersUI.IConsoleContext;
-import org.eclipse.platform.discovery.ui.internal.view.impl.SubdestinationsSelectedListener;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-import abbot.swt.tester.ButtonTester;
-import abbot.swt.tester.ShellTester;
-

-

-public class SubdestinationsSelectedListenerTest extends AbstractUITest

-{

-	private ISearchProviderConfiguration providerConfiguration;

-	private IObjectTypeDescription searchObjectType;

-	private IDestinationCategoryDescription destinationCategory;

-	private ISearchProviderDescription searchProviderDescription;

-	private ISearchSubdestination subDestination_1;

-	private ISearchSubdestination subDestination_2;

-	private ISearchSubdestination subDestination_3;

-

-	private static final String SUBDESTINATION_NAME_1 = "Subdestination 1";

-	private static final String SUBDESTINATION_NAME_2 = "Subdestination 2";

-	private static final String SUBDESTINATION_NAME_3 = "Subdestination 3";

-

-	private ISearchDestination searchDestination;

-

-	private SubdestinationsSelectedListener testListener;

-	

-	private ChangeChecker changeChecker;

-	private FormToolkit formToolkit;

-

-	@Override

-	protected IAbbotTestUiStarter getUiStarter()

-	{

-		return new IAbbotTestUiStarter()

-		{

-			public void closeEnclosingDialog(Display display)

-			{

-				TESTER.key(SWT.ESC);

-			}

-		};

-	}

-

-	@Override

-	public Display setUpPDE() throws Exception

-	{

-		super.setUpPDE();

-

-		searchObjectType = EasyMock.createNiceMock(IObjectTypeDescription.class);

-		destinationCategory = EasyMock.createNiceMock(IDestinationCategoryDescription.class);

-		searchDestination = EasyMock.createNiceMock(ISearchDestination.class);

-		changeChecker = new ChangeChecker(null, null, null, false){

-			public void checkChange(IObjectTypeDescription searchObjectType, ISearchDestination searchDestination, ISearchSubdestination subDestination, boolean newActivationState) {

-				

-			};

-		};

-

-		setupSubdestinations();

-		setupProviderConfiguration();

-

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				formToolkit = new FormToolkit(getDisplay());

-				testListener = createTestedListener(activeShell(), formToolkit);

-			}

-		});

-

-		return getDisplay();

-	}

-

-	@Override

-	public void tearDownPDE() throws Exception

-	{

-		super.tearDownPDE();

-		formToolkit.dispose();

-	}

-	

-	private SubdestinationsSelectedListener createTestedListener(final Control parent, final FormToolkit formToolkit)

-	{
-		final IConsoleContext context = EasyMock.createMock(IConsoleContext.class);
-		EasyMock.expect(context.destinationCategory()).andStubReturn(destinationCategory);
-		EasyMock.expect(context.searchDestination()).andStubReturn(searchDestination);
-		EasyMock.expect(context.searchProvider()).andStubReturn(searchProviderDescription);
-		EasyMock.expect(context.searchProviderConfiguration()).andStubReturn(providerConfiguration);
-		EasyMock.expect(context.selectedObjectType()).andStubReturn(searchObjectType);
-		context.notifyComplete(EasyMock.anyBoolean());
-		EasyMock.expectLastCall().asStub();
-		
-		// The mocked context expects notifySubdestinationActivationChange calls and verifies input parameters via changeChecker
-		context.notifySubdestinationActivationChange(EasyMock.isA(ISearchSubdestination.class), EasyMock.anyBoolean());
-		EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
-			@Override
-			public Object answer() throws Throwable {
-				final ISearchSubdestination subDestination = (ISearchSubdestination)EasyMock.getCurrentArguments()[0];
-				final boolean newState = (Boolean)EasyMock.getCurrentArguments()[1];
-				changeChecker.checkChange(searchObjectType, searchDestination, subDestination, newState);
-				return null;
-			}
-		});
-		EasyMock.replay(context);
-		
-		return new SubdestinationsSelectedListener(parent, context);
-	}

-

-	private void setupSubdestinations()

-	{

-		subDestination_1 = EasyMock.createNiceMock(ISearchSubdestination.class);

-		EasyMock.expect(subDestination_1.getDisplayName()).andStubReturn(SUBDESTINATION_NAME_1);

-		subDestination_2 = EasyMock.createNiceMock(ISearchSubdestination.class);

-		EasyMock.expect(subDestination_2.getDisplayName()).andStubReturn(SUBDESTINATION_NAME_2);

-		subDestination_3 = EasyMock.createNiceMock(ISearchSubdestination.class);

-		EasyMock.expect(subDestination_3.getDisplayName()).andStubReturn(SUBDESTINATION_NAME_3);

-

-		EasyMock.replay(subDestination_1, subDestination_2, subDestination_3);

-	}

-

-	private void setupProviderConfiguration() throws ProviderNotFoundException

-	{

-		searchProviderDescription = EasyMock.createNiceMock(ISearchProviderDescription.class);

-		providerConfiguration = EasyMock.createNiceMock(ISearchProviderConfiguration.class);

-

-		final List<ISearchSubdestination> subDestinations = Arrays.asList(new ISearchSubdestination[] { subDestination_1, subDestination_2, subDestination_3 });

-		EasyMock.expect(providerConfiguration.getAvailableSearchSubdestinations(searchObjectType, destinationCategory, searchProviderDescription)).andStubReturn(subDestinations);
-		

-		EasyMock.replay(searchProviderDescription);

-	}

-

-	private void providerConfigurationDone()

-	{

-		EasyMock.replay(providerConfiguration);

-	}

-

-	private SelectionEvent createSelectionEvent()

-	{

-		final Shell s = activeShell();

-		final Rectangle rect = ShellTester.getShellTester().getClientArea(s);

-		final Event e = new Event();

-		e.x = rect.x + (rect.width / 2);

-		e.y = rect.y + (rect.height / 2);

-		e.widget = s;

-

-		return new SelectionEvent(e);

-	}

-	

-	private Shell getCurrentActiveShell()

-	{

-		final Shell[] result = new Shell[1];

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-				result[0] = getDisplay().getActiveShell();

-			}

-		});

-		

-		return result[0];

-	}

-	

-	private Shell activeShell()

-	{

-		final Shell[] result = new Shell[1];

-		Assertions.waitAssert(new IWaitCondition()

-		{

-			

-			@Override

-			public boolean checkCondition() throws ConditionCheckException

-			{

-				result[0] = getCurrentActiveShell();

-				return result[0] != null;

-			}

-		}, "Could not find active shell");

-		

-		return result[0];

-	}

-

-	private void widgetSelected(final SubdestinationsSelectedListener listener, final SelectionEvent event)

-	{

-		getDisplay().syncExec(new Runnable()

-		{

-

-			public void run()

-			{

-				listener.widgetSelected(event);

-			}

-		});

-	}

-

-	public void testAllSubdestinationsAreShown() throws NotFoundException, MultipleFoundException

-	{

-		EasyMock.expect(providerConfiguration.isSubdestinationActive(subDestination_1, searchObjectType, destinationCategory, searchProviderDescription)).andStubReturn(true);

-		EasyMock.expect(providerConfiguration.isSubdestinationActive(subDestination_2, searchObjectType, destinationCategory, searchProviderDescription)).andStubReturn(false);

-		EasyMock.expect(providerConfiguration.isSubdestinationActive(subDestination_3, searchObjectType, destinationCategory, searchProviderDescription)).andStubReturn(true);

-		providerConfigurationDone();

-		widgetSelected(testListener, createSelectionEvent());

-

-		FINDER.find(new EnhancedTextMatcher(SUBDESTINATION_NAME_1));

-		FINDER.find(new EnhancedTextMatcher(SUBDESTINATION_NAME_2));

-		FINDER.find(new EnhancedTextMatcher(SUBDESTINATION_NAME_3));

-	}

-

-	public void testInitiallySelectedSubdestinationsAreChecked() throws NotFoundException, MultipleFoundException

-	{

-		EasyMock.expect(providerConfiguration.isSubdestinationActive(subDestination_1, searchObjectType, destinationCategory, searchProviderDescription)).andStubReturn(true);

-		EasyMock.expect(providerConfiguration.isSubdestinationActive(subDestination_2, searchObjectType, destinationCategory, searchProviderDescription)).andStubReturn(true);

-		EasyMock.expect(providerConfiguration.isSubdestinationActive(subDestination_3, searchObjectType, destinationCategory, searchProviderDescription)).andStubReturn(false);

-		providerConfigurationDone();

-		widgetSelected(testListener, createSelectionEvent());

-

-		final Button subdestB1 = (Button) FINDER.find(new EnhancedTextMatcher(SUBDESTINATION_NAME_1));

-		assertTrue("Subdestination 1 should be selected", this.isSelected(subdestB1));

-		final Button subdestB2 = (Button) FINDER.find(new EnhancedTextMatcher(SUBDESTINATION_NAME_2));

-		assertTrue("Subdestination 2 should be selected", this.isSelected(subdestB2));

-		final Button subdestB3 = (Button) FINDER.find(new EnhancedTextMatcher(SUBDESTINATION_NAME_3));

-		assertFalse("Subdestination 3 should not be selected", this.isSelected(subdestB3));

-	}

-

-	public void testSelectingSubdestinations() throws NotFoundException, MultipleFoundException

-	{

-		EasyMock.expect(providerConfiguration.isSubdestinationActive(subDestination_1, searchObjectType, destinationCategory, searchProviderDescription)).andStubReturn(true);

-		EasyMock.expect(providerConfiguration.isSubdestinationActive(subDestination_3, searchObjectType, destinationCategory, searchProviderDescription)).andStubReturn(false);

-

-		providerConfigurationDone();

-		widgetSelected(testListener, createSelectionEvent());

-

-		final ButtonTester tester = ButtonTester.getButtonTester();

-		final Button subdestB1 = (Button) FINDER.find(new EnhancedTextMatcher(SUBDESTINATION_NAME_1));

-		final Button subdestB3 = (Button) FINDER.find(new EnhancedTextMatcher(SUBDESTINATION_NAME_3));

-		tester.actionClick(subdestB1);

-		tester.actionClick(subdestB3);

-

-		EasyMock.verify(providerConfiguration);

-	}

-

-	public void testSubdestChangeListenerNotifiedOnSubdestSelection() throws NotFoundException, MultipleFoundException

-	{

-		EasyMock.expect(providerConfiguration.isSubdestinationActive(subDestination_1, searchObjectType, destinationCategory, searchProviderDescription)).andStubReturn(false);

-

-		changeChecker = new ChangeChecker(searchObjectType, searchDestination, subDestination_1, true);

-		providerConfigurationDone();

-		widgetSelected(testListener, createSelectionEvent());

-		final ButtonTester tester = ButtonTester.getButtonTester();

-		final Button subdestB1 = (Button) FINDER.find(new EnhancedTextMatcher(SUBDESTINATION_NAME_1));

-		tester.actionClick(subdestB1);

-		forceAsynchronousEventsToBeProcessed();

-

-		assertTrue("Event was not handled", changeChecker.changeChecked());

-	}

-

-	private void forceAsynchronousEventsToBeProcessed() {

-		getDisplay().syncExec(new Runnable()

-		{

-			public void run()

-			{

-			}

-		});

-	}

-

-	

-	public void testSelectWithConflicting() throws NotFoundException, MultipleFoundException{

-		EasyMock.expect(providerConfiguration.isSubdestinationActive(subDestination_1, searchObjectType, destinationCategory, searchProviderDescription)).andReturn(true);

-		EasyMock.expect(providerConfiguration.isSubdestinationActive(subDestination_2, searchObjectType, destinationCategory, searchProviderDescription)).andReturn(false);

-		

-		providerConfigurationDone();

-		

-		widgetSelected(testListener, createSelectionEvent());

-		

-		final ButtonTester tester = ButtonTester.getButtonTester();

-		Button subd1 = (Button) FINDER.find(new EnhancedTextMatcher(SUBDESTINATION_NAME_1));

-		Button subd2 = (Button) FINDER.find(new EnhancedTextMatcher(SUBDESTINATION_NAME_2));

-		tester.actionClick(subd2);

-		forceAsynchronousEventsToBeProcessed();

-		

-		assertFalse("Button for subd1 should be deselected because it conflicts with subd2",tester.getSelection(subd1));

-		assertTrue("Button for subd2 should be selected", tester.getSelection(subd2));

-	}

-	

-	

-

-	private class ChangeChecker

-	{

-		private final ISearchDestination expectedDest;

-		private final IObjectTypeDescription expectedObjType;

-		private final ISearchSubdestination expectedSubDest;

-		private final boolean expectedState;

-		private boolean checked;

-

-		public ChangeChecker(final IObjectTypeDescription expectedObjType, final ISearchDestination expectedDest, final ISearchSubdestination expectedSubDest, final boolean expectedState)

-		{

-			this.expectedDest = expectedDest;

-			this.expectedObjType = expectedObjType;

-			this.expectedSubDest = expectedSubDest;

-			this.expectedState = expectedState;

-			checked = false;

-		}

-

-		public void checkChange(final IObjectTypeDescription searchObjectType, final ISearchDestination searchDestination, final ISearchSubdestination subDestination, final boolean newActivationState)

-		{

-			assertSame("Unexpected object type", this.expectedObjType, searchObjectType);

-			assertSame("Unexpected search destination", this.expectedDest, searchDestination);

-			assertSame("Unexpected subdestination", this.expectedSubDest, subDestination);

-			assertSame("Unexpected state", this.expectedState, newActivationState);

-			checked = true;

-		}

-		

-		public boolean changeChecked()

-		{

-			return checked;

-		}

-		

-	}

-}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SubdestinationsSelectorTest.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SubdestinationsSelectorTest.java
new file mode 100644
index 0000000..c94ee55
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/SubdestinationsSelectorTest.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.platform.discovery.ui.test.comp.internal;
+
+import java.text.MessageFormat;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.eclipse.platform.discovery.runtime.api.ISearchDestination;
+import org.eclipse.platform.discovery.runtime.api.ISearchSubdestination;
+import org.eclipse.platform.discovery.runtime.internal.ISearchProviderConfiguration;
+import org.eclipse.platform.discovery.runtime.internal.ProviderNotFoundException;
+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IDestinationCategoryDescription;
+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IObjectTypeDescription;
+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.ISearchProviderDescription;
+import org.eclipse.platform.discovery.ui.api.ISearchParametersUI.IConsoleContext;
+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.SubdestinationsSelectorPageObject;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+public class SubdestinationsSelectorTest
+{
+	@Mock
+	private ISearchProviderConfiguration providerConfiguration;
+	@Mock
+	private IObjectTypeDescription searchObjectType;
+	@Mock
+	private IDestinationCategoryDescription destinationCategory;
+	@Mock
+	private ISearchProviderDescription searchProviderDescription;
+	@Mock
+	private ISearchSubdestination subDestination_1;
+	@Mock
+	private ISearchSubdestination subDestination_2;
+	@Mock
+	private ISearchSubdestination subDestination_3;
+	@Mock
+	private ISearchDestination searchDestination;
+
+	private static final String SUBDESTINATION_NAME_1 = "Subdestination 1";
+	private static final String SUBDESTINATION_NAME_2 = "Subdestination 2";
+	private static final String SUBDESTINATION_NAME_3 = "Subdestination 3";
+
+	private SubdestinationsSelectorPageObject subdestinationsSelector;
+
+	private Map<ISearchSubdestination, Boolean> subdestinationsActivationState;
+
+	@Before
+	public void setUp() throws ProviderNotFoundException
+	{
+		MockitoAnnotations.initMocks(this);
+		
+		subdestinationsActivationState = new HashMap<ISearchSubdestination, Boolean>();
+		setupSubdestinations();
+		setupProviderConfiguration();
+		subdestinationsSelector = new SubdestinationsSelectorPageObject(createConsoleContext());
+	}
+
+	@After
+	public void tearDown()
+	{
+		subdestinationsSelector.close();
+	}
+
+	private IConsoleContext createConsoleContext()
+	{
+		final IConsoleContext context = Mockito.mock(IConsoleContext.class);
+		Mockito.stub(context.destinationCategory()).toReturn(destinationCategory);
+		Mockito.stub(context.searchDestination()).toReturn(searchDestination);
+		Mockito.stub(context.searchProvider()).toReturn(searchProviderDescription);
+		Mockito.stub(context.searchProviderConfiguration()).toReturn(providerConfiguration);
+		Mockito.stub(context.selectedObjectType()).toReturn(searchObjectType);
+		Mockito.doAnswer(new ActivationChangeAnswer()).when(context).notifySubdestinationActivationChange(Mockito.isA(ISearchSubdestination.class), Mockito.anyBoolean());
+
+		return context;
+	}
+
+	private void setupSubdestinations()
+	{
+		Mockito.stub(subDestination_1.getDisplayName()).toReturn(SUBDESTINATION_NAME_1);
+		Mockito.stub(subDestination_2.getDisplayName()).toReturn(SUBDESTINATION_NAME_2);
+		Mockito.stub(subDestination_3.getDisplayName()).toReturn(SUBDESTINATION_NAME_3);
+	}
+
+	private void setupProviderConfiguration() throws ProviderNotFoundException
+	{
+		final List<ISearchSubdestination> subDestinations = Arrays.asList(new ISearchSubdestination[] { subDestination_1, subDestination_2, subDestination_3 });
+		Mockito.stub(providerConfiguration.getAvailableSearchSubdestinations(searchObjectType, destinationCategory, searchProviderDescription)).toReturn(subDestinations);
+		Mockito.when(providerConfiguration.isSubdestinationActive(Mockito.isA(ISearchSubdestination.class), Mockito.same(searchObjectType), Mockito.same(destinationCategory), Mockito.same(searchProviderDescription))).thenAnswer(new Answer<Boolean>()
+		{
+			@Override
+			public Boolean answer(InvocationOnMock invocation) throws Throwable
+			{
+				final ISearchSubdestination subdest = (ISearchSubdestination) invocation.getArguments()[0];
+				final Boolean isActive = subdestinationsActivationState.get(subdest);
+				return isActive == null ? false : isActive;
+			}
+		});
+
+	}
+
+	@Test
+	public void testAllSubdestinationsAreShown()
+	{
+		subdestinationsSelector.open();
+
+		verifySubdestinationDisplayed(SUBDESTINATION_NAME_1);
+		verifySubdestinationDisplayed(SUBDESTINATION_NAME_2);
+		verifySubdestinationDisplayed(SUBDESTINATION_NAME_3);
+	}
+
+	@Test
+	public void testInitiallySelectedSubdestinationsAreChecked()
+	{
+		setActive(subDestination_1, true);
+		setActive(subDestination_2, false);
+		setActive(subDestination_3, true);
+		subdestinationsSelector.open();
+
+		Assert.assertTrue("Subdestination 1 should be selected", subdestinationsSelector.isSelected(SUBDESTINATION_NAME_1));
+		Assert.assertFalse("Subdestination 2 should be selected", subdestinationsSelector.isSelected(SUBDESTINATION_NAME_2));
+		Assert.assertTrue("Subdestination 3 should not be selected", subdestinationsSelector.isSelected(SUBDESTINATION_NAME_3));
+	}
+
+	@Test
+	public void testToggleSelectedSubdestination()
+	{
+		setActive(subDestination_1, true);
+		subdestinationsSelector.open();
+
+		subdestinationsSelector.toggle(SUBDESTINATION_NAME_1);
+		verifySubdestinationActivationSet(subDestination_1, false);
+	}
+
+	@Test
+	public void testToggleUnselectedSubdestinations()
+	{
+		setActive(subDestination_3, false);
+		subdestinationsSelector.open();
+
+		subdestinationsSelector.toggle(SUBDESTINATION_NAME_3);
+		verifySubdestinationActivationSet(subDestination_3, true);
+	}
+
+	@Test
+	public void testSelectWithConflicting()
+	{
+		setActive(subDestination_1, true);
+		setActive(subDestination_2, false);
+		subdestinationsSelector.open();
+
+		subdestinationsSelector.toggle(SUBDESTINATION_NAME_2);
+
+		Assert.assertFalse("Button for subd1 should be deselected because it conflicts with subd2", subdestinationsSelector.isSelected(SUBDESTINATION_NAME_1));
+		Assert.assertTrue("Button for subd2 should be selected", subdestinationsSelector.isSelected(SUBDESTINATION_NAME_2));
+	}
+
+	private void verifySubdestinationDisplayed(final String subdestinationName)
+	{
+		Assert.assertTrue(MessageFormat.format("Subdestination {0} not displayed", subdestinationName), subdestinationsSelector.isDisplayed(subdestinationName));
+	}
+
+	private void verifySubdestinationActivationSet(final ISearchSubdestination subDestination, final Boolean expectedState)
+	{
+		Assert.assertEquals(MessageFormat.format("Unexpected subdestination {0} activation state", subDestination.getDisplayName()), expectedState, subdestinationsActivationState.get(subDestination));
+	}
+	
+	private void setActive(final ISearchSubdestination subd, final boolean activationState)
+	{
+		subdestinationsActivationState.put(subd, activationState);
+	}
+
+	private class ActivationChangeAnswer implements Answer<Void>
+	{
+		@Override
+		public Void answer(InvocationOnMock invocation) throws Throwable
+		{
+			final ISearchSubdestination subdest = (ISearchSubdestination) invocation.getArguments()[0];
+			subdestinationsActivationState.put(subdest, (Boolean) invocation.getArguments()[1]);
+			// simulate subdestination_2 conflict with subdestination_1
+			if(subdest == subDestination_2)
+			{
+				subdestinationsActivationState.put(subDestination_1, false);
+			}
+			return null;
+		}
+	}
+}
diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/TextControlTest.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/TextControlTest.java
index 73b05bb..26e4a13 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/TextControlTest.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/TextControlTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 SAP AG, Walldorf.
+ * Copyright (c) 2010, 2011 SAP AG, Walldorf.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -17,9 +17,6 @@
 import org.junit.Before;
 import org.junit.Test;
 
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-
 public class TextControlTest
 {
 	private TextControlPageObject textControl;
@@ -38,7 +35,7 @@
 	}
 
 	@Test
-	public void testTextIsRestoredWhenControlIsEnabled() throws NotFoundException, MultipleFoundException
+	public void testTextIsRestoredWhenControlIsEnabled()
 	{
 		final String testText = "12345_6789";
 		textControl.enterText(testText);
@@ -55,7 +52,7 @@
 	}
 
 	@Test
-	public void testTextMessageAmongEnabledStates() throws NotFoundException, MultipleFoundException
+	public void testTextMessageAmongEnabledStates()
 	{
 		final String message = "MyMessage";
 		textControl.setMessage(message);
diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/fixture/SearchConsoleTestFixture.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/fixture/SearchConsoleTestFixture.java
new file mode 100644
index 0000000..8a77daa
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/fixture/SearchConsoleTestFixture.java
@@ -0,0 +1,404 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.platform.discovery.ui.test.comp.internal.fixture;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.platform.discovery.core.internal.ISearchSession;
+import org.eclipse.platform.discovery.runtime.api.GroupingHierarchy;
+import org.eclipse.platform.discovery.runtime.api.IDestinationsProvider;
+import org.eclipse.platform.discovery.runtime.api.ISearchDestination;
+import org.eclipse.platform.discovery.runtime.api.ISearchProvider;
+import org.eclipse.platform.discovery.runtime.api.ISearchSubdestination;
+import org.eclipse.platform.discovery.runtime.internal.DestinationCategoryNotFoundException;
+import org.eclipse.platform.discovery.runtime.internal.ISearchProviderConfiguration;
+import org.eclipse.platform.discovery.runtime.internal.ProviderNotFoundException;
+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IDestinationCategoryDescription;
+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IDestinationsProviderDescription;
+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IObjectTypeDescription;
+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.ISearchProviderDescription;
+import org.eclipse.platform.discovery.testutils.utils.model.DestProviderDescriptionBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.DestinationCategoryDescriptionBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.DestinationsProviderBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.ObjectTypeDescriptionBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.SearchDestinationBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.SearchProviderBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.SearchProviderDescriptionBuilder;
+import org.eclipse.platform.discovery.testutils.utils.model.SubdestinationBuilder;
+import org.eclipse.platform.discovery.ui.api.IViewUiContext;
+import org.eclipse.platform.discovery.util.api.env.IDiscoveryEnvironment;
+import org.eclipse.platform.discovery.util.api.env.IErrorHandler;
+import org.eclipse.platform.discovery.util.api.longop.ILongOperationRunner;
+import org.eclipse.platform.discovery.util.internal.session.ISessionManager;
+import org.junit.BeforeClass;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+
+/**
+ * Search console tests fixture. The fuxture contains lots of mocks which initialization takes some time. Therefore be advised that it is a good idea
+ * to instantiate the fixture in a {@link BeforeClass} annotated method
+ * 
+ * @author Danail Branekov
+ */
+public class SearchConsoleTestFixture
+{
+	public static final String TEST_SEARCH_DEST_PROVIDER_PREFERENCE_PAGE_ID = "org.eclipse.platform.discovery.ui.test.comp.page1";
+
+	public final static int VIEWERS_OFFSET = 60;
+
+	private final String OBJECT_TYPE_ID1 = "org.eclipse.platform.discovery.objecttype1";
+	private final String OBJECT_TYPE_ID2 = "org.eclipse.platform.discovery.objecttype2";
+	private final String OBJECT_TYPE_ID3 = "org.eclipse.platform.discovery.objecttype3";
+	private final String OBJECT_TYPE_NO_DESTINATIONS_ID = "org.eclipse.platform.discovery.nodestinations_objecttype";
+	private final String OBJECT_TYPE_NAME_1 = "First object type";
+	private final String OBJECT_TYPE_NAME_2 = "Second object type";
+	private final String OBJECT_TYPE_NAME_3 = "Third object type";
+	private final String OBJECT_TYPE_NO_DESTINATIONS_NAME = "Destination-less object type";
+
+	public IObjectTypeDescription objectType1;
+	public IObjectTypeDescription objectType2;
+	public IObjectTypeDescription objectType3;
+	public IObjectTypeDescription objectTypeNoDestinations;
+
+	public IDestinationsProviderDescription destProviderDescr_cat1;
+	public IDestinationsProviderDescription destProviderDescr_cat2;
+	public IDestinationsProviderDescription destProviderDescr_cat3;
+
+	public IDestinationsProvider destProvider_cat1;
+	public IDestinationsProvider destProvider_cat2;
+	public IDestinationsProvider destProvider_cat3;
+
+	private final String DESTINATION_NAME1 = "First destination";
+	private final String DESTINATION_NAME2 = "Second destination";
+	private final String DESTINATION_NAME3 = "Third destination";
+	private final String DESTINATION_NAME4 = "Fourth destination";
+	private final String DESTINATION_NAME5 = "Fifth destination";
+
+	public ISearchDestination destination1;
+	public ISearchDestination destination2;
+	public ISearchDestination destination3;
+	public ISearchDestination destination4;
+	public ISearchDestination destination5;
+
+	private final static String CATEGORY_ID_1 = "category1";
+	private final static String CATEGORY_ID_2 = "category2";
+	private final static String CATEGORY_ID_3 = "category3";
+	private final static String CATEGORY_NAME_1 = "First category";
+	private final static String CATEGORY_NAME_2 = "Second category";
+	private final static String CATEGORY_NAME_3 = "Third category";
+
+	public IDestinationCategoryDescription category1;
+	public IDestinationCategoryDescription category2;
+	public IDestinationCategoryDescription category3;
+
+	private static final String SUBDESTINATION_NAME_1 = "Subdestination 1";
+	private static final String SUBDESTINATION_NAME_2 = "Subdestination 2";
+
+	public ISearchSubdestination subdestination1;
+	public ISearchSubdestination subdestination2;
+	public Map<ISearchSubdestination, Boolean> subdestinationsActivityMap;
+
+	private final static String SUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID = "SUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID";
+	private final static String UNSUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID = "UNSUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID";
+	private final static String SEARCH_PROVIDER_NO_DESTINATIONS_ID = "SEARCH_PROVIDER_NO_DESTINATIONS_ID";
+
+	public ISearchProviderDescription supportingTextSearchProviderDescription;
+	public ISearchProviderDescription unsupportingTextSearchProviderDescription;
+	public ISearchProviderDescription searchProviderForObjTypeWithNoDestinations_Description;
+
+	public ISearchProvider supportingTextSearchProviderInstance;
+	public ISearchProvider unsupportingTextSearchProviderInstance;
+	public ISearchProvider searchProviderForObjTypeWithNoDestinations_Instance;
+
+	public ISearchProviderConfiguration searchProviderConfiguration;
+
+	public GroupingHierarchy groupingHierarchy1;
+	public GroupingHierarchy groupingHierarchy2;
+
+	@Mock
+	public IErrorHandler errorHandler;
+	@Mock
+	public ILongOperationRunner operationRunner;
+	@Mock
+	public IDiscoveryEnvironment environment;
+	@Mock
+	public ISessionManager<ISearchSession> sessionManager;
+	@Mock
+	public IViewUiContext viewUiContext;
+
+	public NullProgressMonitor nullProgressMonitor;
+
+	public SearchConsoleTestFixture()
+	{
+		MockitoAnnotations.initMocks(this);
+		nullProgressMonitor = new NullProgressMonitor();
+		setupEnvironment();
+		setupUiContext();
+		setupObjectTypes();
+		setupDestinations();
+		setupDestinationProviders();
+		setupDestinationCategories();
+		setupSubdestinations();
+		setupGroupingHierarchy();
+		setupProviderInstances();
+		setupProviderDescriptions();
+		searchProviderConfiguration = createTestSearchProviderConfig();
+	}
+
+	private void setupUiContext()
+	{
+		Mockito.stub(viewUiContext.getSecondColumnPosition()).toReturn(60);
+		Mockito.stub(viewUiContext.controlsSpacing()).toReturn(60);
+	}
+
+	private void setupEnvironment()
+	{
+		Mockito.stub(environment.errorHandler()).toReturn(errorHandler);
+		Mockito.stub(environment.operationRunner()).toReturn(operationRunner);
+		Mockito.stub(environment.progressMonitor()).toReturn(nullProgressMonitor);
+	}
+
+	private void setupObjectTypes()
+	{
+		objectType1 = stubObjectType(OBJECT_TYPE_ID1, OBJECT_TYPE_NAME_1);
+		objectType2 = stubObjectType(OBJECT_TYPE_ID2, OBJECT_TYPE_NAME_2);
+		objectType3 = stubObjectType(OBJECT_TYPE_ID3, OBJECT_TYPE_NAME_3);
+		objectTypeNoDestinations = stubObjectType(OBJECT_TYPE_NO_DESTINATIONS_ID, OBJECT_TYPE_NO_DESTINATIONS_NAME);
+	}
+
+	private IObjectTypeDescription stubObjectType(final String id, final String displayName)
+	{
+		return new ObjectTypeDescriptionBuilder().withId(id).withName(displayName).object();
+	}
+
+	private void setupDestinations()
+	{
+		destination1 = stubDestination(DESTINATION_NAME1);
+		destination2 = stubDestination(DESTINATION_NAME2);
+		destination3 = stubDestination(DESTINATION_NAME3);
+		destination4 = stubDestination(DESTINATION_NAME4);
+		destination5 = stubDestination(DESTINATION_NAME5);
+	}
+
+	private ISearchDestination stubDestination(final String displayName)
+	{
+		return new SearchDestinationBuilder().withDisplayName(displayName).object();
+	}
+
+	private void setupSubdestinations()
+	{
+		subdestination1 = stubSubdestination(SUBDESTINATION_NAME_1);
+		subdestination2 = stubSubdestination(SUBDESTINATION_NAME_2);
+
+		subdestinationsActivityMap = new HashMap<ISearchSubdestination, Boolean>();
+		subdestinationsActivityMap.put(subdestination1, false);
+		subdestinationsActivityMap.put(subdestination2, false);
+	}
+
+	private ISearchSubdestination stubSubdestination(final String displayName)
+	{
+		return new SubdestinationBuilder().withName(displayName).object();
+	}
+
+	private ISearchProviderConfiguration createTestSearchProviderConfig()
+	{
+		return new ISearchProviderConfiguration()
+		{
+			public void activateSubdestination(IObjectTypeDescription searchObjectType, IDestinationCategoryDescription destinationCategory, ISearchProviderDescription searchProviderDescription, ISearchSubdestination subDestination, boolean activate)
+			{
+				subdestinationsActivityMap.put(subDestination, new Boolean(activate));
+			}
+
+			public ISearchProviderDescription getActiveSearchProvider(IObjectTypeDescription objectType, IDestinationCategoryDescription destinationCategory) throws ProviderNotFoundException
+			{
+				if (destinationCategory == null)
+				{
+					if (objectType.getId().equals(objectTypeNoDestinations.getId()))
+					{
+						return searchProviderForObjTypeWithNoDestinations_Description;
+					}
+					else
+					{
+						throw new ProviderNotFoundException("Provider not found");
+					}
+				}
+				if (objectType.getId().equals(objectType2.getId()) && (destinationCategory.getId().equals(CATEGORY_ID_2)))
+				{
+					return supportingTextSearchProviderDescription;
+				}
+				if (objectType.getId().equals(objectType1.getId()) && (destinationCategory.getId().equals(CATEGORY_ID_1)))
+				{
+					return unsupportingTextSearchProviderDescription;
+				}
+				if (objectType.getId().equals(objectType3.getId()) && (destinationCategory.getId().equals(CATEGORY_ID_3)))
+				{
+					return supportingTextSearchProviderDescription;
+				}
+
+				throw new ProviderNotFoundException("Provider not found");
+			}
+
+			public List<IDestinationCategoryDescription> getAvailableDestinationCategoriesForObjectType(IObjectTypeDescription objectType)
+			{
+				if (objectType.getId().equals(objectType1.getId()))
+				{
+					return Arrays.asList(new IDestinationCategoryDescription[] { category1 });
+				}
+				else if (objectType.getId().equals(objectType2.getId()))
+				{
+					return Arrays.asList(new IDestinationCategoryDescription[] { category2 });
+				}
+				else if (objectType.getId().equals(objectType3.getId()))
+				{
+					return Arrays.asList(new IDestinationCategoryDescription[] { category3 });
+				}
+
+				return Collections.emptyList();
+			}
+
+			public List<ISearchSubdestination> getAvailableSearchSubdestinations(IObjectTypeDescription objectType, IDestinationCategoryDescription destinationCategory, ISearchProviderDescription searchProvider)
+			{
+				if (objectType.getId().equals(OBJECT_TYPE_ID1))
+				{
+					return Arrays.asList(subdestination1, subdestination2);
+				}
+				return new ArrayList<ISearchSubdestination>();
+			}
+
+			public List<IDestinationCategoryDescription> getDestinationCategories()
+			{
+				return Arrays.asList(new IDestinationCategoryDescription[] { category1, category2, category3 });
+			}
+
+			public List<IDestinationCategoryDescription> getDestinationCategoriesForDestination(ISearchDestination destination) throws DestinationCategoryNotFoundException
+			{
+				if (destination.equals(destination1))
+				{
+					return Arrays.asList(new IDestinationCategoryDescription[] { category1 });
+				}
+				if (destination.equals(destination5))
+				{
+					return Arrays.asList(new IDestinationCategoryDescription[] { category3 });
+				}
+				else
+				{
+					return Arrays.asList(new IDestinationCategoryDescription[] { category2 });
+				}
+			}
+
+			public boolean isSubdestinationActive(ISearchSubdestination subdestination, IObjectTypeDescription objectType, IDestinationCategoryDescription destCategory, ISearchProviderDescription searchProvider)
+			{
+				return subdestinationsActivityMap.get(subdestination);
+			}
+
+			public List<ISearchProviderDescription> getAvailableSearchProviderDescriptions(IObjectTypeDescription searchObjectType)
+			{
+				throw new UnsupportedOperationException("Unexpected invocation");
+			}
+
+			public List<IObjectTypeDescription> getObjectTypes()
+			{
+				return Arrays.asList(new IObjectTypeDescription[] { objectType1, objectType2, objectType3, objectTypeNoDestinations });
+			}
+
+			public List<IDestinationsProviderDescription> getDestinationProvidersForCategory(IDestinationCategoryDescription category)
+			{
+				if (category.equals(category1))
+				{
+					return Arrays.asList(new IDestinationsProviderDescription[] { destProviderDescr_cat1 });
+				}
+				if (category.equals(category2))
+				{
+					return Arrays.asList(new IDestinationsProviderDescription[] { destProviderDescr_cat2 });
+				}
+				else
+				{
+					return Arrays.asList(new IDestinationsProviderDescription[] { destProviderDescr_cat3 });
+				}
+			}
+
+			public List<ISearchDestination> getSearchDestinations(IDestinationCategoryDescription category, IDestinationsProvider providerDescription)
+			{
+				return new ArrayList<ISearchDestination>(providerDescription.getSearchDestinations());
+			}
+
+			public List<IDestinationsProviderDescription> getAvailableDestinationProviders()
+			{
+				return Arrays.asList(new IDestinationsProviderDescription[] { destProviderDescr_cat1, destProviderDescr_cat2, destProviderDescr_cat3 });
+			}
+		};
+	}
+
+	private void setupGroupingHierarchy()
+	{
+		groupingHierarchy1 = new GroupingHierarchy("Grouping 1", "Grouping 1");
+		groupingHierarchy2 = new GroupingHierarchy("Grouping 2", "Grouping 2");
+	}
+
+	private void setupProviderInstances()
+	{
+		supportingTextSearchProviderInstance = new SearchProviderBuilder().withGroupingHierarchies(groupingHierarchy1, groupingHierarchy2).object();
+		unsupportingTextSearchProviderInstance = new SearchProviderBuilder().withGroupingHierarchies().object();
+		searchProviderForObjTypeWithNoDestinations_Instance = new SearchProviderBuilder().withGroupingHierarchies().object();
+	}
+
+	private void setupProviderDescriptions()
+	{
+		supportingTextSearchProviderDescription = stubSearchProviderDescription(true, SUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID, supportingTextSearchProviderInstance, category2, category3);
+		unsupportingTextSearchProviderDescription = stubSearchProviderDescription(false, UNSUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID, unsupportingTextSearchProviderInstance, category1);
+		searchProviderForObjTypeWithNoDestinations_Description = stubSearchProviderDescription(true, SEARCH_PROVIDER_NO_DESTINATIONS_ID, searchProviderForObjTypeWithNoDestinations_Instance);
+	}
+
+	private ISearchProviderDescription stubSearchProviderDescription(final boolean supportsTextSearch, final String id, final ISearchProvider searchProvInstance, final IDestinationCategoryDescription... destCategories)
+	{
+		return new SearchProviderDescriptionBuilder().supportsTextSearch(supportsTextSearch).withSearchProviderInstance(searchProvInstance).withDestinationCategories(destCategories).withId(id).object();
+	}
+
+	private void setupDestinationCategories()
+	{
+		category1 = stubDestinationCategoryDescription(CATEGORY_ID_1, CATEGORY_NAME_1, UNSUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID);
+		category2 = stubDestinationCategoryDescription(CATEGORY_ID_2, CATEGORY_NAME_2, SUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID);
+		category3 = stubDestinationCategoryDescription(CATEGORY_ID_3, CATEGORY_NAME_3, SUPPORTING_TEXT_SEARCH_SEARCH_PROVIDER_ID);
+	}
+
+	private IDestinationCategoryDescription stubDestinationCategoryDescription(final String id, final String displayName, final String destProviderId)
+	{
+		return new DestinationCategoryDescriptionBuilder().withDestinationProviders(destProviderId).withId(id).withName(displayName).object();
+	}
+
+	private void setupDestinationProviders()
+	{
+		destProvider_cat1 = stubDestinationsProvider(destination1, destination2);
+		destProvider_cat2 = stubDestinationsProvider(destination3, destination4);
+		destProvider_cat3 = stubDestinationsProvider(destination5);
+
+		destProviderDescr_cat1 = stubDestinationsProviderDescription(destProvider_cat1, TEST_SEARCH_DEST_PROVIDER_PREFERENCE_PAGE_ID);
+		destProviderDescr_cat2 = stubDestinationsProviderDescription(destProvider_cat2, null);
+		destProviderDescr_cat3 = stubDestinationsProviderDescription(destProvider_cat3, null);
+	}
+
+	private IDestinationsProvider stubDestinationsProvider(final ISearchDestination... destinations)
+	{
+		return new DestinationsProviderBuilder().withDestinations(destinations).object();
+	}
+
+	private IDestinationsProviderDescription stubDestinationsProviderDescription(final IDestinationsProvider destProviderInstance, final String prefPageId)
+	{
+		return new DestProviderDescriptionBuilder().withProvider(destProviderInstance).withParefPageId(prefPageId).object();
+	}
+}
diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/AdvancedSearchParamsPageObject.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/AdvancedSearchParamsPageObject.java
new file mode 100644
index 0000000..3599f50
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/AdvancedSearchParamsPageObject.java
@@ -0,0 +1,202 @@
+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects;

+

+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;

+

+import org.eclipse.platform.discovery.runtime.api.ISearchDestination;

+import org.eclipse.platform.discovery.runtime.api.ISearchParameters;

+import org.eclipse.platform.discovery.runtime.internal.ISearchProviderConfiguration;

+import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IObjectTypeDescription;

+import org.eclipse.platform.discovery.ui.api.IAdvancedSearchParamsUiContributor;

+import org.eclipse.platform.discovery.ui.api.IViewUiContext;

+import org.eclipse.platform.discovery.ui.internal.search.advancedparams.AdvancedSearchParamsDisplayer;

+import org.eclipse.platform.discovery.ui.internal.xp.IAdvancedSearchParamsUiContribXpParser;

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.SWTBotSection;

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.SwtBotUtils;

+import org.eclipse.platform.discovery.util.api.env.IDiscoveryEnvironment;

+import org.eclipse.platform.discovery.util.internal.property.IPropertyAttributeListener;

+import org.eclipse.swt.SWT;

+import org.eclipse.swt.graphics.Point;

+import org.eclipse.swt.layout.FillLayout;

+import org.eclipse.swt.widgets.Composite;

+import org.eclipse.swt.widgets.Control;

+import org.eclipse.swt.widgets.Shell;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.results.BoolResult;

+import org.eclipse.swtbot.swt.finder.results.Result;

+import org.eclipse.swtbot.swt.finder.results.VoidResult;

+import org.eclipse.ui.forms.widgets.FormToolkit;

+import org.eclipse.ui.forms.widgets.Section;

+import org.hamcrest.Matcher;

+

+public class AdvancedSearchParamsPageObject<T extends Control> extends InShellPageObject

+{

+	private final ISearchProviderConfiguration searchProviderConfiguration;

+	private final IAdvancedSearchParamsUiContribXpParser xpParser;

+	private final SwtBotUtils botUtils;

+	private final Matcher<T> widgetMatcher;

+	private Composite parameterComposite;

+	private AdvancedSearchParamsDisplayer displayer;

+

+	public AdvancedSearchParamsPageObject(final ISearchProviderConfiguration searchProviderConfiguration, final IAdvancedSearchParamsUiContribXpParser xpParser, final Matcher<T> widgetMatcher)

+	{

+		this.searchProviderConfiguration = searchProviderConfiguration;

+		this.xpParser = xpParser;

+		botUtils = new SwtBotUtils();

+		this.widgetMatcher = widgetMatcher;

+	}

+

+	@Override

+	protected void createContent(final Shell parentShell, final FormToolkit formToolkit)

+	{

+		final Composite parentComposite = new Composite(parentShell, SWT.NONE);

+		parentComposite.setLayout(new FillLayout());

+		displayer = new AdvancedSearchParamsDisplayer(parentComposite, formToolkit)

+		{

+			@Override

+			protected ISearchProviderConfiguration searchProviderConfiguration()

+			{

+				return searchProviderConfiguration;

+			}

+

+			@Override

+			protected Composite createParametersContainingComposite(final Composite parent)

+			{

+				parameterComposite = super.createParametersContainingComposite(parent);

+				return parameterComposite;

+			}

+

+			@Override

+			protected IAdvancedSearchParamsUiContribXpParser createAdvancedSearchUiContribXpParser()

+			{

+				return xpParser;

+			}

+		};

+	}

+

+	public void registerSizePropertyChangeListener(IPropertyAttributeListener<Point> listener, boolean notifyCurrent)

+	{

+		displayer.registerSizePropertyChangeListener(listener, notifyCurrent);

+	}

+

+	public IAdvancedSearchParamsUiContributor getUiContributor()

+	{

+		return displayer.getUiContributor();

+	}

+

+	public void setSearchParameters(final ISearchParameters searchParams)

+	{

+		displayer.setParams(searchParams);

+	}

+

+	public void setInput(final IObjectTypeDescription objectType, final ISearchDestination destination, final IDiscoveryEnvironment environment, final IViewUiContext viewUiContext)

+	{

+		syncExec(new VoidResult()

+		{

+

+			@Override

+			public void run()

+			{

+				displayer.update(objectType, destination, environment, viewUiContext);

+			}

+		});

+	}

+

+	public Composite getParametersComposite()

+	{

+		return this.parameterComposite;

+	}

+

+	public Composite getParametersCompositeParent()

+	{

+		return syncExec(new Result<Composite>()

+		{

+

+			@Override

+			public Composite run()

+			{

+				return getParametersComposite().getParent();

+			}

+		});

+	}

+

+	public boolean isCustomUiAvailable()

+	{

+		try

+		{

+			final T customUi = botUtils.findOneChildControl(shell().widget, widgetMatcher, true);

+			return syncExec(new BoolResult()

+			{

+

+				@Override

+				public Boolean run()

+				{

+					return customUi.isVisible();

+				}

+			});

+		}

+		catch (WidgetNotFoundException e)

+		{

+			return false;

+		}

+	}

+

+	public String getSectionTitle()

+	{

+		return findSection().getText();

+	}

+

+	public boolean isSectionVisible()

+	{

+		try

+		{

+			findSection();

+			return true;

+		}

+		catch (WidgetNotFoundException e)

+		{

+			return false;

+		}

+	}

+

+	public void hideCustomUi()

+	{

+		findSection().collapse();

+	}

+

+	public void showCustomUi()

+	{

+		findSection().expand();

+	}

+

+	public void enable()

+	{

+		setEnabled(true);

+	}

+

+	public void disable()

+	{

+		setEnabled(false);

+	}

+

+	public void setParams(final ISearchParameters searchParams)

+	{

+		displayer.setParams(searchParams);

+	}

+

+	private SWTBotSection findSection()

+	{

+		return new SWTBotSection(botUtils.findOneChildControlOfExactType(shell().widget, Section.class, true));

+	}

+

+	private void setEnabled(final boolean enabled)

+	{

+		syncExec(new VoidResult()

+		{

+			@Override

+			public void run()

+			{

+				displayer.setEnabled(enabled);

+			}

+		});

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/ComboSelectorPageObject.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/ComboSelectorPageObject.java
index f5a1246..4d00f79 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/ComboSelectorPageObject.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/ComboSelectorPageObject.java
@@ -1,5 +1,17 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

 package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects;

 

+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;

+

 import java.util.Collection;

 import java.util.List;

 

@@ -7,6 +19,7 @@
 import org.eclipse.platform.discovery.runtime.api.IDisplayableObject;

 import org.eclipse.platform.discovery.ui.internal.selector.ComboSelector;

 import org.eclipse.swt.widgets.Shell;

+import org.eclipse.swtbot.swt.finder.results.VoidResult;

 import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;

 import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel;

 import org.eclipse.ui.forms.widgets.FormToolkit;

@@ -45,15 +58,14 @@
 

 	public void setInput(final Collection<T> input)

 	{

-		new RunInUI<Void>(display())

+		syncExec(new VoidResult()

 		{

 			@Override

-			protected Void perform()

+			public void run()

 			{

 				selector.setInput(input);

-				return null;

 			}

-		};

+		});

 	}

 

 	public String getSelectedItem()

@@ -83,14 +95,13 @@
 

 	public void setEnabled(final boolean enabled)

 	{

-		new RunInUI<Void>(display()){

-

+		syncExec(new VoidResult()

+		{

 			@Override

-			protected Void perform()

+			public void run()

 			{

 				selector.setEnabled(enabled);

-				return null;

 			}

-		};

+		});

 	}

 }

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/DiscoveredItemsInShellPageObject.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/DiscoveredItemsInShellPageObject.java
new file mode 100644
index 0000000..f8dfb78
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/DiscoveredItemsInShellPageObject.java
@@ -0,0 +1,51 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects;

+

+import java.util.Arrays;

+import java.util.HashSet;

+

+import org.eclipse.platform.discovery.core.api.IContributedAction;

+import org.eclipse.platform.discovery.ui.api.IGenericViewCustomization;

+import org.eclipse.platform.discovery.ui.api.IResultsViewAccessor;

+import org.eclipse.platform.discovery.ui.internal.view.result.impl.DiscoveryTreeViewerFactory;

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.SWTBotDiscoveryTree;

+import org.eclipse.platform.discovery.util.api.env.IDiscoveryEnvironment;

+import org.eclipse.platform.discovery.util.internal.ContractChecker;

+import org.eclipse.swt.widgets.Shell;

+import org.eclipse.ui.forms.widgets.FormToolkit;

+

+public class DiscoveredItemsInShellPageObject extends InShellPageObject

+{

+	private final IGenericViewCustomization viewCustomization;

+	private final IDiscoveryEnvironment discoveryEnv;

+	private SWTBotDiscoveryTree discoveryTree;

+

+	public DiscoveredItemsInShellPageObject(final IDiscoveryEnvironment discoveryEnv, final IGenericViewCustomization viewCustomization)

+	{

+		this.viewCustomization = viewCustomization;

+		this.discoveryEnv = discoveryEnv;

+	}

+

+	@Override

+	protected void createContent(final Shell parent, FormToolkit formToolkit)

+	{

+		final DiscoveryTreeViewerFactory f = new DiscoveryTreeViewerFactory();

+		final IResultsViewAccessor accessor = f.createTreeViewer(parent, new HashSet<IGenericViewCustomization>(Arrays.asList(viewCustomization)), new HashSet<IContributedAction>(), discoveryEnv);

+		this.discoveryTree = new SWTBotDiscoveryTree(accessor);

+	}

+

+	public SWTBotDiscoveryTree tree()

+	{

+		ContractChecker.nullCheckField(this.discoveryTree, "treeViewer");

+		return this.discoveryTree;

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/InShellPageObject.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/InShellPageObject.java
index 1b76d77..8309fc3 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/InShellPageObject.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/InShellPageObject.java
@@ -1,3 +1,13 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

 package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects;

 

 import org.eclipse.swt.SWT;

@@ -25,8 +35,8 @@
 

 	public void open()

 	{

-		createShell();

-		botShell = new SWTBot().shell(TEST_SHELL_LABEL);

+		final Shell shell = createShell();

+		botShell = new SWTBotShell(shell);

 		botShell.activate();

 	}

 

@@ -61,7 +71,7 @@
 		return PlatformUI.getWorkbench().getDisplay();

 	}

 

-	private Shell createShell()

+	protected Shell createShell()

 	{

 		final Shell[] theShell = new Shell[1];

 		final Runnable createShellRunnable = new Runnable()

@@ -89,14 +99,14 @@
 		display().syncExec(createShellRunnable);

 		return theShell[0];

 	}

-	

-	protected SWTBot bot() {

+

+	protected SWTBot bot()

+	{

 		return botShell.bot();

 	}

-	

+

 	protected SWTBotShell shell()

 	{

 		return botShell;

 	}

-	

 }

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/InteractiveComboSelectorPageObject.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/InteractiveComboSelectorPageObject.java
index 012fb79..e510c60 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/InteractiveComboSelectorPageObject.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/InteractiveComboSelectorPageObject.java
@@ -1,10 +1,23 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

 package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects;

 

+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;

+

 import java.util.List;

 

 import org.eclipse.platform.discovery.runtime.api.IDisplayableObject;

 import org.eclipse.platform.discovery.ui.internal.selector.InteractiveComboSelector;

 import org.eclipse.swt.widgets.Shell;

+import org.eclipse.swtbot.swt.finder.results.VoidResult;

 import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;

 import org.eclipse.ui.forms.widgets.FormToolkit;

 

@@ -32,15 +45,14 @@
 

 	public void setInput(final List<IDisplayableObject> input)

 	{

-		new RunInUI<Void>(display())

+		syncExec(new VoidResult()

 		{

 			@Override

-			protected Void perform()

+			public void run()

 			{

 				selector.setInput(input);

-				return null;

 			}

-		};

+		});

 	}

 

 	public void select(final String item)

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/RunInUI.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/RunInUI.java
deleted file mode 100644
index 0b0d7f4..0000000
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/RunInUI.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects;

-

-import org.eclipse.swt.widgets.Display;

-

-/**

- * Utility for running routines in the UI thread synchronously

- * 

- * @author Danail Branekov

- * 

- */

-abstract class RunInUI<T>

-{

-	private T result;

-

-	RunInUI(final Display display)

-	{

-		this.run(display);

-	}

-

-	private void run(final Display display)

-	{

-		display.syncExec(new Runnable()

-		{

-			@Override

-			public void run()

-			{

-				result = perform();

-			}

-		});

-	}

-

-	/**

-	 * Implement the routine here; called from the UI thread

-	 * 

-	 * @returns the result of the routine

-	 */

-	protected abstract T perform();

-

-	/**

-	 * Retrieves the result of the routine

-	 * 

-	 * @see #perform()

-	 */

-	public T getResult()

-	{

-		return result;

-	}

-}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/SearchConsolePageObject.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/SearchConsolePageObject.java
new file mode 100644
index 0000000..54ec0fa
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/SearchConsolePageObject.java
@@ -0,0 +1,473 @@
+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects;

+

+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;

+

+import java.text.MessageFormat;

+import java.util.Collection;

+import java.util.LinkedList;

+

+import junit.framework.Assert;

+

+import org.eclipse.platform.discovery.core.api.ISearchContext;

+import org.eclipse.platform.discovery.core.api.SearchEvent;

+import org.eclipse.platform.discovery.core.internal.ISearchSession;

+import org.eclipse.platform.discovery.core.internal.SearchConsoleController;

+import org.eclipse.platform.discovery.core.internal.console.ISearchConsoleControllerOutputView;

+import org.eclipse.platform.discovery.core.internal.events.handlers.ISearchEventHandler;

+import org.eclipse.platform.discovery.runtime.api.SearchFailedException;

+import org.eclipse.platform.discovery.runtime.internal.ISearchProviderConfiguration;

+import org.eclipse.platform.discovery.runtime.internal.ProviderNotFoundException;

+import org.eclipse.platform.discovery.ui.api.IGenericViewCustomization;

+import org.eclipse.platform.discovery.ui.api.IViewUiContext;

+import org.eclipse.platform.discovery.ui.api.impl.DefaultSessionIds;

+import org.eclipse.platform.discovery.ui.internal.plugin.DiscoveryUIMessages;

+import org.eclipse.platform.discovery.ui.internal.search.advancedparams.IAdvancedSearchParamsDisplayer;

+import org.eclipse.platform.discovery.ui.internal.view.SearchConsoleView;

+import org.eclipse.platform.discovery.ui.internal.view.impl.ITabbedSessionDisplayer;

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.SWTBotHyperlink;

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.SWTBotTextWithMessage;

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.SwtBotUtils;

+import org.eclipse.platform.discovery.util.api.env.IDiscoveryEnvironment;

+import org.eclipse.platform.discovery.util.internal.session.ISessionManager;

+import org.eclipse.swt.SWT;

+import org.eclipse.swt.layout.FillLayout;

+import org.eclipse.swt.widgets.Combo;

+import org.eclipse.swt.widgets.Composite;

+import org.eclipse.swt.widgets.Label;

+import org.eclipse.swt.widgets.Shell;

+import org.eclipse.swt.widgets.Text;

+import org.eclipse.swt.widgets.Tree;

+import org.eclipse.swt.widgets.Widget;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.results.VoidResult;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;

+import org.eclipse.ui.IWorkbenchPartSite;

+import org.eclipse.ui.forms.widgets.FormToolkit;

+import org.eclipse.ui.forms.widgets.Hyperlink;

+import org.hamcrest.BaseMatcher;

+import org.hamcrest.Description;

+import org.mockito.Mock;

+import org.mockito.Mockito;

+import org.mockito.MockitoAnnotations;

+

+public class SearchConsolePageObject extends InShellPageObject

+{

+	private static final String TEST_PREFERENCE_PAGE_NAME = "DiscoveryUiTestPreferencePage";

+

+	@Mock

+	private IWorkbenchPartSite viewSite;

+

+	private final ISearchProviderConfiguration searchProviderConfiguration;

+	private final ITabbedSessionDisplayer<ISearchContext> sessionDisplayer;

+	private final IAdvancedSearchParamsDisplayer advancedParamsDisplayer;

+	private final IDiscoveryEnvironment env;

+	private final IViewUiContext uiContext;

+	private final SwtBotUtils botUtils;

+

+	private PageObjectConsoleView consoleView;

+	private PageObjectController viewController;

+

+	public SearchConsolePageObject(final ISearchProviderConfiguration searchProviderConfiguration, final ITabbedSessionDisplayer<ISearchContext> sessionDisplayer, final IAdvancedSearchParamsDisplayer advancedParamsDisplayer, final IDiscoveryEnvironment environment, final IViewUiContext uiContext)

+	{

+		MockitoAnnotations.initMocks(this);

+		this.searchProviderConfiguration = searchProviderConfiguration;

+		this.sessionDisplayer = sessionDisplayer;

+		this.advancedParamsDisplayer = advancedParamsDisplayer;

+		this.env = environment;

+		this.uiContext = uiContext;

+		this.botUtils = new SwtBotUtils();

+	}

+

+	@Override

+	protected Shell createShell()

+	{

+		final Shell shell = super.createShell();

+		Mockito.stub(viewSite.getShell()).toReturn(shell);

+		return shell;

+	}

+

+	@Override

+	protected void createContent(final Shell parent, final FormToolkit formToolkit)

+	{

+		syncExec(new VoidResult()

+		{

+			@Override

+			public void run()

+			{

+				parent.setLayout(new FillLayout(SWT.VERTICAL));

+				consoleView = new PageObjectConsoleView();

+				consoleView.setEnvironment(env);

+				consoleView.setUiContext(uiContext);

+				consoleView.createPartControl(parent);

+			}

+		});

+	}

+

+	@Override

+	public void open()

+	{

+		super.open();

+		syncExec(new VoidResult()

+		{

+

+			@Override

+			public void run()

+			{

+				shell().widget.layout();

+				consoleView.setDefaultSessionId(DefaultSessionIds.mainSearchSessionId);

+				consoleView.setEnvironment(env);

+				viewController = new PageObjectController(searchProviderConfiguration, consoleView, env, null, DefaultSessionIds.mainSearchSessionId);

+				consoleView.registerController(viewController);

+				consoleView.initializationCompleted();

+			}

+		});

+	}

+

+	public IWorkbenchPartSite getViewSiteMock()

+	{

+		return this.viewSite;

+	}

+

+	public String getSelectedObject()

+	{

+		final SWTBotCombo objectsCombo = findObjectTypesCombo();

+		return (objectsCombo.selectionIndex() == -1) ? null : objectsCombo.selection();

+	}

+

+	public void selectObject(final String objectName)

+	{

+		findObjectTypesCombo().setSelection(objectName);

+	}

+

+	public Collection<String> getCategories()

+	{

+		final Collection<String> categories = new LinkedList<String>();

+		for (SWTBotTreeItem item : getAllCategoryItems())

+		{

+			categories.add(item.getText());

+		}

+

+		return categories;

+	}

+

+	public void verifyManageDestinationsWorksCorrectly()

+	{

+		final SWTBotHyperlink manageDestinationsLink = new SWTBotHyperlink(botUtils.findOneChildControlOfExactType(shell().widget, Hyperlink.class, true));

+		manageDestinationsLink.click();

+

+		final SWTBotShell preferencePageShell = findPreferencePageShell();

+		verifyDestinationPreferenceDisplayed(preferencePageShell);

+		preferencePageShell.close();

+	}

+

+	public void verifySearchPerformed(final String objectTypeId, final String destinationName, final String keyword)

+	{

+		Assert.assertNotNull("Search was not invoked", viewController.lastSearchEvent);

+		Assert.assertEquals("Unexpected object id", objectTypeId, viewController.lastSearchEvent.getSearchParameters().getObjectTypeId());

+		Assert.assertEquals("Unexpected destination", destinationName, viewController.lastSearchEvent.getSearchParameters().getSearchDestination().getDisplayName());

+		Assert.assertEquals("Unexpected keyword", keyword, viewController.lastSearchEvent.getSearchParameters().getKeywordString());

+	}

+

+	private SWTBotTreeItem getCategoryItem(final String categoryName)

+	{

+		for (SWTBotTreeItem categoryItem : getAllCategoryItems())

+		{

+			if (categoryItem.getText().equals(categoryName))

+			{

+				return categoryItem;

+			}

+		}

+		throw new WidgetNotFoundException(MessageFormat.format("Category {0} not found", categoryName));

+	}

+

+	private SWTBotTree findDestinationsTree()

+	{

+		return new SWTBotTree(findSiblingByLabel(DiscoveryUIMessages.SEARCH_IN_LIST_VIEWER_LABEL, Tree.class));

+	}

+

+	private SWTBotTreeItem[] getAllCategoryItems()

+	{

+		return findDestinationsTree().getAllItems();

+	}

+

+	private SWTBotCombo findObjectTypesCombo()

+	{

+		return new SWTBotCombo(findSiblingByLabel(DiscoveryUIMessages.SEARCH_FOR_LIST_VIEWER_LABEL, Combo.class));

+	}

+

+	private <T extends Widget> T findSiblingByLabel(final String labelText, final Class<T> targetClass)

+	{

+		return botUtils.findSibling(bot().label(labelText), targetClass);

+	}

+

+	public void selectDestination(final String categoryName, final String destinationName)

+	{

+		findDestination(categoryName, destinationName).select();

+	}

+

+	public boolean isDestinationVisible(final String categoryName, final String destinationName)

+	{

+		try

+		{

+			findDestination(categoryName, destinationName);

+			return true;

+		}

+		catch (WidgetNotFoundException e)

+		{

+			return false;

+		}

+	}

+

+	public Collection<String> getDestinationsForCategory(final String categoryName)

+	{

+		final Collection<String> result = new LinkedList<String>();

+		for (SWTBotTreeItem destinationItem : getCategoryItem(categoryName).getItems())

+		{

+			result.add(destinationItem.getText());

+		}

+

+		return result;

+	}

+

+	public void expandDestinations()

+	{

+		for (SWTBotTreeItem categoryItem : getAllCategoryItems())

+		{

+			categoryItem.expand();

+		}

+	}

+

+	public boolean canSelectHierarchy()

+	{

+		return findGroupingHierarchyCombo().isEnabled();

+	}

+

+	public String getSelectedGroupingHierarchy()

+	{

+		return findGroupingHierarchyCombo().getText();

+	}

+

+	public String getKeyword()

+	{

+		final SWTBotTextWithMessage keywordText = findKeywordText();

+		// The logic below reflects the org.eclipse.platform.discovery.ui.internal.view.impl.TextControl implementation details

+		if(!keywordText.isEnabled())

+		{

+			return keywordText.getText();

+		}

+		if(keywordText.getText().length() == 0)

+		{

+			return keywordText.getMessage();

+		}

+		return keywordText.getText();

+	}

+

+	public void enterKeyword(final String keyword)

+	{

+		if (!canEnterSearchText())

+		{

+			throw new IllegalStateException("Cannot enter keyword as the text is disabled");

+		}

+		findKeywordText().setText(keyword);

+	}

+

+	public void selectFirstPossibleDestination()

+	{

+		expandDestinations();

+		getAllCategoryItems()[0].getItems()[0].select();

+	}

+

+	public void search()

+	{

+		if (!canSearch())

+		{

+			throw new IllegalStateException("Search is not possible now as the search button is disabled");

+		}

+		findSearchButton().click();

+	}

+

+	public void registerViewCustomization(final IGenericViewCustomization... customizations)

+	{

+		for (IGenericViewCustomization cust : customizations)

+		{

+			consoleView.registerViewCustomization(cust);

+		}

+	}

+

+	public void showResult(final ISearchContext searchContext)

+	{

+		syncExec(new VoidResult()

+		{

+			@Override

+			public void run()

+			{

+				consoleView.showResult(searchContext);

+			}

+		});

+	}

+

+	public boolean canSelectObject()

+	{

+		return findObjectTypesCombo().isEnabled();

+	}

+

+	public boolean canSelectDestination()

+	{

+		return findDestinationsTree().isEnabled();

+	}

+

+	public boolean canEnterSearchText()

+	{

+		return findKeywordText().isEnabled();

+	}

+

+	public boolean canSelectSubdestination()

+	{

+		return findSubdestinationsSelectorButton().isEnabled();

+	}

+

+	public boolean canSearch()

+	{

+		return findSearchButton().isEnabled();

+	}

+

+	private SWTBotTreeItem findDestination(final String categoryName, final String destinationName)

+	{

+		for (SWTBotTreeItem categoryItem : getAllCategoryItems())

+		{

+			if (!categoryItem.getText().equals(categoryName))

+			{

+				continue;

+			}

+

+			try

+			{

+				return categoryItem.getNode(destinationName);

+			}

+			catch (WidgetNotFoundException e)

+			{

+				throw new WidgetNotFoundException(MessageFormat.format("Coulkd find destination {0} for category {1}", destinationName, categoryName), e);

+			}

+		}

+		throw new WidgetNotFoundException(MessageFormat.format("Could find category {0}", categoryName));

+	}

+

+	private SWTBotTextWithMessage findKeywordText()

+	{

+		return new SWTBotTextWithMessage(findSiblingByLabel(DiscoveryUIMessages.SEARCH_KEYWORD_LABEL, Text.class));

+	}

+

+	private SWTBotLabel findSubdestinationsSelectorButton()

+	{

+		return new SWTBotLabel(findSiblingByLabel(DiscoveryUIMessages.SEARCH_KEYWORD_LABEL, Label.class));

+	}

+

+	private SWTBotButton findSearchButton()

+	{

+		return bot().button(DiscoveryUIMessages.SEARCH_BUTTON_LABEL);

+	}

+

+	private SWTBotCombo findGroupingHierarchyCombo()

+	{

+		return new SWTBotCombo(findSiblingByLabel(DiscoveryUIMessages.GROUP_BY_LABEL, Combo.class));

+	}

+

+	private SWTBotShell findPreferencePageShell()

+	{

+		final SWTBotShell preferencePageShell = botUtils.findShell(new BaseMatcher<Shell>()

+		{

+			@Override

+			public boolean matches(Object item)

+			{

+				if (!(item instanceof SWTBotShell))

+				{

+					return false;

+				}

+				final SWTBotShell theShell = (SWTBotShell)item;

+				try

+				{

+					theShell.bot().tree().getTreeItem(TEST_PREFERENCE_PAGE_NAME);

+					return true;

+				}

+				catch (WidgetNotFoundException e)

+				{

+					return false;

+				}

+			}

+

+			@Override

+			public void describeTo(Description description)

+			{

+			}

+		});

+

+		return preferencePageShell;

+	}

+

+	private void verifyDestinationPreferenceDisplayed(final SWTBotShell preferencePageShell)

+	{

+		preferencePageShell.bot().tree().getTreeItem(TEST_PREFERENCE_PAGE_NAME).click();

+		try

+		{

+			preferencePageShell.bot().text("MyTestLabel");

+			preferencePageShell.bot().button("Button1");

+		}

+		catch (WidgetNotFoundException e)

+		{

+		}

+	}

+

+	private class PageObjectConsoleView extends SearchConsoleView

+	{

+		protected ISearchProviderConfiguration getSearchProviderConfiguration()

+		{

+			return searchProviderConfiguration;

+		};

+

+		@Override

+		protected ITabbedSessionDisplayer<ISearchContext> createSessionsDisplayer()

+		{

+			return sessionDisplayer;

+		}

+

+		@Override

+		public IWorkbenchPartSite getSite()

+		{

+			return viewSite;

+		}

+

+		@Override

+		protected IAdvancedSearchParamsDisplayer createAdvancedSearchParamsDisplayer(Composite parent, FormToolkit formToolkit)

+		{

+			return advancedParamsDisplayer;

+		}

+	}

+

+	private class PageObjectController extends SearchConsoleController

+	{

+		public SearchEvent lastSearchEvent;

+

+		public PageObjectController(ISearchProviderConfiguration providerConfiguration, ISearchConsoleControllerOutputView searchConsoleView, IDiscoveryEnvironment consoleEnv, ISessionManager<ISearchSession> sessionManager, String defaultSessionId)

+		{

+			super(providerConfiguration, searchConsoleView, consoleEnv, sessionManager, defaultSessionId);

+		}

+

+		@Override

+		protected ISearchEventHandler createSearchEventHandler()

+		{

+			return new ISearchEventHandler()

+			{

+				@Override

+				public void handleSearch(SearchEvent event) throws ProviderNotFoundException, SearchFailedException

+				{

+					lastSearchEvent = event;

+				}

+			};

+		}

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/SearchDestinationsSelectorPageObject.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/SearchDestinationsSelectorPageObject.java
index 826ab96..24fa740 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/SearchDestinationsSelectorPageObject.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/SearchDestinationsSelectorPageObject.java
@@ -1,5 +1,18 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

 package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects;

 

+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;

+

+import java.text.MessageFormat;

 import java.util.ArrayList;

 import java.util.Arrays;

 import java.util.HashSet;

@@ -11,6 +24,9 @@
 import org.eclipse.platform.discovery.runtime.internal.model.descriptions.IDestinationCategoryDescription;

 import org.eclipse.platform.discovery.ui.internal.selector.SearchDestinationsSelector;

 import org.eclipse.swt.widgets.Shell;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.results.Result;

+import org.eclipse.swtbot.swt.finder.results.VoidResult;

 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;

 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;

 import org.eclipse.ui.forms.widgets.FormToolkit;

@@ -54,16 +70,14 @@
 

 	public void setInput(final List<IDestinationCategoryDescription> input)

 	{

-		new RunInUI<Void>(display())

+		syncExec(new VoidResult()

 		{

-

 			@Override

-			protected Void perform()

+			public void run()

 			{

 				selector.setInput(input);

-				return null;

 			}

-		};

+		});

 	}

 

 	private SWTBotTree destinationsTree()

@@ -78,7 +92,7 @@
 

 	private SWTBotTreeItem findFirstDestination()

 	{

-		for (SWTBotTreeItem treeItem : getAllItems())

+		for (SWTBotTreeItem treeItem : getAllVisibleItems())

 		{

 			if (isDestination(treeItem))

 			{

@@ -103,14 +117,14 @@
 	public List<String> getAllItemsNames()

 	{

 		final List<String> result = new ArrayList<String>();

-		for (SWTBotTreeItem item : getAllItems())

+		for (SWTBotTreeItem item : getAllVisibleItems())

 		{

 			result.add(item.getText());

 		}

 		return result;

 	}

 

-	private List<SWTBotTreeItem> getAllItems()

+	private List<SWTBotTreeItem> getAllVisibleItems()

 	{

 		return getItems(destinationsTree().getAllItems());

 	}

@@ -128,24 +142,41 @@
 

 	public void update()

 	{

-		new RunInUI<Void>(display())

+		syncExec(new VoidResult()

 		{

 			@Override

-			protected Void perform()

+			public void run()

 			{

 				selector.update();

-				return null;

 			}

-		};

+		});

 	}

 

-	public void select(final String itemName)

+	public void selectDestination(final String destinationName)

 	{

-		destinationsTree().select(itemName);

+		for(SWTBotTreeItem item : getAllVisibleItems())

+		{

+			if(destinationName.equals(item.getText()) && isDestination(item))

+			{

+				item.select();

+				return;

+			}

+		}

+		throw new WidgetNotFoundException(MessageFormat.format("Could not find destination {0}", destinationName));

 	}

+	

+	

 

 	public ISearchDestination getSelectedDestination()

 	{

-		return selector.getSelectedItem();

+		return syncExec(new Result<ISearchDestination>()

+		{

+

+			@Override

+			public ISearchDestination run()

+			{

+				return selector.getSelectedItem();

+			}

+		});

 	}

 }

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/SearchFavoritesPageObject.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/SearchFavoritesPageObject.java
new file mode 100644
index 0000000..4757dbb
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/SearchFavoritesPageObject.java
@@ -0,0 +1,359 @@
+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects;

+

+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;

+

+import java.text.MessageFormat;

+import java.util.ArrayList;

+import java.util.HashSet;

+import java.util.Iterator;

+import java.util.List;

+import java.util.Set;

+

+import org.eclipse.jface.util.LocalSelectionTransfer;

+import org.eclipse.jface.viewers.IStructuredSelection;

+import org.eclipse.jface.viewers.ITreeContentProvider;

+import org.eclipse.jface.viewers.TreeViewer;

+import org.eclipse.platform.discovery.core.api.ISearchContext;

+import org.eclipse.platform.discovery.core.api.ISearchFavoritesMasterController;

+import org.eclipse.platform.discovery.core.internal.ContextStructuredSelection;

+import org.eclipse.platform.discovery.core.internal.IContextStructuredSelection;

+import org.eclipse.platform.discovery.runtime.api.ISearchDestination;

+import org.eclipse.platform.discovery.runtime.api.ISearchParameters;

+import org.eclipse.platform.discovery.ui.api.ISearchFavoritesViewCustomization;

+import org.eclipse.platform.discovery.ui.internal.dnd.LocalContextSelectionTransfer;

+import org.eclipse.platform.discovery.ui.internal.view.SearchFavoritesView;

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.SWTBotToolItem;

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.SwtBotUtils;

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.utils.DndUtil;

+import org.eclipse.platform.discovery.util.api.env.IDiscoveryEnvironment;

+import org.eclipse.swt.SWT;

+import org.eclipse.swt.dnd.DND;

+import org.eclipse.swt.dnd.DragSourceAdapter;

+import org.eclipse.swt.dnd.DragSourceEvent;

+import org.eclipse.swt.dnd.DropTargetListener;

+import org.eclipse.swt.dnd.Transfer;

+import org.eclipse.swt.layout.FillLayout;

+import org.eclipse.swt.layout.GridData;

+import org.eclipse.swt.widgets.Composite;

+import org.eclipse.swt.widgets.Label;

+import org.eclipse.swt.widgets.Shell;

+import org.eclipse.swt.widgets.ToolItem;

+import org.eclipse.swt.widgets.Tree;

+import org.eclipse.swt.widgets.TreeItem;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.results.Result;

+import org.eclipse.swtbot.swt.finder.results.VoidResult;

+import org.eclipse.swtbot.swt.finder.utils.SWTUtils;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;

+import org.eclipse.ui.IActionBars;

+import org.eclipse.ui.IViewSite;

+import org.eclipse.ui.IWorkbenchPartSite;

+import org.eclipse.ui.forms.widgets.FormToolkit;

+import org.mockito.Mockito;

+

+public class SearchFavoritesPageObject extends InShellPageObject

+{

+	private final static String FAVORITES_LABEL = "This is the favorites view";

+	private static final String DRAG_SOURCE_TREE = "Helper DND tree";

+

+	private final ISearchFavoritesViewCustomization viewCustomization;

+	private final IDiscoveryEnvironment env;

+	private SearchFavoritesView favoritesView;

+	private final SwtBotUtils botUtils;

+	private TreeViewer dragHelperTreeViewer;

+	private final DndUtil dndUtil;

+	private final ITreeContentProvider dragHelperContentProvider;

+

+	public SearchFavoritesPageObject(final ISearchFavoritesViewCustomization viewCustomization, final ITreeContentProvider dragHelperContentProvider, final IDiscoveryEnvironment env)

+	{

+		this.viewCustomization = viewCustomization;

+		this.dragHelperContentProvider = dragHelperContentProvider;

+		this.env = env;

+		botUtils = new SwtBotUtils();

+		dndUtil = new DndUtil(display());

+	}

+

+	@Override

+	protected void createContent(final Shell parent, final FormToolkit formToolkit)

+	{

+		final Composite favoritesComposite = new Composite(parent, SWT.BORDER);

+		favoritesComposite.setLayout(new FillLayout(SWT.VERTICAL));

+		final Label l = new Label(favoritesComposite, SWT.NONE);

+		l.setText(FAVORITES_LABEL);

+

+		final IWorkbenchPartSite wbPartSite = Mockito.mock(IWorkbenchPartSite.class);

+		final IViewSite viewSite = Mockito.mock(IViewSite.class);

+		final IActionBars actionBars = Mockito.mock(IActionBars.class);

+		Mockito.stub(actionBars.getToolBarManager()).toReturn(null);

+		Mockito.stub(viewSite.getActionBars()).toReturn(actionBars);

+

+		favoritesView = new SearchFavoritesView()

+		{

+			@Override

+			public IWorkbenchPartSite getSite()

+			{

+				return wbPartSite;

+			}

+

+			@Override

+			public IViewSite getViewSite()

+			{

+				return viewSite;

+			}

+		};

+		favoritesView.registerViewCustomization(viewCustomization);

+		favoritesView.createPartControl(favoritesComposite);

+		favoritesView.setEnvironment(env);

+

+		final Composite helperComposite = new Composite(parent, SWT.BORDER);

+		helperComposite.setLayout(new FillLayout(SWT.VERTICAL));

+		dragHelperTreeViewer = createDragHelperViewer(helperComposite);

+		parent.layout(true, true);

+	}

+

+	private TreeViewer createDragHelperViewer(final Composite parent)

+	{

+		final Label l = new Label(parent, SWT.NONE);

+		l.setText(DRAG_SOURCE_TREE);

+

+		final TreeViewer viewer = new TreeViewer(parent, SWT.BORDER);

+		viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

+

+		viewer.setContentProvider(dragHelperContentProvider);

+		viewer.setLabelProvider(viewCustomization.getLabelProvider());

+		viewer.addDragSupport(DND.DROP_COPY | DND.DROP_MOVE, new Transfer[] { LocalContextSelectionTransfer.getTransfer() }, new DragSourceAdapter()

+		{

+			@Override

+			public void dragSetData(DragSourceEvent event)

+			{

+				if (LocalContextSelectionTransfer.getTransfer().isSupportedType(event.dataType))

+				{

+					final IContextStructuredSelection selection = structuredSelection();

+					LocalContextSelectionTransfer.getTransfer().setSelection(selection);

+					event.data = selection;

+				}

+			}

+

+			@Override

+			public void dragStart(DragSourceEvent event)

+			{

+				event.doit = !viewer.getSelection().isEmpty();

+				if (event.doit)

+				{

+					LocalContextSelectionTransfer.getTransfer().setSelection(structuredSelection());

+					LocalSelectionTransfer.getTransfer().setSelection(structuredSelection());

+				}

+			}

+

+			@SuppressWarnings("unchecked")

+			private IContextStructuredSelection structuredSelection()

+			{

+				final Iterator<Object> it = ((IStructuredSelection) viewer.getSelection()).iterator();

+				final List<Object> selectedObjects = new ArrayList<Object>();

+				while (it.hasNext())

+				{

+					selectedObjects.add(it.next());

+				}

+				final ISearchDestination destination = Mockito.mock(ISearchDestination.class);

+

+				final ISearchParameters parameters = Mockito.mock(ISearchParameters.class);

+				Mockito.stub(parameters.getSearchDestination()).toReturn(destination);

+

+				final ISearchContext ctx = Mockito.mock(ISearchContext.class);

+				Mockito.stub(ctx.searchParameters()).toReturn(parameters);

+				return new ContextStructuredSelection(selectedObjects, ctx);

+			}

+		});

+		viewer.setInput(new Object[0]);

+		viewer.refresh();

+

+		return viewer;

+	}

+

+	public boolean canCancelRunningOperation()

+	{

+		if (!isOperationRunning())

+		{

+			return false;

+		}

+

+		return findCancelButton().isEnabled();

+	}

+

+	public boolean isOperationRunning()

+	{

+		// The progress bar appears after 500ms of work (check org.eclipse.jface.action.StatusLine.beginTask(String, int) implementation for details).

+		// This is why the delay here is needed

+		SWTUtils.sleep(1000);

+

+		try

+		{

+			findCancelButton();

+			return true;

+		}

+		catch (WidgetNotFoundException e)

+		{

+			return false;

+		}

+	}

+

+	private SWTBotToolItem findCancelButton()

+	{

+		return new SWTBotToolItem(botUtils.findOneChildControlOfExactType(shell().widget, ToolItem.class, true));

+	}

+

+	public void completeInitialization()

+	{

+		syncExec(new VoidResult()

+		{

+			@Override

+			public void run()

+			{

+				favoritesView.initializationCompleted();

+			}

+		});

+	}

+

+	public void showFavorites(final Set<Object> favorites)

+	{

+		syncExec(new VoidResult()

+		{

+			@Override

+			public void run()

+			{

+				favoritesView.showFavorites(favorites);

+			}

+		});

+	}

+

+	public void registerController(final ISearchFavoritesMasterController masterController)

+	{

+		syncExec(new VoidResult()

+		{

+			@Override

+			public void run()

+			{

+				favoritesView.registerController(masterController);

+				favoritesView.initializationCompleted();

+				favoritesView.showFavorites(new HashSet<Object>());

+				shell().widget.layout(true, true);

+			}

+		});

+	}

+

+	public void dragToFavorites(final Object draggedItem)

+	{

+		final SWTBotTree dragHelperTree = new SWTBotTree(dragHelperTreeViewer.getTree());

+		final SWTBotTreeItem draggedTreeItem = dragHelperTree.getTreeItem(draggedItem.toString());

+		dndUtil.dragAndDrop(draggedTreeItem, findFavoritesTree());

+	}

+

+	private SWTBotTree findFavoritesTree()

+	{

+		return new SWTBotTree(botUtils.findSibling(bot().label(FAVORITES_LABEL), Tree.class));

+	}

+

+	public boolean isFavoritesItemDisplayed(final Object itemToSearchFor, final Object parentItem)

+	{

+		return isChildItemDisplayed(itemToSearchFor, parentItem);

+	}

+

+	private boolean isChildItemDisplayed(final Object itemToSearchFor, final Object parentItem)

+	{

+		final SWTBotTreeItem rootItem = findFavoritesRootItem(parentItem);

+		try

+		{

+			findItem(rootItem, itemToSearchFor);

+			return true;

+		}

+		catch (WidgetNotFoundException e)

+		{

+			return false;

+		}

+	}

+

+	public boolean isFavoritesRootItemDisplayed(Object itemToSearchFor)

+	{

+		try

+		{

+			findFavoritesRootItem(itemToSearchFor);

+			return true;

+		}

+		catch (WidgetNotFoundException e)

+		{

+			return false;

+		}

+	}

+

+	private SWTBotTreeItem findFavoritesRootItem(final Object itemToSearchFor)

+	{

+		final SWTBotTreeItem treeItem = findItemAmong(findFavoritesTree().getAllItems(), itemToSearchFor);

+		if (treeItem == null)

+		{

+			throw new WidgetNotFoundException(MessageFormat.format("Root favorites item {0} not found", itemToSearchFor.toString()));

+		}

+		return treeItem;

+	}

+

+	private SWTBotTreeItem findItem(final SWTBotTreeItem parent, final Object itemToSearchFor)

+	{

+		final SWTBotTreeItem treeItem = findItemAmong(parent.getItems(), itemToSearchFor);

+		if (treeItem == null)

+		{

+			throw new WidgetNotFoundException(MessageFormat.format("Child {0} of parent {1} not found", itemToSearchFor.toString(), parent.toString()));

+		}

+		return treeItem;

+	}

+

+	private SWTBotTreeItem findItemAmong(final SWTBotTreeItem[] allItems, final Object itemToSearchFor)

+	{

+		for (SWTBotTreeItem item : allItems)

+		{

+			if (getData(item.widget) == itemToSearchFor)

+			{

+				return item;

+			}

+		}

+

+		return null;

+	}

+

+	private Object getData(final TreeItem widget)

+	{

+		return syncExec(new Result<Object>()

+		{

+			@Override

+			public Object run()

+			{

+				return widget.getData();

+			}

+		});

+	}

+

+	public void dragFromFavorites(final Object parent, final Object itemToDrag)

+	{

+		final SWTBotTreeItem treeItem = findItemAmong(findFavoritesRootItem(parent).getItems(), itemToDrag);

+		dndUtil.dragAndDrop(treeItem, new SWTBotTree(dragHelperTreeViewer.getTree()));

+	}

+

+	public DragHelperTreePageObject getDragHelper()

+	{

+		return new DragHelperTreePageObject();

+	}

+

+	public class DragHelperTreePageObject

+	{

+		public void addDropSupport(final int operations, final Transfer[] transferTypes, final DropTargetListener dropTargetListener)

+		{

+			syncExec(new VoidResult()

+			{

+				@Override

+				public void run()

+				{

+					dragHelperTreeViewer.addDropSupport(operations, transferTypes, dropTargetListener);

+				}

+			});

+		}

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/SubdestinationsSelectorPageObject.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/SubdestinationsSelectorPageObject.java
new file mode 100644
index 0000000..11a1867
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/SubdestinationsSelectorPageObject.java
@@ -0,0 +1,70 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects;

+

+import org.eclipse.platform.discovery.ui.api.ISearchParametersUI.IConsoleContext;

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.SWTBotSubdSelector;

+import org.eclipse.swt.widgets.Shell;

+import org.eclipse.swtbot.swt.finder.SWTBot;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;

+import org.eclipse.ui.forms.widgets.FormToolkit;

+

+public class SubdestinationsSelectorPageObject extends InShellPageObject

+{

+	private final IConsoleContext consoleContext;

+	private SWTBotSubdSelector selector;

+

+	public SubdestinationsSelectorPageObject(final IConsoleContext consoleContext)

+	{

+		this.consoleContext = consoleContext;

+	}

+

+	@Override

+	protected void createContent(final Shell parent, final FormToolkit formToolkit)

+	{

+	}

+

+	@Override

+	protected Shell createShell()

+	{

+		selector = SWTBotSubdSelector.open(new SWTBot().activeShell(), consoleContext);

+		return selector.widget;

+	}

+

+	public boolean isDisplayed(final String subdestinationName)

+	{

+		try

+		{

+			subdestinationCheckbox(subdestinationName);

+			return true;

+		}

+		catch (WidgetNotFoundException e)

+		{

+			return false;

+		}

+	}

+

+	public boolean isSelected(final String subdestinationName)

+	{

+		return subdestinationCheckbox(subdestinationName).isChecked();

+	}

+

+	private SWTBotCheckBox subdestinationCheckbox(final String subdestName)

+	{

+		return selector.subdestinationCheckbox(subdestName);

+	}

+

+	public void toggle(final String subdestinationName)

+	{

+		subdestinationCheckbox(subdestinationName).click();

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/TextControlPageObject.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/TextControlPageObject.java
index 598b227..c3c0b35 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/TextControlPageObject.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/TextControlPageObject.java
@@ -1,10 +1,24 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

 package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects;

 

+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;

+

 import org.eclipse.platform.discovery.ui.internal.view.impl.TextControl;

 import org.eclipse.swt.SWT;

 import org.eclipse.swt.widgets.Label;

 import org.eclipse.swt.widgets.Shell;

 import org.eclipse.swt.widgets.Text;

+import org.eclipse.swtbot.swt.finder.results.StringResult;

+import org.eclipse.swtbot.swt.finder.results.VoidResult;

 import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;

 import org.eclipse.ui.forms.widgets.FormToolkit;

 

@@ -28,14 +42,15 @@
 

 	public String get()

 	{

-		return new RunInUI<String>(display())

+		return syncExec(new StringResult()

 		{

+			

 			@Override

-			protected String perform()

+			public String run()

 			{

 				return textControl.get();

 			}

-		}.getResult();

+		});

 	}

 

 	public String getDisplayedText()

@@ -45,29 +60,27 @@
 

 	public void setEnabled(final boolean enabled)

 	{

-		new RunInUI<Void>(display())

+		syncExec(new VoidResult()

 		{

-

+			

 			@Override

-			protected Void perform()

+			public void run()

 			{

 				textControl.setEnabled(enabled);

-				return null;

 			}

-		};

+		});

 	}

 

 	public void setMessage(final String message)

 	{

-		new RunInUI<Void>(display())

+		syncExec(new VoidResult()

 		{

 			@Override

-			protected Void perform()

+			public void run()

 			{

 				textControl.setMessage(message);

-				return null;

 			}

-		};

+		});

 	}

 

 	private SWTBotText swtBotText()

@@ -77,14 +90,14 @@
 

 	public String getMessage()

 	{

-		return new RunInUI<String>(display())

+		return syncExec(new StringResult()

 		{

 			@Override

-			protected String perform()

+			public String run()

 			{

 				return textControl.getControl().getMessage();

 			}

-		}.getResult();

+		});

 	}

 

 	public void focus()

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/ViewProgressMonitorPageObject.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/ViewProgressMonitorPageObject.java
index 70c3198..3aef8e0 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/ViewProgressMonitorPageObject.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/ViewProgressMonitorPageObject.java
@@ -1,5 +1,17 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

 package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects;

 

+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;

+

 import java.util.Arrays;

 

 import org.eclipse.platform.discovery.ui.internal.view.ViewProgressMonitor;

@@ -8,6 +20,8 @@
 import org.eclipse.swt.widgets.Button;

 import org.eclipse.swt.widgets.Control;

 import org.eclipse.swt.widgets.Shell;

+import org.eclipse.swtbot.swt.finder.results.BoolResult;

+import org.eclipse.swtbot.swt.finder.results.VoidResult;

 import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;

 import org.eclipse.ui.forms.widgets.FormToolkit;

 

@@ -27,15 +41,14 @@
 

 	public void beginTask(final String name, final int totalWork)

 	{

-		new RunInUI<Void>(display())

+		syncExec(new VoidResult()

 		{

 			@Override

-			protected Void perform()

+			public void run()

 			{

 				testMonitor.beginTask(name, totalWork);

-				return null;

 			}

-		};

+		});

 	}

 

 	public boolean isControlsEnabled()

@@ -45,15 +58,14 @@
 

 	public void done()

 	{

-		new RunInUI<Void>(display())

+		syncExec(new VoidResult()

 		{

 			@Override

-			protected Void perform()

+			public void run()

 			{

 				testMonitor.done();

-				return null;

 			}

-		};

+		});

 	}

 

 	public void cancel()

@@ -68,13 +80,14 @@
 

 	public boolean isCanceled()

 	{

-		return new RunInUI<Boolean>(display())

+		return syncExec(new BoolResult()

 		{

+			

 			@Override

-			protected Boolean perform()

+			public Boolean run()

 			{

 				return testMonitor.isCanceled();

 			}

-		}.getResult();

+		});

 	}

 }

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotCheckboxWithMouseInteraction.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotCheckboxWithMouseInteraction.java
new file mode 100644
index 0000000..bda9259
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotCheckboxWithMouseInteraction.java
@@ -0,0 +1,68 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot;

+

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.utils.MouseUtils;

+import org.eclipse.swt.widgets.Button;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.utils.SWTUtils;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;

+

+/**

+ * Extender of {@link SWTBotCheckBox} which is used for checkboxes in a tooltip. In contrast to {@link SWTBotCheckBox} this implementation uses the

+ * mouse to check the checkbox thus preventing the tooltip from closing

+ * 

+ * @author Danail Branekov

+ * 

+ */

+class SWTBotCheckboxWithMouseInteraction extends SWTBotCheckBox

+{

+	private final MouseUtils mouseUtils;

+	

+	SWTBotCheckboxWithMouseInteraction(Button w) throws WidgetNotFoundException

+	{

+		super(w);

+		this.mouseUtils = new MouseUtils(SWTUtils.display());

+	}

+

+	@Override

+	public SWTBotCheckBox click()

+	{

+		this.toggle();

+		return this;

+	}

+

+	@Override

+	public void deselect()

+	{

+		if(this.isChecked())

+		{

+			this.click();

+		}

+	}

+

+	@Override

+	public void select()

+	{

+		if(this.isChecked())

+		{

+			return;

+		}

+		

+		this.click();

+	}

+

+	@Override

+	protected void toggle()

+	{

+		mouseUtils.clickOn(this);		

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotDiscoveredTreeItem.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotDiscoveredTreeItem.java
new file mode 100644
index 0000000..69db473
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotDiscoveredTreeItem.java
@@ -0,0 +1,47 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot;

+

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.utils.MouseUtils;

+import org.eclipse.swt.widgets.TreeItem;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.utils.SWTUtils;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;

+

+/**

+ * SWTBot which provides features specific to items displayed in the result section of the search console

+ * @author Danail Branekov

+ */

+public class SWTBotDiscoveredTreeItem extends SWTBotTreeItem

+{

+	private final MouseUtils mouseUtils;

+

+	public SWTBotDiscoveredTreeItem(final TreeItem treeItem) throws WidgetNotFoundException

+	{

+		super(treeItem);

+		this.mouseUtils = new MouseUtils(SWTUtils.display());

+	}

+

+	public void hoverMouse()

+	{

+		mouseUtils().hoverOn(this);

+	}

+

+	public void moveMouseAway()

+	{

+		mouseUtils().moveAwayFrom(this);

+	}

+

+	private MouseUtils mouseUtils()

+	{

+		return mouseUtils;

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotDiscoveryTree.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotDiscoveryTree.java
new file mode 100644
index 0000000..6bf08b8
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotDiscoveryTree.java
@@ -0,0 +1,80 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot;

+

+import java.util.Arrays;

+import java.util.HashSet;

+

+import org.eclipse.platform.discovery.ui.api.IResultsViewAccessor;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.results.VoidResult;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;

+

+/**

+ * Extension of {@link SWTBotTree} which provides additional features for the results tree in the search console

+ * 

+ * @author Danail Branekov

+ * 

+ */

+public class SWTBotDiscoveryTree extends SWTBotTree

+{

+	private final IResultsViewAccessor accessor;

+

+	public SWTBotDiscoveryTree(final IResultsViewAccessor accessor)

+	{

+		super(accessor.getTreeViewer().getTree());

+		this.accessor = accessor;

+	}

+

+	public boolean isTooltipDisplayed(final String toolipHeadCaption)

+	{

+		try

+		{

+			final SWTBotTooltip tooltip = SWTBotTooltip.tooltip();

+			tooltip.bot().label(toolipHeadCaption);

+			return true;

+		}

+		catch (WidgetNotFoundException e)

+		{

+			return false;

+		}

+	}

+

+	public boolean isTreeItemDisplayed(final String treeItemLabel)

+	{

+		return discoveredTreeItem(treeItemLabel) != null;

+	}

+

+	public SWTBotDiscoveredTreeItem discoveredTreeItem(final String tiLabel)

+	{

+		for (SWTBotTreeItem ti : this.getAllItems())

+		{

+			if (ti.getText().equals(tiLabel))

+			{

+				return new SWTBotDiscoveredTreeItem(ti.widget);

+			}

+		}

+		return null;

+	}

+

+	public void setInput(final Object... items)

+	{

+		syncExec(new VoidResult()

+		{

+			@Override

+			public void run()

+			{

+				accessor.getTreeViewer().setInput(new HashSet<Object>(Arrays.asList(items)));

+			}

+		});

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotHyperlink.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotHyperlink.java
new file mode 100644
index 0000000..da11ae2
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotHyperlink.java
@@ -0,0 +1,35 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot;

+

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.utils.MouseUtils;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;

+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;

+import org.eclipse.ui.forms.widgets.Hyperlink;

+

+public class SWTBotHyperlink extends AbstractSWTBotControl<Hyperlink>

+{

+	private final MouseUtils mouseUtils;

+

+	public SWTBotHyperlink(Hyperlink w) throws WidgetNotFoundException

+	{

+		super(w);

+		this.mouseUtils = new MouseUtils(display);

+	}

+

+	public AbstractSWTBot<Hyperlink> click()

+	{

+		mouseUtils.clickOn(this);

+		return this;

+	}

+

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotSash.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotSash.java
index 7303feb..eb937fb 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotSash.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotSash.java
@@ -1,6 +1,17 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

 package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot;

 

 import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.SashOrientation;

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.utils.DndUtil;

 import org.eclipse.swt.graphics.Point;

 import org.eclipse.swt.graphics.Rectangle;

 import org.eclipse.swt.widgets.Composite;

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotSection.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotSection.java
new file mode 100644
index 0000000..bac4e91
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotSection.java
@@ -0,0 +1,72 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot;

+

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.utils.MouseUtils;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.results.BoolResult;

+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;

+import org.eclipse.ui.forms.widgets.Section;

+

+/**

+ * SWTBot for {@link Section}. The implementation expands and collapses the section via mouse interaction. The reason for this is that calling

+ * {@link Section#setExpanded(boolean)} does broadcast selection events. This is important for the search console since the section title is expected

+ * to change when the section expansion state changes

+ * 

+ * @author Danail Branekov

+ * 

+ */

+public class SWTBotSection extends AbstractSWTBotControl<Section>

+{

+	private final MouseUtils mouseUtils;

+

+	public SWTBotSection(Section w) throws WidgetNotFoundException

+	{

+		super(w);

+		this.mouseUtils = new MouseUtils(display);

+	}

+

+	public void toggle()

+	{

+		mouseUtils.clickOn(this, 10, 5);

+		

+	};

+

+	private boolean isExpanded()

+	{

+		return syncExec(new BoolResult()

+		{

+			@Override

+			public Boolean run()

+			{

+				return widget.isExpanded();

+			}

+		});

+	}

+

+	public void expand()

+	{

+		if (isExpanded())

+		{

+			return;

+		}

+		toggle();

+	}

+

+	public void collapse()

+	{

+		if (!isExpanded())

+		{

+			return;

+		}

+		toggle();

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotSubdSelector.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotSubdSelector.java
new file mode 100644
index 0000000..d5f194e
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotSubdSelector.java
@@ -0,0 +1,104 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot;

+

+import org.eclipse.platform.discovery.ui.api.ISearchParametersUI.IConsoleContext;

+import org.eclipse.platform.discovery.ui.internal.view.impl.SubdestinationsSelectedListener;

+import org.eclipse.swt.events.SelectionEvent;

+import org.eclipse.swt.graphics.Rectangle;

+import org.eclipse.swt.widgets.Control;

+import org.eclipse.swt.widgets.Display;

+import org.eclipse.swt.widgets.Event;

+import org.eclipse.swt.widgets.Shell;

+import org.eclipse.swtbot.swt.finder.SWTBot;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;

+import org.eclipse.swtbot.swt.finder.results.Result;

+import org.eclipse.swtbot.swt.finder.results.VoidResult;

+import org.eclipse.swtbot.swt.finder.utils.SWTUtils;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;

+

+/**

+ * SWTBot for subdestination selector

+ * 

+ * @author Danail Branekov

+ * 

+ */

+public class SWTBotSubdSelector extends SWTBotShell

+{

+	private static SubdestinationsSelectedListener subdestinationsListener;

+

+	private SWTBotSubdSelector(Shell shell) throws WidgetNotFoundException

+	{

+		super(shell);

+	}

+

+	public static SWTBotSubdSelector open(final SWTBotShell parent, final IConsoleContext consoleContext)

+	{

+		final SWTBot bot = new SWTBot();

+		subdestinationsListener = new SubdestinationsSelectedListener(parent.widget, consoleContext);

+		UIThreadRunnable.syncExec(new VoidResult()

+		{

+			@Override

+			public void run()

+			{

+				subdestinationsListener.widgetSelected(createSelectionEvent());

+			}

+		});

+		return new SWTBotSubdSelector(getShell(bot.getFocusedWidget()));

+	}

+

+	public SWTBotCheckBox subdestinationCheckbox(final String subdestName)

+	{

+		return new SWTBotCheckboxWithMouseInteraction(bot().checkBox(subdestName).widget);

+	}

+

+	private static SelectionEvent createSelectionEvent()

+	{

+		final Rectangle rect = clientArea(display().getActiveShell());

+		final Event e = new Event();

+		e.x = rect.x + (rect.width / 2);

+		e.y = rect.y + (rect.height / 2);

+		e.widget = display().getActiveShell();

+

+		return new SelectionEvent(e);

+	}

+

+	private static Rectangle clientArea(final Shell shell)

+	{

+		return UIThreadRunnable.syncExec(new Result<Rectangle>()

+		{

+			@Override

+			public Rectangle run()

+			{

+				return shell.getClientArea();

+			}

+		});

+	}

+

+	private static Shell getShell(final Control control)

+	{

+		return UIThreadRunnable.syncExec(new Result<Shell>()

+		{

+			@Override

+			public Shell run()

+			{

+				return control.getShell();

+			}

+		});

+	}

+

+	private static Display display()

+	{

+		return SWTUtils.display();

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotTextWithMessage.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotTextWithMessage.java
new file mode 100644
index 0000000..fac7b46
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotTextWithMessage.java
@@ -0,0 +1,37 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot;

+

+import org.eclipse.swt.widgets.Text;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.results.StringResult;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;

+

+public class SWTBotTextWithMessage extends SWTBotText

+{

+	public SWTBotTextWithMessage(Text w) throws WidgetNotFoundException

+	{

+		super(w);

+	}

+

+	public String getMessage()

+	{

+		return syncExec(new StringResult()

+		{

+			@Override

+			public String run()

+			{

+				return widget.getMessage();

+			}

+		});

+	}

+

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotToolItem.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotToolItem.java
new file mode 100644
index 0000000..c7400e3
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotToolItem.java
@@ -0,0 +1,24 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot;

+

+import org.eclipse.swt.widgets.ToolItem;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;

+

+public class SWTBotToolItem extends AbstractSWTBot<ToolItem>

+{

+	public SWTBotToolItem(ToolItem w) throws WidgetNotFoundException

+	{

+		super(w);

+	}

+

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotTooltip.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotTooltip.java
new file mode 100644
index 0000000..d955649
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotTooltip.java
@@ -0,0 +1,67 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot;

+

+import org.eclipse.swt.SWT;

+import org.eclipse.swt.widgets.Label;

+import org.eclipse.swt.widgets.Shell;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.utils.SWTUtils;

+import org.eclipse.swtbot.swt.finder.utils.internal.Assert;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;

+import org.hamcrest.BaseMatcher;

+import org.hamcrest.Description;

+

+public class SWTBotTooltip extends SWTBotShell

+{

+	private final SwtBotUtils botUtils;

+

+	public SWTBotTooltip(Shell shell) throws WidgetNotFoundException

+	{

+		super(shell);

+		Assert.isTrue(SWTUtils.hasStyle(shell, SWT.TOOL), "Expecting a tooltip shell.");

+		botUtils = new SwtBotUtils();

+	}

+

+	public SWTBotLabel header()

+	{

+		return new SWTBotLabel((Label) botUtils.findOneChildControlOfExactType(this.widget, Label.class, true));

+	}

+

+	/**

+	 * A tooltip can be one at a time ("singleton") and therefore this static method tries to find the singleton instance

+	 * 

+	 * @return the currently tooltip currently displayed

+	 * @throw {@link WidgetNotFoundException} if the tooltip is not found

+	 */

+	public static SWTBotTooltip tooltip()

+	{

+		final SWTBotShell tooltipShell = new SwtBotUtils().findShell(new BaseMatcher<Shell>()

+		{

+			@Override

+			public boolean matches(Object item)

+			{

+				if (item instanceof SWTBotShell)

+				{

+					return SWTUtils.hasStyle(((SWTBotShell) item).widget, SWT.TOOL); // A tooltip's shell has the SWT.TOOL style

+				}

+				return false;

+			}

+

+			@Override

+			public void describeTo(Description description)

+			{

+			}

+		});

+		return new SWTBotTooltip(tooltipShell.widget);

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotTreeWithDropSupport.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotTreeWithDropSupport.java
new file mode 100644
index 0000000..db51f55
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SWTBotTreeWithDropSupport.java
@@ -0,0 +1,33 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot;

+

+import org.eclipse.jface.viewers.TreeViewer;

+import org.eclipse.swt.dnd.DropTargetListener;

+import org.eclipse.swt.dnd.Transfer;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;

+

+public class SWTBotTreeWithDropSupport extends SWTBotTree

+{

+	private final TreeViewer viewer;

+

+	public SWTBotTreeWithDropSupport(final TreeViewer viewer) throws WidgetNotFoundException

+	{

+		super(viewer.getTree());

+		this.viewer = viewer;

+	}

+	

+	public void addDropSupport(final int operations, final Transfer[] transferTypes, final DropTargetListener listener)

+	{

+		viewer.addDropSupport(operations, transferTypes, listener);

+	}

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SwtBotUtils.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SwtBotUtils.java
index 7e3ce1f..2524a03 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SwtBotUtils.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/SwtBotUtils.java
@@ -1,15 +1,34 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

 package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot;

 

+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;

+

+import java.text.MessageFormat;

+import java.util.Collection;

+import java.util.LinkedList;

 import java.util.List;

 

+import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.utils.RecursiveSiblingFinder;

 import org.eclipse.swt.SWT;

 import org.eclipse.swt.widgets.Control;

+import org.eclipse.swt.widgets.Shell;

 import org.eclipse.swt.widgets.Widget;

+import org.eclipse.swtbot.swt.finder.SWTBot;

 import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

 import org.eclipse.swtbot.swt.finder.finders.ChildrenControlFinder;

 import org.eclipse.swtbot.swt.finder.finders.ControlFinder;

 import org.eclipse.swtbot.swt.finder.utils.SWTUtils;

 import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;

 import org.hamcrest.BaseMatcher;

 import org.hamcrest.Description;

 import org.hamcrest.Matcher;

@@ -38,7 +57,12 @@
 			throws WidgetNotFoundException, MultipleWidgetsFoundException {

 		return findOneChild(new ChildrenControlFinder(parent), new ClassEquals<ResultType>(clazz), shouldBeVisible);

 	}

-

+	

+	public <ResultType extends Widget> ResultType findOneChildControl(Widget parent, Matcher<ResultType> matcher, boolean shouldBeVisible)

+			throws WidgetNotFoundException, MultipleWidgetsFoundException {

+		return findOneChild(new ChildrenControlFinder(parent), matcher, shouldBeVisible);

+	}

+	

 	private <ResultType extends Widget> ResultType findOneChild(ControlFinder finder, Matcher<ResultType> matcher, boolean shouldBeVisible) {

 		finder.shouldFindInVisibleControls = !shouldBeVisible;

 		List<ResultType> result = finder.findControls(matcher);

@@ -51,6 +75,46 @@
 		return result.get(0);

 	}

 	

+	public SWTBotShell findShell(final Matcher<Shell> shellMather)	{

+		final Collection<SWTBotShell> foundShells = new LinkedList<SWTBotShell>();

+		for(SWTBotShell shell : new SWTBot().shells()) {

+			if(shellMather.matches(shell)) {

+				foundShells.add(shell);

+			}

+		}

+		if(foundShells.size() == 0) {

+			throw new WidgetNotFoundException(null);

+		}

+		if(foundShells.size() > 1) {

+			throw new MultipleWidgetsFoundException(null);

+		}

+		return foundShells.iterator().next();

+	}

+	

+	/**

+	 * Finds a widget of a given type which belongs to the same composite as the widget specified 

+	 * @param siblingWidget the widget which belongs to the composite to search in

+	 * @param targetClass the type of the widget to search for

+	 * @return the sibling widget found

+	 * @throws WidgetNotFoundException if no such sibling is found

+	 */

+	@SuppressWarnings("unchecked")

+	public <T extends Widget> T findSibling(final AbstractSWTBot<? extends Control> siblingWidget, final Class<T> targetClass) {

+		final Matcher<T> instanceofMatcher = new InstanceOf<T>(targetClass);

+		for (Widget sibling : syncExec(new RecursiveSiblingFinder(siblingWidget.widget))) {

+			if(sibling == siblingWidget.widget) {

+				// Not interested in the widget passed as parameter

+				continue;

+			}

+			

+			if(instanceofMatcher.matches(sibling)) {

+				return (T) sibling;

+			}

+		}

+

+		throw new WidgetNotFoundException(MessageFormat.format("No sibling to {0} of type {1} not found", siblingWidget.toString(), targetClass.getSimpleName()));

+	}

+	

 	private static class InstanceOf <T extends Widget> extends BaseMatcher<T> {

 		private final Class<T> clazz;

 

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/DndUtil.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/utils/DndUtil.java
similarity index 83%
rename from tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/DndUtil.java
rename to tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/utils/DndUtil.java
index 9b0e586..b646cac 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/DndUtil.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/utils/DndUtil.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2010 Obeo Corporation and others.

+ * Copyright (c) 2010, 2011 Obeo Corporation and others.

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

  * which accompanies this distribution, and is available at

@@ -9,28 +9,23 @@
  *     Mariot Chauvin <mariot.chauvin@obeo.fr> - initial API and implementation

  *******************************************************************************/

 

-package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot;

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.utils;

 

 import java.awt.AWTException;

 import java.awt.Robot;

 import java.awt.event.InputEvent;

-import java.lang.reflect.InvocationTargetException;

-import java.lang.reflect.Method;

 

 import org.eclipse.jface.util.Geometry;

 import org.eclipse.swt.SWT;

+import org.eclipse.swt.dnd.DND;

 import org.eclipse.swt.graphics.Point;

 import org.eclipse.swt.graphics.Rectangle;

 import org.eclipse.swt.widgets.Display;

-import org.eclipse.swt.widgets.TreeItem;

 import org.eclipse.swt.widgets.Widget;

-import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

 import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;

-import org.eclipse.swtbot.swt.finder.results.Result;

 import org.eclipse.swtbot.swt.finder.results.VoidResult;

 import org.eclipse.swtbot.swt.finder.utils.SWTUtils;

 import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;

-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;

 

 /**

  * A dnd utility class to help performing drag and drop. This code will be in

@@ -177,6 +172,9 @@
                     awtRobot.mouseRelease(InputEvent.BUTTON1_MASK);

                 }

             });

+            

+            /* delay while drop listeners take action*/

+            SWTUtils.sleep(DRAG_DELAY);

         } catch (final AWTException e) {

             // log.error(e.getMessage(), e);

             throw new RuntimeException(e);

@@ -253,51 +251,6 @@
     }

 

     private static <T extends Widget> Rectangle absoluteLocation(final AbstractSWTBot<T> item) {

-        AbstractSWTBot<?> bot = null;

-        if (item instanceof SWTBotTreeItem) {

-            bot = new SWTBotTreeItemForDnd(((SWTBotTreeItem) item).widget);

-        }else {

-            bot = item;

-        }

-        Object result = null;

-        try {

-            Method m = AbstractSWTBot.class.getDeclaredMethod("absoluteLocation");

-            m.setAccessible(true);

-            result = m.invoke(bot);

-        } catch (SecurityException e) {

-            // do nothing

-        } catch (NoSuchMethodException e) {

-            // do nothing

-        } catch (IllegalArgumentException e) {

-            // do nothing

-        } catch (IllegalAccessException e) {

-            // do nothing

-        } catch (InvocationTargetException e) {

-            // do nothing

-        }

-        return (Rectangle) result;

+    	return LocationUtils.absoluteLocation(item);

     }

-

-    /**

-     * Subclass to return the correct absolute location.

-     * 

-     * @author mchauvin

-     */

-    private static class SWTBotTreeItemForDnd extends SWTBotTreeItem {

-

-        public SWTBotTreeItemForDnd(TreeItem treeItem) throws WidgetNotFoundException {

-            super(treeItem);

-        }

-

-        @Override

-        protected Rectangle absoluteLocation() {

-            return UIThreadRunnable.syncExec(new Result<Rectangle>() {

-                public Rectangle run() {

-                    return display.map(widget.getParent(), null, widget.getBounds());

-                }

-            });

-        }

-

-    }

-

 }

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/utils/LocationUtils.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/utils/LocationUtils.java
new file mode 100644
index 0000000..f88b610
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/utils/LocationUtils.java
@@ -0,0 +1,85 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.utils;

+

+import java.lang.reflect.InvocationTargetException;

+import java.lang.reflect.Method;

+

+import org.eclipse.swt.graphics.Rectangle;

+import org.eclipse.swt.widgets.Control;

+import org.eclipse.swt.widgets.TreeItem;

+import org.eclipse.swt.widgets.Widget;

+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;

+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;

+import org.eclipse.swtbot.swt.finder.results.Result;

+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;

+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;

+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;

+

+class LocationUtils

+{

+    static <T extends Widget> Rectangle absoluteLocation(final AbstractSWTBot<T> item) {

+        AbstractSWTBot<?> bot = botFor(item);

+        Object result = null;

+        try {

+            Method m = AbstractSWTBot.class.getDeclaredMethod("absoluteLocation");

+            m.setAccessible(true);

+            result = m.invoke(bot);

+        } catch (SecurityException e) {

+            // do nothing

+        } catch (NoSuchMethodException e) {

+            // do nothing

+        } catch (IllegalArgumentException e) {

+            // do nothing

+        } catch (IllegalAccessException e) {

+            // do nothing

+        } catch (InvocationTargetException e) {

+            // do nothing

+        }

+        return (Rectangle) result;

+    }

+    

+	private static AbstractSWTBot<?> botFor(final AbstractSWTBot<?> bot) {

+        if (bot instanceof SWTBotTreeItem) {

+            return new SWTBotTreeItemForDnd(((SWTBotTreeItem) bot).widget);

+        } 

+        if(bot instanceof AbstractSWTBot) {

+        	final Widget w = bot.widget;

+        	if(w instanceof Control) {

+        		return new AbstractSWTBotControl<Control>((Control)w);

+        	}

+        }

+        

+        return bot;

+    }

+    

+    /**

+     * Subclass to return the correct absolute location.

+     * 

+     * @author mchauvin

+     */

+    private static class SWTBotTreeItemForDnd extends SWTBotTreeItem {

+

+        public SWTBotTreeItemForDnd(TreeItem treeItem) throws WidgetNotFoundException {

+            super(treeItem);

+        }

+

+        @Override

+        protected Rectangle absoluteLocation() {

+            return UIThreadRunnable.syncExec(new Result<Rectangle>() {

+                public Rectangle run() {

+                    return display.map(widget.getParent(), null, widget.getBounds());

+                }

+            });

+        }

+

+    }

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/utils/MouseUtils.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/utils/MouseUtils.java
new file mode 100644
index 0000000..6c57377
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/utils/MouseUtils.java
@@ -0,0 +1,182 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.utils;

+

+import java.awt.AWTException;

+import java.awt.Robot;

+import java.awt.event.InputEvent;

+

+import org.eclipse.swt.graphics.Point;

+import org.eclipse.swt.graphics.Rectangle;

+import org.eclipse.swt.widgets.Display;

+import org.eclipse.swt.widgets.Widget;

+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;

+import org.eclipse.swtbot.swt.finder.results.VoidResult;

+import org.eclipse.swtbot.swt.finder.utils.SWTUtils;

+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;

+

+/**

+ * Utility which comes in handy when interaction with the mouse is necessary. Typically you should rely on the SWTBot API but there are few rare cases

+ * when it is not sufficient

+ * 

+ * @author Danail Branekov

+ */

+public class MouseUtils

+{

+	private static final int MOVE_TO_WIDGET_OFFSET = 2;

+	private static final long HOVER_TIMEOUT = 2000;

+	private final Display display;

+

+	public MouseUtils(final Display display)

+	{

+		this.display = display;

+	}

+

+	/**

+	 * Moves the mouse to the widget specified. The mouse cursor is moved to 2 points left and 2 point below the widget rectangle top-left corner

+	 * 

+	 * @param widget

+	 *            the widget to move to

+	 */

+	public void moveMouseTo(final AbstractSWTBot<? extends Widget> widget)

+	{

+		moveMouseTo(widget, MOVE_TO_WIDGET_OFFSET, MOVE_TO_WIDGET_OFFSET);

+	}

+

+	/**

+	 * Moves the mouse to the widget specified. The mouse cursor is moved to 2 points left and 2 point below the widget rectangle top-left corner

+	 * 

+	 * @param widget

+	 *            the widget to move to

+	 * @param x_offset

+	 *            abcis offset relative to the top-left corner of the widget

+	 * @param y_offset

+	 *            ordinate offset relative to the top-left corner of the widget

+	 */

+	public void moveMouseTo(final AbstractSWTBot<? extends Widget> widget, final int x_offset, final int y_offset)

+	{

+		final Point targetPoint = topLeftCorner(widget);

+		moveMouseTo(new Point(targetPoint.x + x_offset, targetPoint.y + y_offset));

+	}

+

+	private void moveMouseTo(final Point point)

+	{

+		final Robot awtRobot = awtRobot();

+		syncExec(new VoidResult()

+		{

+			@Override

+			public void run()

+			{

+				awtRobot.mouseMove(point.x, point.y);

+			}

+		});

+		forceAsynchronousEventsToBeProcessed();

+	}

+

+	/**

+	 * Moves the mouse to the widget and performs a left button click

+	 * 

+	 * @param widget

+	 *            the widget to click on

+	 */

+	public void clickOn(final AbstractSWTBot<? extends Widget> widget)

+	{

+		moveMouseTo(widget);

+		click();

+	}

+

+	/**

+	 * Moves the mouse to the widget and performs a left button click

+	 * 

+	 * @param x_offset

+	 *            abcis offset relative to the top-left corner of the widget

+	 * @param y_offset

+	 *            ordinate offset relative to the top-left corner of the widget

+	 * @param widget

+	 *            the widget to click on

+	 */

+	public void clickOn(final AbstractSWTBot<? extends Widget> widget, final int x_offset, final int y_offset)

+	{

+		moveMouseTo(widget, x_offset, y_offset);

+		click();

+	}

+

+	/**

+	 * Hovers on a widget. The implementation would move the mouse to the widget and wait some time

+	 */

+	public void hoverOn(AbstractSWTBot<? extends Widget> widget)

+	{

+		moveMouseTo(widget);

+		SWTUtils.sleep(HOVER_TIMEOUT);

+	}

+

+	public void moveAwayFrom(AbstractSWTBot<? extends Widget> widget)

+	{

+		final Rectangle widgetLocation = location(widget);

+		final int targetX = (widgetLocation.x > MOVE_TO_WIDGET_OFFSET) ? (widgetLocation.x - MOVE_TO_WIDGET_OFFSET) : (widgetLocation.x + widgetLocation.width + MOVE_TO_WIDGET_OFFSET);

+		final int targetY = (widgetLocation.y > MOVE_TO_WIDGET_OFFSET) ? (widgetLocation.y - MOVE_TO_WIDGET_OFFSET) : (widgetLocation.y + widgetLocation.height + MOVE_TO_WIDGET_OFFSET);

+		moveMouseTo(new Point(targetX, targetY));

+	}

+

+	private void click()

+	{

+		final Robot awtRobot = awtRobot();

+		syncExec(new VoidResult()

+		{

+			@Override

+			public void run()

+			{

+				awtRobot.mousePress(InputEvent.BUTTON1_MASK);

+				awtRobot.mouseRelease(InputEvent.BUTTON1_MASK);

+			}

+		});

+		forceAsynchronousEventsToBeProcessed();

+	}

+

+	private Robot awtRobot()

+	{

+		try

+		{

+			return new Robot();

+		}

+		catch (AWTException e)

+		{

+			throw new RuntimeException(e);

+		}

+	}

+

+	private Point topLeftCorner(AbstractSWTBot<? extends Widget> widget)

+	{

+		final Rectangle widgetLocation = location(widget);

+		return new Point(widgetLocation.x, widgetLocation.y);

+	}

+

+	private Rectangle location(AbstractSWTBot<? extends Widget> widget)

+	{

+		return LocationUtils.absoluteLocation(widget);

+	}

+

+	private void syncExec(VoidResult toExecute)

+	{

+		UIThreadRunnable.syncExec(display, toExecute);

+	}

+

+	void forceAsynchronousEventsToBeProcessed()

+	{

+		display.syncExec(new Runnable()

+		{

+			public void run()

+			{

+			}

+		});

+	}

+

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/utils/RecursiveSiblingFinder.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/utils/RecursiveSiblingFinder.java
new file mode 100644
index 0000000..f1bd74c
--- /dev/null
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/test/comp/internal/pageobjects/swtbot/utils/RecursiveSiblingFinder.java
@@ -0,0 +1,50 @@
+/*******************************************************************************

+ * Copyright (c) 2011 SAP AG, Walldorf.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *     SAP AG - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.swtbot.utils;

+

+import java.util.Arrays;

+import java.util.LinkedList;

+

+import org.eclipse.swt.widgets.Composite;

+import org.eclipse.swt.widgets.Control;

+import org.eclipse.swt.widgets.Widget;

+import org.eclipse.swtbot.swt.finder.results.ArrayResult;

+

+public class RecursiveSiblingFinder implements ArrayResult<Widget>

+{

+	private final Control seedControl;

+

+	public RecursiveSiblingFinder(final Control control)

+	{

+		this.seedControl = control;

+	}

+

+	@Override

+	public Widget[] run()

+	{

+		return children(seedControl.getParent());

+	}

+

+	private Widget[] children(final Composite parent)

+	{

+		final LinkedList<Widget> result = new LinkedList<Widget>();

+		for (Widget w : parent.getChildren())

+		{

+			result.add(w);

+			if (w instanceof Composite)

+			{

+				result.addAll(Arrays.asList(children((Composite) w)));

+			}

+		}

+		return result.toArray(new Widget[result.size()]);

+	}

+

+}

diff --git a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/view/ViewProgressMonitorTest.java b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/view/ViewProgressMonitorTest.java
index 9287d63..cf78bfc 100644
--- a/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/view/ViewProgressMonitorTest.java
+++ b/tests/org.eclipse.platform.discovery.ui.test.comp/src/org/eclipse/platform/discovery/ui/view/ViewProgressMonitorTest.java
@@ -13,17 +13,12 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import java.lang.reflect.InvocationTargetException;
-
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects.ViewProgressMonitorPageObject;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-
 public class ViewProgressMonitorTest
 {
 	private ViewProgressMonitorPageObject monitor;
@@ -42,7 +37,7 @@
 	}
 
 	@Test
-	public void testBeginTaskDisablesUI() throws InvocationTargetException, InterruptedException
+	public void testBeginTaskDisablesUI()
 	{
 		monitor.beginTask("MyTask", IProgressMonitor.UNKNOWN);
 		assertFalse("Button should be disabled while the task is running", monitor.isControlsEnabled());
@@ -51,7 +46,7 @@
 	}
 
 	@Test
-	public void testPressingCancelButtonCancelsMonitor() throws NotFoundException, MultipleFoundException
+	public void testPressingCancelButtonCancelsMonitor()
 	{
 		monitor.beginTask("MyTask", IProgressMonitor.UNKNOWN);
 		monitor.cancel();