Skip to content

Commit

Permalink
517221: Initialize Import Favorites with random favorites lists of ot…
Browse files Browse the repository at this point in the history
…her users

- Discover Favorites Lists
- Show Favorites Lists in empty Import wizard
- Fixed concurrency issue on drag&drop
- Fine-tuned some of the discovery entry layouts
- Show nicer user info message in empty Import wizard

Bug: 517221
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=517221
  • Loading branch information
creckord committed May 24, 2017
1 parent ab0324d commit 6241b6f
Show file tree
Hide file tree
Showing 37 changed files with 912 additions and 325 deletions.
@@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright (c) 2010 The Eclipse Foundation 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* The Eclipse Foundation - initial API and implementation
*******************************************************************************/
package org.eclipse.epp.internal.mpc.core.model;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.epp.mpc.core.model.IFavoriteList;
import org.eclipse.epp.mpc.core.model.INode;

public class FavoriteList extends Identifiable implements IFavoriteList {

private List<INode> nodes = new ArrayList<INode>();

private String owner;

public String getOwner() {
return owner == null ? getId() : owner;
}

public void setOwner(String owner) {
this.owner = owner;
}

public List<INode> getNodes() {
return nodes;
}

public void setNodes(List<INode> nodes) {
this.nodes = nodes;
}
}
Expand Up @@ -31,6 +31,7 @@
import org.eclipse.epp.internal.mpc.core.service.AbstractDataStorageService.NotAuthorizedException;
import org.eclipse.epp.internal.mpc.core.util.URLUtil;
import org.eclipse.epp.mpc.core.model.ICategory;
import org.eclipse.epp.mpc.core.model.IFavoriteList;
import org.eclipse.epp.mpc.core.model.IMarket;
import org.eclipse.epp.mpc.core.model.INews;
import org.eclipse.epp.mpc.core.model.INode;
Expand Down Expand Up @@ -414,6 +415,10 @@ public ISearchResult favorites(IProgressMonitor monitor) throws CoreException {
return topFavorites(monitor);
}

public List<IFavoriteList> userFavoriteLists(IProgressMonitor monitor) throws CoreException {
return delegate.userFavoriteLists(monitor);
}

public ISearchResult userFavorites(IProgressMonitor monitor) throws CoreException, NotAuthorizedException {
//we don't cache the favorite status, only contents individual nodes, which happens internally...
return delegate.userFavorites(monitor);
Expand Down
Expand Up @@ -52,6 +52,7 @@
import org.eclipse.epp.internal.mpc.core.util.ServiceUtil;
import org.eclipse.epp.internal.mpc.core.util.URLUtil;
import org.eclipse.epp.mpc.core.model.ICategory;
import org.eclipse.epp.mpc.core.model.IFavoriteList;
import org.eclipse.epp.mpc.core.model.IIdentifiable;
import org.eclipse.epp.mpc.core.model.IIus;
import org.eclipse.epp.mpc.core.model.IMarket;
Expand Down Expand Up @@ -570,6 +571,19 @@ public SearchResult topFavorites(IProgressMonitor monitor) throws CoreException
return createSearchResult(marketplace.getFavorites());
}

public List<IFavoriteList> userFavoriteLists(IProgressMonitor monitor) throws CoreException {
IUserFavoritesService userFavoritesService = getUserFavoritesService();
if (userFavoritesService == null) {
throw new UnsupportedOperationException();
}
try {
return userFavoritesService.getRandomFavoriteLists(monitor);
} catch (Exception e) {
throw new CoreException(MarketplaceClientCore.computeStatus(e,
Messages.DefaultMarketplaceService_FavoritesErrorRetrieving));
}
}

public ISearchResult userFavorites(IProgressMonitor monitor) throws CoreException, NotAuthorizedException {
SubMonitor progress = SubMonitor.convert(monitor, Messages.DefaultMarketplaceService_FavoritesRetrieve, 10000);
IUserFavoritesService userFavoritesService = getUserFavoritesService();
Expand Down
Expand Up @@ -24,6 +24,7 @@

import org.eclipse.epp.internal.mpc.core.MarketplaceClientCore;
import org.eclipse.epp.internal.mpc.core.util.ServiceUtil;
import org.eclipse.epp.mpc.core.service.IMarketplaceService;
import org.eclipse.epp.mpc.core.service.IMarketplaceStorageService;
import org.eclipse.equinox.security.storage.ISecurePreferences;
import org.eclipse.equinox.security.storage.StorageException;
Expand Down Expand Up @@ -54,6 +55,8 @@ public class MarketplaceStorageService implements IMarketplaceStorageService {

private URI serviceUri;

private String marketplaceBaseUri;

private StorageFactory storageFactory;

private IStorage storage;
Expand All @@ -64,6 +67,18 @@ public class MarketplaceStorageService implements IMarketplaceStorageService {

private EclipseOAuthCredentialsProvider credentialsProvider;

public MarketplaceStorageService() {
System.out.println();
}

public String getMarketplaceBaseUri() {
return marketplaceBaseUri;
}

public void setMarketplaceBaseUri(String marketplaceBaseUri) {
this.marketplaceBaseUri = marketplaceBaseUri;
}

public URI getServiceUri() {
return serviceUri;
}
Expand Down Expand Up @@ -194,6 +209,11 @@ public void activate(BundleContext context, Map<?, ?> properties) {
}
String applicationToken = getProperty(properties, APPLICATION_TOKEN_PROPERTY, DEFAULT_APPLICATION_TOKEN);
this.applicationToken = applicationToken;

Object marketplaceBaseUri = ServiceUtil.getOverridablePropertyValue(properties, IMarketplaceService.BASE_URL);
if (marketplaceBaseUri != null) {
this.marketplaceBaseUri = marketplaceBaseUri.toString();
}
}

private IStorageService registerStorageService(URI serviceUri, String serviceName) {
Expand Down

0 comments on commit 6241b6f

Please sign in to comment.