Search in sources :

Example 16 with MarketplaceNodeCatalogItem

use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem in project epp.mpc by eclipse.

the class ImportFavoritesPage method getSelection.

public List<MarketplaceNodeCatalogItem> getSelection() {
    IStructuredSelection selection = getViewer().getSelection();
    @SuppressWarnings("unchecked") List<MarketplaceNodeCatalogItem> importFavorites = selection.toList();
    return new ArrayList<MarketplaceNodeCatalogItem>(importFavorites);
}
Also used : ArrayList(java.util.ArrayList) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) MarketplaceNodeCatalogItem(org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem)

Example 17 with MarketplaceNodeCatalogItem

use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem in project epp.mpc by eclipse.

the class MarketplaceInfoTest method createTestItem.

public static MarketplaceNodeCatalogItem createTestItem() throws Exception {
    MarketplaceNodeCatalogItem item = new MarketplaceNodeCatalogItem();
    item.setMarketplaceUrl(new URL("http://marketplace.eclipse.org"));
    item.setId("123");
    Node node = new Node();
    node.setId(item.getId());
    node.setUrl("http://marketplace.eclipse.org/node/" + node.getId());
    node.setIus(new Ius());
    addIu(node, "com.example.test.a1");
    addIu(node, "com.example.test.a2");
    item.setData(node);
    item.setInstallableUnits(node.getIus().getIu());
    return item;
}
Also used : Ius(org.eclipse.epp.internal.mpc.core.model.Ius) Node(org.eclipse.epp.internal.mpc.core.model.Node) INode(org.eclipse.epp.mpc.core.model.INode) MarketplaceNodeCatalogItem(org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem) URL(java.net.URL)

Example 18 with MarketplaceNodeCatalogItem

use of org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem in project epp.mpc by eclipse.

the class MarketplaceCatalogTest method testCheckUpdateOnPerformDiscovery.

@Test
public void testCheckUpdateOnPerformDiscovery() {
    assertTrue(checkedForUpdate.isEmpty());
    catalog.performDiscovery(new NullProgressMonitor());
    List<CatalogItem> items = catalog.getItems();
    assertEquals(discoveryNodes.size(), items.size());
    assertEquals(installedNodes.size(), checkedForUpdate.size());
    int updateable = 0;
    for (CatalogItem item : items) {
        Boolean hasUpdate = ((MarketplaceNodeCatalogItem) item).getUpdateAvailable();
        if (installedNodes.contains(item.getData())) {
            assertNotNull(hasUpdate);
        } else {
            assertNull(hasUpdate);
        }
        assertEquals(updateAvailable.contains(item.getData()), Boolean.TRUE.equals(hasUpdate));
        if (Boolean.TRUE.equals(hasUpdate)) {
            updateable++;
        }
    }
    assertEquals(updateAvailable.size(), updateable);
}
Also used : CatalogItem(org.eclipse.equinox.internal.p2.discovery.model.CatalogItem) MarketplaceNodeCatalogItem(org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) MarketplaceNodeCatalogItem(org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem) Test(org.junit.Test)

Aggregations

MarketplaceNodeCatalogItem (org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem)18 Operation (org.eclipse.epp.mpc.ui.Operation)5 CatalogItem (org.eclipse.equinox.internal.p2.discovery.model.CatalogItem)5 ArrayList (java.util.ArrayList)4 INode (org.eclipse.epp.mpc.core.model.INode)4 URL (java.net.URL)3 HashMap (java.util.HashMap)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 Test (org.junit.Test)3 File (java.io.File)2 MarketplaceInfo (org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceInfo)2 MarketplaceNodeInstallableUnitItem (org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeInstallableUnitItem)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 List (java.util.List)1 Entry (java.util.Map.Entry)1 Callable (java.util.concurrent.Callable)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 CoreException (org.eclipse.core.runtime.CoreException)1