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: 4 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: 18 C: 8
31%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 4 C: 3
43%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2016 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.view.custom.ui.swt.test;
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.emf.EMFFormsDatabindingEMF;
19: import org.osgi.framework.BundleContext;
20: import org.osgi.framework.ServiceReference;
21:
22: /**
23: * Activator of the custom.ui.swt.test bundle.
24: *
25: * @author Lucas Koehler
26: *
27: */
28: public class Activator extends Plugin {
29:         /** The plug-in ID. */
30:         public static final String PLUGIN_ID = "org.eclipse.emf.ecp.view.custom.ui.swt.test"; //$NON-NLS-1$
31:
32:         // The shared instance
33:         private static Activator plugin;
34:
35:         /*
36:          * (non-Javadoc)
37:          * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
38:          */
39:         @Override
40:         public void start(BundleContext context) throws Exception {
41:                 super.start(context);
42:                 plugin = this;
43:         }
44:
45:         /*
46:          * (non-Javadoc)
47:          * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
48:          */
49:         @Override
50:         public void stop(BundleContext context) throws Exception {
51:                 plugin = null;
52:•                if (reportServiceReference != null) {
53:                         plugin.getBundle().getBundleContext().ungetService(reportServiceReference);
54:                 }
55:•                if (emfFormsDatabindingEMFServiceReference != null) {
56:                         plugin.getBundle().getBundleContext().ungetService(emfFormsDatabindingEMFServiceReference);
57:                 }
58:                 super.stop(context);
59:         }
60:
61:         /**
62:          * Returns the shared instance.
63:          *
64:          * @return the shared instance
65:          */
66:         public static Activator getDefault() {
67:                 return plugin;
68:         }
69:
70:         private ServiceReference<ReportService> reportServiceReference;
71:         private ServiceReference<EMFFormsDatabindingEMF> emfFormsDatabindingEMFServiceReference;
72:
73:         /**
74:          * Returns the {@link ReportService}.
75:          *
76:          * @return the {@link ReportService}
77:          */
78:         public ReportService getReportService() {
79:•                if (reportServiceReference == null) {
80:                         reportServiceReference = plugin.getBundle().getBundleContext()
81:                                 .getServiceReference(ReportService.class);
82:                 }
83:                 return plugin.getBundle().getBundleContext().getService(reportServiceReference);
84:         }
85:
86:         /**
87:          * Returns the {@link EMFFormsDatabindingEMF} service.
88:          *
89:          * @return The {@link EMFFormsDatabindingEMF}
90:          */
91:         public EMFFormsDatabindingEMF getEMFFormsDatabinding() {
92:•                if (emfFormsDatabindingEMFServiceReference == null) {
93:                         emfFormsDatabindingEMFServiceReference = plugin.getBundle().getBundleContext()
94:                                 .getServiceReference(EMFFormsDatabindingEMF.class);
95:                 }
96:                 return plugin.getBundle().getBundleContext().getService(emfFormsDatabindingEMFServiceReference);
97:         }
98: }