Skip to content

Package: Activator

Activator

nameinstructionbranchcomplexitylinemethod
Activator()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getContext()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getReportService()
M: 11 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
start(BundleContext)
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
stop(BundleContext)
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2008-2011 Chair for Applied Software Engineering,
3: * Technische Universitaet Muenchen.
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Edgar Mueller - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.ui.internal.e4;
15:
16: import org.eclipse.emfforms.spi.common.report.ReportService;
17: import org.osgi.framework.BundleActivator;
18: import org.osgi.framework.BundleContext;
19: import org.osgi.framework.ServiceReference;
20:
21: /**
22: * The activator class controls the plug-in life cycle.
23: */
24: public class Activator implements BundleActivator {
25:
26:         private static ServiceReference<ReportService> reportServiceReference;
27:         private static BundleContext context;
28:
29:         /**
30:          * Returns the {@link BundleContext}.
31:          *
32:          * @return the {@link BundleContext}.
33:          */
34:         public static BundleContext getContext() {
35:                 return context;
36:         }
37:
38:         /*
39:          * (non-Javadoc)
40:          * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
41:          */
42:         @Override
43:         public void start(BundleContext bundleContext) throws Exception {
44:                 Activator.context = bundleContext;
45:         }
46:
47:         /*
48:          * (non-Javadoc)
49:          * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
50:          */
51:         @Override
52:         public void stop(BundleContext bundleContext) throws Exception {
53:                 Activator.context = null;
54:         }
55:
56:         /**
57:          * Returns the {@link ReportService}.
58:          *
59:          * @return the {@link ReportService}
60:          */
61:         public static ReportService getReportService() {
62:•                if (reportServiceReference == null) {
63:                         reportServiceReference = context.getServiceReference(ReportService.class);
64:                 }
65:                 return context.getService(reportServiceReference);
66:         }
67: }