511217: Open MPC directly on Favorites list

Bug: 511217
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=511217
diff --git a/org.eclipse.epp.mpc.tests/META-INF/MANIFEST.MF b/org.eclipse.epp.mpc.tests/META-INF/MANIFEST.MF
index 5dc1cf4..97baa7d 100644
--- a/org.eclipse.epp.mpc.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.epp.mpc.tests/META-INF/MANIFEST.MF
@@ -25,8 +25,8 @@
  org.eclipse.core.net;bundle-version="1.2.200",
  org.eclipse.equinox.p2.metadata;bundle-version="2.2.0",
  org.eclipse.userstorage;bundle-version="[1.1.0,2.0.0)",
- org.apache.httpcomponents.httpclient;bundle-version="[4.3.6,4.4.0)",
- org.apache.httpcomponents.httpcore;bundle-version="[4.3.3,4.4.0)",
+ org.apache.httpcomponents.httpclient;bundle-version="[4.5.0,4.6.0)",
+ org.apache.httpcomponents.httpcore;bundle-version="[4.4.0,4.5.0)",
  org.mockito;bundle-version="1.9.5"
 Import-Package: org.eclipse.ecf.core;version="3.0.0",
  org.eclipse.ecf.core.util,
diff --git a/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/MarketplaceClientServiceTest.java b/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/MarketplaceClientServiceTest.java
index d5f2c30..2759866 100644
--- a/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/MarketplaceClientServiceTest.java
+++ b/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/MarketplaceClientServiceTest.java
@@ -196,4 +196,17 @@
 		SWTBotTreeItem[] featureItems = nodeItems[0].getItems();
 		assertTrue(featureItems.length > 0);
 	}
+
+	@Test
+	public void testOpenFavorites() throws Exception {
+		display.asyncExec(new Runnable() {
+
+			public void run() {
+				service.openFavorites(config);
+			}
+		});
+
+		initWizardBot();
+		checkSelectedTab("Favorites");
+	}
 }
diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceClientService.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceClientService.java
index c964b82..e4836f7 100644
--- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceClientService.java
+++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceClientService.java
@@ -109,6 +109,16 @@
 		execute(command);
 	}
 
+	public void openFavorites(IMarketplaceClientConfiguration configuration) {
+		MarketplaceWizardCommand command = new MarketplaceWizardCommand();
+		command.setConfiguration(configuration);
+		WizardState wizardState = new WizardState();
+		wizardState.setContentType(ContentType.FAVORITES);
+		wizardState.setProceedWithInstallation(false);
+		command.setWizardDialogState(wizardState);
+		execute(command);
+	}
+
 	private void checkInitialState(IMarketplaceClientConfiguration configuration) {
 		if (configuration.getInitialState() == null
 				&& (configuration.getInitialOperations() == null || configuration.getInitialOperations().isEmpty())) {
@@ -125,5 +135,4 @@
 					StatusManager.SHOW | StatusManager.BLOCK | StatusManager.LOG);
 		}
 	}
-
 }
diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/mpc/ui/IMarketplaceClientService.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/mpc/ui/IMarketplaceClientService.java
index fbcdcee..885d191 100644
--- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/mpc/ui/IMarketplaceClientService.java
+++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/mpc/ui/IMarketplaceClientService.java
@@ -67,6 +67,15 @@
 	void openInstalled(IMarketplaceClientConfiguration configuration);
 
 	/**
+	 * Open the Marketplace Wizard showing the "Favorites" tab for the
+	 * {@link IMarketplaceClientConfiguration#getCatalogDescriptor() active catalog}.
+	 *
+	 * @param configuration
+	 *            the initial configuration applied to the MPC wizard
+	 */
+	void openFavorites(IMarketplaceClientConfiguration configuration);
+
+	/**
 	 * Open the Marketplace Wizard showing the result of the given search on the
 	 * {@link IMarketplaceClientConfiguration#getCatalogDescriptor() active catalog}.
 	 *
@@ -104,5 +113,4 @@
 	 *             {@link IMarketplaceClientConfiguration#getInitialState()}
 	 */
 	void openProvisioning(IMarketplaceClientConfiguration configuration);
-
 }