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%
getDefault()
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: 18 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: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
stop(BundleContext)
M: 14 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2019 EclipseSource Muenchen GmbH and others.
3: *
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: * Lucas Koehler - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.internal.ide.preferences;
15:
16: import org.eclipse.core.runtime.Plugin;
17: import org.eclipse.emfforms.spi.common.report.ReportService;
18: import org.osgi.framework.BundleContext;
19: import org.osgi.framework.ServiceReference;
20:
21: /**
22: * Plugin activator for Bundle org.eclipse.emfforms.ide.preferences.
23: *
24: * @author Lucas Koehler
25: *
26: */
27: public class Activator extends Plugin {
28:
29:         /**
30:          * The constant holding the id of this plugin.
31:          */
32:         public static final String PLUGIN_ID = "org.eclipse.emfforms.ide.preferences"; //$NON-NLS-1$
33:
34:         private static Activator plugin;
35:         private ServiceReference<ReportService> reportServiceReference;
36:
37:         // BEGIN SUPRESS CATCH EXCEPTION
38:         @Override
39:         public void start(BundleContext bundleContext) throws Exception {
40:                 plugin = this;
41:                 super.start(bundleContext);
42:         }
43:
44:         @Override
45:         public void stop(BundleContext bundleContext) throws Exception {
46:•                if (reportServiceReference != null) {
47:                         bundleContext.ungetService(reportServiceReference);
48:                 }
49:                 plugin = null;
50:                 super.stop(bundleContext);
51:         }
52:
53:         // END SUPRESS CATCH EXCEPTION
54:
55:         /**
56:          * Returns the shared instance.
57:          *
58:          * @return the shared instance
59:          */
60:         public static Activator getDefault() {
61:                 return plugin;
62:         }
63:
64:         /**
65:          * Returns the {@link ReportService}.
66:          *
67:          * @return the {@link ReportService}
68:          */
69:         public ReportService getReportService() {
70:•                if (reportServiceReference == null) {
71:                         reportServiceReference = getBundle().getBundleContext().getServiceReference(ReportService.class);
72:                 }
73:                 return getBundle().getBundleContext().getService(reportServiceReference);
74:         }
75:
76: }