Search in sources :

Example 6 with Update

use of org.eclipse.equinox.p2.operations.Update in project knime-core by knime.

the class RepositoryUpdater method addDefaultRepositories.

/**
 * Adds default KNIME repositories if they don't already exist.
 */
public void addDefaultRepositories() {
    BundleContext context = FrameworkUtil.getBundle(getClass()).getBundleContext();
    ServiceReference<IProvisioningAgent> ref = context.getServiceReference(IProvisioningAgent.class);
    if (ref != null) {
        IProvisioningAgent agent = context.getService(ref);
        try {
            IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
            URL usFileUrl = FrameworkUtil.getBundle(getClass()).getEntry("/update-sites.txt");
            if ((metadataManager != null) && (usFileUrl != null)) {
                processDefaultRepositories(metadataManager, usFileUrl);
            }
        } finally {
            context.ungetService(ref);
        }
    }
}
Also used : IMetadataRepositoryManager(org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager) IProvisioningAgent(org.eclipse.equinox.p2.core.IProvisioningAgent) URL(java.net.URL) BundleContext(org.osgi.framework.BundleContext)

Aggregations

UpdateSingleIUWizard (org.eclipse.equinox.internal.p2.ui.dialogs.UpdateSingleIUWizard)3 UpdateOperation (org.eclipse.equinox.p2.operations.UpdateOperation)3 WizardDialog (org.eclipse.jface.wizard.WizardDialog)3 AvailableUpdateElement (org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement)2 Update (org.eclipse.equinox.p2.operations.Update)2 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 IStatus (org.eclipse.core.runtime.IStatus)1 AvailableIUElement (org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement)1 IUElementListRoot (org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot)1 IProvisioningAgent (org.eclipse.equinox.p2.core.IProvisioningAgent)1 IMetadataRepositoryManager (org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager)1 Shell (org.eclipse.swt.widgets.Shell)1 BundleContext (org.osgi.framework.BundleContext)1