Skip to content

Package: Activator

Activator

nameinstructionbranchcomplexitylinemethod
Activator()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getDefault()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getEMFFormsDatabinding()
M: 0 C: 18
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
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: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
stop(BundleContext)
M: 5 C: 17
77%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 1 C: 6
86%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 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.emf.ecp.diffmerge.internal.context;
15:
16: import org.eclipse.core.runtime.Plugin;
17: import org.eclipse.emfforms.spi.common.report.ReportService;
18: import org.eclipse.emfforms.spi.core.services.databinding.EMFFormsDatabinding;
19: import org.osgi.framework.BundleContext;
20: import org.osgi.framework.ServiceReference;
21:
22: /**
23: * Activator for this plugin.
24: *
25: * @author Lucas Koehler
26: *
27: */
28: public class Activator extends Plugin {
29:         /**
30:          * The constant holding the id of this plugin.
31:          */
32:         public static final String PLUGIN_ID = "org.eclipse.emf.ecp.diffmerge.context"; //$NON-NLS-1$
33:
34:         private static Activator plugin;
35:         private ServiceReference<ReportService> reportServiceReference;
36:
37:         private ServiceReference<EMFFormsDatabinding> emfformsDatabindingServiceReference;
38:
39:         // BEGIN SUPRESS CATCH EXCEPTION
40:         @Override
41:         public void start(BundleContext bundleContext) throws Exception {
42:                 plugin = this;
43:                 super.start(bundleContext);
44:         }
45:
46:         @Override
47:         public void stop(BundleContext bundleContext) throws Exception {
48:•                if (emfformsDatabindingServiceReference != null) {
49:                         bundleContext.ungetService(emfformsDatabindingServiceReference);
50:                 }
51:•                if (reportServiceReference != null) {
52:                         bundleContext.ungetService(reportServiceReference);
53:                 }
54:                 plugin = null;
55:                 super.stop(bundleContext);
56:         }
57:
58:         // END SUPRESS CATCH EXCEPTION
59:
60:         /**
61:          * Returns the shared instance.
62:          *
63:          * @return the shared instance
64:          */
65:         public static Activator getDefault() {
66:                 return plugin;
67:         }
68:
69:         /**
70:          * Returns the {@link ReportService}.
71:          *
72:          * @return the {@link ReportService}
73:          */
74:         public ReportService getReportService() {
75:•                if (reportServiceReference == null) {
76:                         reportServiceReference = getBundle().getBundleContext().getServiceReference(ReportService.class);
77:                 }
78:                 return getBundle().getBundleContext().getService(reportServiceReference);
79:         }
80:
81:         /**
82:          * Returns the {@link EMFFormsDatabinding} service.
83:          *
84:          * @return The {@link EMFFormsDatabinding}
85:          */
86:         public EMFFormsDatabinding getEMFFormsDatabinding() {
87:•                if (emfformsDatabindingServiceReference == null) {
88:                         emfformsDatabindingServiceReference = getBundle().getBundleContext()
89:                                 .getServiceReference(EMFFormsDatabinding.class);
90:                 }
91:                 return getBundle().getBundleContext().getService(emfformsDatabindingServiceReference);
92:         }
93: }