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: 2
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: 17
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
getReportService()
M: 17 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: 6 C: 12
67%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 2 C: 5
71%
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.view.internal.table.model;
15:
16: import org.eclipse.core.runtime.Plugin;
17: import org.eclipse.emfforms.common.ServiceObjectTracker;
18: import org.eclipse.emfforms.spi.common.report.ReportService;
19: import org.eclipse.emfforms.spi.core.services.databinding.EMFFormsDatabinding;
20: import org.eclipse.emfforms.spi.core.services.databinding.emf.EMFFormsDatabindingEMF;
21: import org.osgi.framework.BundleContext;
22:
23: /**
24: * The activator class controls the plug-in life cycle.
25: *
26: * @author Lucas Koehler
27: */
28: public class Activator extends Plugin {
29:
30:         /** The plug-in ID. */
31:         public static final String PLUGIN_ID = "org.eclipse.emf.ecp.view.table.model"; //$NON-NLS-1$
32:
33:         // The shared instance
34:         private static Activator plugin;
35:
36:         private ServiceObjectTracker<ReportService> reportServiceTracker;
37:         private ServiceObjectTracker<EMFFormsDatabindingEMF> emfformsDatadingTracker;
38:
39:         /**
40:          * The constructor.
41:          */
42:         public Activator() {
43:         }
44:
45:         /*
46:          * (non-Javadoc)
47:          * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
48:          */
49:         @Override
50:         public void start(BundleContext context) throws Exception {
51:                 super.start(context);
52:                 plugin = this;
53:         }
54:
55:         /*
56:          * (non-Javadoc)
57:          * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
58:          */
59:         @Override
60:         public void stop(BundleContext context) throws Exception {
61:                 plugin = null;
62:•                if (emfformsDatadingTracker != null) {
63:                         emfformsDatadingTracker.dispose();
64:                 }
65:•                if (reportServiceTracker != null) {
66:                         reportServiceTracker.dispose();
67:                 }
68:                 super.stop(context);
69:         }
70:
71:         /**
72:          * Returns the shared instance.
73:          *
74:          * @return the shared instance
75:          */
76:         public static Activator getDefault() {
77:                 return plugin;
78:         }
79:
80:         /**
81:          * Returns the {@link ReportService}.
82:          *
83:          * @return the {@link ReportService}
84:          */
85:         public ReportService getReportService() {
86:•                if (reportServiceTracker == null) {
87:                         reportServiceTracker = new ServiceObjectTracker<ReportService>(
88:                                 plugin.getBundle().getBundleContext(), ReportService.class);
89:                 }
90:                 return reportServiceTracker.getService();
91:         }
92:
93:         /**
94:          * Returns the {@link EMFFormsDatabinding} service.
95:          *
96:          * @return The {@link EMFFormsDatabinding}
97:          */
98:         public EMFFormsDatabindingEMF getEMFFormsDatabinding() {
99:•                if (emfformsDatadingTracker == null) {
100:                         emfformsDatadingTracker = new ServiceObjectTracker<EMFFormsDatabindingEMF>(
101:                                 plugin.getBundle().getBundleContext(), EMFFormsDatabindingEMF.class);
102:                 }
103:                 return emfformsDatadingTracker.getService();
104:         }
105: }