Search in sources :

Example 1 with ImportFavoritesWizard

use of org.eclipse.epp.internal.mpc.ui.wizards.ImportFavoritesWizard in project epp.mpc by eclipse.

the class ImportFavoritesWizardCommand method createWizard.

@Override
protected ImportFavoritesWizard createWizard(MarketplaceCatalog catalog, MarketplaceCatalogConfiguration configuration, ExecutionEvent event) {
    String favoritesUrl = event.getParameter(FAVORITES_URL_PARAMETER);
    if (favoritesUrl == null) {
        favoritesUrl = this.favoritesUrl;
    }
    FavoritesCatalog favoritesCatalog = new FavoritesCatalog();
    ImportFavoritesWizard wizard = new ImportFavoritesWizard(favoritesCatalog, configuration, null);
    wizard.setInitialFavoritesUrl(favoritesUrl);
    final ImportFavoritesPage importFavoritesPage = wizard.getImportFavoritesPage();
    favoritesCatalog.getDiscoveryStrategies().add(new FavoritesDiscoveryStrategy(configuration.getCatalogDescriptor()) {

        private String discoveryError = null;

        @Override
        protected void preDiscovery() {
            discoveryError = null;
        }

        @Override
        protected void handleDiscoveryError(CoreException ex) throws CoreException {
            discoveryError = ImportFavoritesPage.handleDiscoveryError(getFavoritesReference(), ex);
        }

        @Override
        protected void postDiscovery() {
            final String errorMessage = this.discoveryError;
            this.discoveryError = null;
            importFavoritesPage.setDiscoveryError(errorMessage);
        }
    });
    return wizard;
}
Also used : FavoritesDiscoveryStrategy(org.eclipse.epp.internal.mpc.ui.catalog.FavoritesDiscoveryStrategy) CoreException(org.eclipse.core.runtime.CoreException) ImportFavoritesPage(org.eclipse.epp.internal.mpc.ui.wizards.ImportFavoritesPage) ImportFavoritesWizard(org.eclipse.epp.internal.mpc.ui.wizards.ImportFavoritesWizard) FavoritesCatalog(org.eclipse.epp.internal.mpc.ui.catalog.FavoritesCatalog)

Aggregations

CoreException (org.eclipse.core.runtime.CoreException)1 FavoritesCatalog (org.eclipse.epp.internal.mpc.ui.catalog.FavoritesCatalog)1 FavoritesDiscoveryStrategy (org.eclipse.epp.internal.mpc.ui.catalog.FavoritesDiscoveryStrategy)1 ImportFavoritesPage (org.eclipse.epp.internal.mpc.ui.wizards.ImportFavoritesPage)1 ImportFavoritesWizard (org.eclipse.epp.internal.mpc.ui.wizards.ImportFavoritesWizard)1