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%
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: 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: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2014 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: * Alexandra Buzila- initial API and implementation
13: ******************************************************************************/
14:
15: package org.eclipse.emf.ecp.view.model.internal.preview;
16:
17: import org.eclipse.emfforms.spi.common.report.ReportService;
18: import org.eclipse.jface.resource.ImageDescriptor;
19: import org.eclipse.ui.plugin.AbstractUIPlugin;
20: import org.osgi.framework.BundleContext;
21: import org.osgi.framework.ServiceReference;
22:
23: /**
24: * The activator class controls the plug-in life cycle.
25: */
26: public class Activator extends AbstractUIPlugin {
27:
28:         /** The plug-in ID. */
29:         public static final String PLUGIN_ID = "org.eclipse.emf.ecp.view.model.preview.e3"; //$NON-NLS-1$
30:
31:         /** The shared instance. */
32:         private static Activator plugin;
33:
34:         private ServiceReference<ReportService> reportServiceReference;
35:
36:         /**
37:          * The constructor.
38:          */
39:         public Activator() {
40:         }
41:
42:         /*
43:          * (non-Javadoc)
44:          * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
45:          */
46:         @Override
47:         public void start(BundleContext context) throws Exception {
48:                 super.start(context);
49:                 plugin = this;
50:         }
51:
52:         /*
53:          * (non-Javadoc)
54:          * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
55:          */
56:         @Override
57:         public void stop(BundleContext context) throws Exception {
58:                 plugin = null;
59:                 super.stop(context);
60:         }
61:
62:         /**
63:          * Returns the shared instance.
64:          *
65:          * @return the shared instance
66:          */
67:         public static Activator getDefault() {
68:                 return plugin;
69:         }
70:
71:         /**
72:          * Returns an image descriptor for the image file at the given
73:          * plug-in relative path.
74:          *
75:          * @param path the path
76:          * @return the image descriptor
77:          */
78:         public static ImageDescriptor getImageDescriptor(String path) {
79:                 return imageDescriptorFromPlugin(PLUGIN_ID, path);
80:         }
81:
82:         /**
83:          * Returns the {@link ReportService}.
84:          *
85:          * @return the {@link ReportService}
86:          */
87:         public ReportService getReportService() {
88:•                if (reportServiceReference == null) {
89:                         reportServiceReference = plugin.getBundle().getBundleContext()
90:                                 .getServiceReference(ReportService.class);
91:                 }
92:                 return plugin.getBundle().getBundleContext().getService(reportServiceReference);
93:         }
94: }