use of org.eclipse.epp.internal.mpc.ui.CatalogRegistry in project epp.mpc by eclipse.
the class CatalogDescriptorTest method testFindCatalogDescriptorWithCommonPrefix.
/**
* @throws Exception
* @see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=488436">bug 488436</a>
*/
@Test
public void testFindCatalogDescriptorWithCommonPrefix() throws Exception {
CatalogRegistry registry = CatalogRegistry.getInstance();
String marketplace = "http://marketplace.eclipse.org";
String hostedMarketplace = "http://marketplace.eclipse.org/hosted_catalog/test";
CatalogDescriptor marketplaceDescriptor = new CatalogDescriptor(new URL(marketplace), null);
CatalogDescriptor hostedMarketplaceDescriptor = new CatalogDescriptor(new URL(hostedMarketplace), null);
registry.register(marketplaceDescriptor);
registry.register(hostedMarketplaceDescriptor);
CatalogDescriptor found = registry.findCatalogDescriptor(marketplace);
assertThat(found, is(marketplaceDescriptor));
found = registry.findCatalogDescriptor(hostedMarketplace);
assertThat(found, is(hostedMarketplaceDescriptor));
}
use of org.eclipse.epp.internal.mpc.ui.CatalogRegistry in project epp.mpc by eclipse.
the class AbstractMarketplaceWizardCommand method registerOrOverrideCatalog.
private void registerOrOverrideCatalog(CatalogDescriptor descriptor) {
CatalogRegistry catalogRegistry = CatalogRegistry.getInstance();
List<CatalogDescriptor> descriptors = catalogRegistry.getCatalogDescriptors();
for (CatalogDescriptor catalogDescriptor : descriptors) {
if (catalogDescriptor.getUrl().toExternalForm().equals(descriptor.getUrl().toExternalForm())) {
catalogRegistry.unregister(catalogDescriptor);
}
}
catalogRegistry.register(descriptor);
}
Aggregations