diff options
author | spingel | 2010-02-17 21:44:21 +0000 |
---|---|---|
committer | spingel | 2010-02-17 21:44:21 +0000 |
commit | 99754742b89f3c70ce772667500e947f6dbdc1d7 (patch) | |
tree | 1471d7d1e7e38e8a3870b08eebbce457cf6e40da /bundles/org.eclipse.equinox.p2.discovery | |
parent | 1e34f9e8ad759627fef6b0937656769000109ecb (diff) | |
download | rt.equinox.p2-99754742b89f3c70ce772667500e947f6dbdc1d7.tar.gz rt.equinox.p2-99754742b89f3c70ce772667500e947f6dbdc1d7.tar.xz rt.equinox.p2-99754742b89f3c70ce772667500e947f6dbdc1d7.zip |
allow catalogs to control merging of discovered items
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.discovery')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.discovery/src/org/eclipse/equinox/internal/p2/discovery/Catalog.java | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.p2.discovery/src/org/eclipse/equinox/internal/p2/discovery/Catalog.java b/bundles/org.eclipse.equinox.p2.discovery/src/org/eclipse/equinox/internal/p2/discovery/Catalog.java index c95dad39c..cc6fe6b11 100644 --- a/bundles/org.eclipse.equinox.p2.discovery/src/org/eclipse/equinox/internal/p2/discovery/Catalog.java +++ b/bundles/org.eclipse.equinox.p2.discovery/src/org/eclipse/equinox/internal/p2/discovery/Catalog.java @@ -90,16 +90,20 @@ public class Catalog { if (discoveryStrategies.isEmpty()) { throw new IllegalStateException(); } - items = new ArrayList<CatalogItem>(); - filteredItems = new ArrayList<CatalogItem>(); - categories = new ArrayList<CatalogCategory>(); - certifications = new ArrayList<Certification>(); + List<CatalogItem> items = new ArrayList<CatalogItem>(); + List<CatalogCategory> categories = new ArrayList<CatalogCategory>(); + List<Certification> certifications = new ArrayList<Certification>(); + List<Tag> tags = new ArrayList<Tag>(); final int totalTicks = 100000; final int discoveryTicks = totalTicks - (totalTicks / 10); monitor.beginTask(Messages.Catalog_task_discovering_connectors, totalTicks); try { for (AbstractDiscoveryStrategy discoveryStrategy : discoveryStrategies) { + if (monitor.isCanceled()) { + status.add(Status.CANCEL_STATUS); + break; + } discoveryStrategy.setCategories(categories); discoveryStrategy.setItems(items); discoveryStrategy.setCertifications(certifications); @@ -113,15 +117,26 @@ public class Catalog { } } - filterDescriptors(); - connectCategoriesToDescriptors(); - connectCertificationsToDescriptors(); + update(categories, items, certifications, tags); } finally { monitor.done(); } return status; } + protected void update(List<CatalogCategory> categories, List<CatalogItem> items, + List<Certification> certifications, List<Tag> tags) { + this.categories = categories; + this.items = items; + this.certifications = certifications; + this.tags = tags; + this.filteredItems = new ArrayList<CatalogItem>(); + + filterDescriptors(); + connectCategoriesToDescriptors(); + connectCertificationsToDescriptors(); + } + /** * get the top-level categories * @@ -154,6 +169,15 @@ public class Catalog { } /** + * get a list of known certifications + * + * @return the certifications, or an ampty list if there are none. + */ + public List<Certification> getCertifications() { + return certifications; + } + + /** * The environment used to resolve {@link AbstractCatalogItem#getPlatformFilter() platform filters}. Defaults to the * current environment. */ |