Skip to content

Commit

Permalink
493913: Add drag&drop support for favorites list URL
Browse files Browse the repository at this point in the history
Support opening Favorites import wizard with an initial URL

Bug: 493913
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=493913
  • Loading branch information
creckord committed Mar 16, 2017
1 parent b80a8cd commit e547eaf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
Expand Up @@ -58,6 +58,11 @@ public FavoritesViewer(Catalog catalog, ImportFavoritesPage page, IMarketplaceWe
setRefreshJobDelay(50L);
}

@Override
public void setFilterText(String newFilter) {
super.setFilterText(newFilter);
}

@Override
protected StructuredViewer doCreateViewer(Composite container) {
StructuredViewer viewer = super.doCreateViewer(container);
Expand Down
Expand Up @@ -28,7 +28,6 @@
import org.eclipse.equinox.internal.p2.discovery.AbstractDiscoveryStrategy;
import org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogPage;
import org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogViewer;
import org.eclipse.equinox.internal.p2.ui.discovery.wizards.DiscoveryWizard;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osgi.util.NLS;
Expand Down Expand Up @@ -95,11 +94,13 @@ public static String handleDiscoveryError(String favoritesReference, Exception e

@Override
protected CatalogViewer doCreateViewer(Composite parent) {
DiscoveryWizard wizard = getWizard();
CatalogViewer viewer = new FavoritesViewer(getCatalog(), this, browser,
ImportFavoritesWizard wizard = getWizard();
FavoritesViewer viewer = new FavoritesViewer(getCatalog(), this, browser,
wizard.getConfiguration());
viewer.setMinimumHeight(MINIMUM_HEIGHT);
viewer.createControl(parent);
String initialFavoritesUrl = wizard.getInitialFavoritesUrl();
viewer.setFilterText(initialFavoritesUrl == null ? "" : initialFavoritesUrl); //$NON-NLS-1$
return viewer;
}

Expand Down Expand Up @@ -162,4 +163,9 @@ private IUserFavoritesService findUserFavoritesService() {
}
return userFavoritesService;
}

@Override
public ImportFavoritesWizard getWizard() {
return (ImportFavoritesWizard) super.getWizard();
}
}
Expand Up @@ -17,6 +17,8 @@ public class ImportFavoritesWizard extends DiscoveryWizard {

private final ImportFavoritesPage importFavoritesPage;

private String initialFavoritesUrl;

public ImportFavoritesWizard(MarketplaceCatalog catalog, MarketplaceCatalogConfiguration configuration, IMarketplaceWebBrowser browser) {
super(catalog, configuration);
setWindowTitle("Import Favorites List");
Expand All @@ -37,4 +39,12 @@ public boolean performFinish() {
public ImportFavoritesPage getImportFavoritesPage() {
return importFavoritesPage;
}

public void setInitialFavoritesUrl(String initialFavoritesUrl) {
this.initialFavoritesUrl = initialFavoritesUrl;
}

public String getInitialFavoritesUrl() {
return initialFavoritesUrl;
}
}

0 comments on commit e547eaf

Please sign in to comment.