KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > runtime > adaptor > EclipseBundleInstaller


1 /*******************************************************************************
2  * Copyright (c) 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.runtime.adaptor;
12
13 import org.eclipse.osgi.internal.resolver.BundleInstaller;
14 import org.eclipse.osgi.service.resolver.BundleDescription;
15 import org.osgi.framework.Bundle;
16 import org.osgi.framework.BundleException;
17
18 /**
19  * Internal class.
20  */

21 //TODO: minimal implementation for now. This could be smarter
22
public class EclipseBundleInstaller implements BundleInstaller {
23     public void installBundle(BundleDescription toInstall) throws BundleException {
24         EclipseAdaptor.getDefault().getContext().installBundle(toInstall.getLocation());
25     }
26
27     public void uninstallBundle(BundleDescription toUninstallId) throws BundleException {
28         Bundle toUninstall = EclipseAdaptor.getDefault().getContext().getBundle(toUninstallId.getBundleId());
29         if (toUninstall != null)
30             toUninstall.uninstall();
31     }
32
33     public void updateBundle(BundleDescription toUpdateId) throws BundleException {
34         Bundle toUpdate = EclipseAdaptor.getDefault().getContext().getBundle(toUpdateId.getBundleId());
35         if (toUpdate != null)
36             toUpdate.update();
37     }
38 }
Popular Tags