blob: 0e3bb96cb01bd8a4477fc67ccd1cf6fcd40c10d9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/****************************************************************************
* Copyright (c) 2004 Composent, Inc.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* Contributors: Composent, Inc. - initial API and implementation
*
* SPDX-License-Identifier: EPL-2.0
*****************************************************************************/
package org.eclipse.ecf.tutorial;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
/**
* The main plugin class to be used in the desktop.
*/
public class Activator implements BundleActivator {
//The shared instance.
private static Activator plugin;
private BundleContext context = null;
/**
* The constructor.
*/
public Activator() {
plugin = this;
}
/**
* This method is called upon plug-in activation
*/
public void start(BundleContext context) throws Exception {
this.context = context;
}
public Bundle getBundle() {
if (context == null) return null;
else return context.getBundle();
}
/**
* This method is called when the plug-in is stopped
*/
public void stop(BundleContext context) throws Exception {
this.context = null;
plugin = null;
}
/**
* Returns the shared instance.
*
* @return the shared instance.
*/
public static Activator getDefault() {
return plugin;
}
}
|