Skip to content

Package: Activator

Activator

nameinstructionbranchcomplexitylinemethod
Activator()
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%
getBundleContext()
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%
getEMFFormsDatabinding()
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%
getImageDescriptor(String)
M: 4 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: 4 C: 0
0%
M: 1 C: 0
0%
start(BundleContext)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
stop(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%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2014-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: * Stefan Dirix - initial API and implementation
13: *
14: *******************************************************************************/
15: package org.eclipse.emf.ecp.emf2web;
16:
17: import org.eclipse.emfforms.spi.common.report.ReportService;
18: import org.eclipse.emfforms.spi.core.services.databinding.emf.EMFFormsDatabindingEMF;
19: import org.eclipse.jface.resource.ImageDescriptor;
20: import org.eclipse.ui.plugin.AbstractUIPlugin;
21: import org.osgi.framework.BundleContext;
22: import org.osgi.framework.ServiceReference;
23:
24: /**
25: * The activator class controls the plug-in life cycle.
26: */
27: public class Activator extends AbstractUIPlugin {
28:
29:         /**
30:          * The plug-in ID.
31:          */
32:         public static final String PLUGIN_ID = "org.eclipse.emf.ecp.emf2web"; //$NON-NLS-1$
33:
34:         // The shared instance
35:         private static Activator plugin;
36:
37:         // The bundle context
38:         private BundleContext bundleContext;
39:
40:         private ServiceReference<ReportService> reportServiceReference;
41:
42:         private ServiceReference<EMFFormsDatabindingEMF> databindingServiceReference;
43:
44:         /**
45:          * The constructor.
46:          */
47:         public Activator() {
48:         }
49:
50:         /*
51:          * (non-Javadoc)
52:          * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
53:          */
54:         @Override
55:         public void start(BundleContext context) throws Exception {
56:                 super.start(context);
57:                 plugin = this;
58:                 bundleContext = context;
59:         }
60:
61:         /*
62:          * (non-Javadoc)
63:          * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
64:          */
65:         @Override
66:         public void stop(BundleContext context) throws Exception {
67:                 plugin = null;
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 an image descriptor for the image file at the given
82:          * plug-in relative path.
83:          *
84:          * @param path the path.
85:          * @return the image descriptor.
86:          */
87:         public static ImageDescriptor getImageDescriptor(String path) {
88:                 return imageDescriptorFromPlugin(PLUGIN_ID, path);
89:         }
90:
91:         /**
92:          * Returns the {@link BundleContext} for this bundle.
93:          *
94:          * @return
95:          *                 The {@link BundleContext} for this bundle.
96:          */
97:         public BundleContext getBundleContext() {
98:                 return bundleContext;
99:         }
100:
101:         /**
102:          * Returns the {@link EMFFormsDatabindingEMF} service.
103:          *
104:          * @return The {@link EMFFormsDatabindingEMF}
105:          */
106:         public EMFFormsDatabindingEMF getEMFFormsDatabinding() {
107:•                if (databindingServiceReference == null) {
108:                         databindingServiceReference = plugin.getBundle().getBundleContext()
109:                                 .getServiceReference(EMFFormsDatabindingEMF.class);
110:                 }
111:                 return plugin.getBundle().getBundleContext().getService(databindingServiceReference);
112:         }
113:
114:         /**
115:          * Returns the {@link ReportService}.
116:          *
117:          * @return the {@link ReportService}
118:          */
119:         public ReportService getReportService() {
120:•                if (reportServiceReference == null) {
121:                         reportServiceReference = plugin.getBundle().getBundleContext()
122:                                 .getServiceReference(ReportService.class);
123:                 }
124:                 return plugin.getBundle().getBundleContext().getService(reportServiceReference);
125:         }
126: }