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-2013 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: * Clemens Elflein - initial API and implementation
13: ******************************************************************************/
14:
15: package org.eclipse.emfforms.internal.editor;
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: * @author Clemens Elflein
27: */
28: public class Activator extends AbstractUIPlugin {
29:
30:         /**
31:          * The plug-in ID.
32:          */
33:         public static final String PLUGIN_ID = "org.eclipse.emfforms.internal.editor"; //$NON-NLS-1$
34:
35:         /**
36:          * The shared instance.
37:          */
38:         private static Activator plugin;
39:
40:         private ServiceReference<ReportService> reportServiceReference;
41:
42:         /**
43:          * The constructor.
44:          */
45:         public Activator() {
46:         }
47:
48:         /*
49:          * (non-Javadoc)
50:          * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
51:          */
52:         @Override
53:         public void start(BundleContext context) throws Exception {
54:                 super.start(context);
55:                 plugin = this;
56:         }
57:
58:         /*
59:          * (non-Javadoc)
60:          * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
61:          */
62:         @Override
63:         public void stop(BundleContext context) throws Exception {
64:                 plugin = null;
65:                 super.stop(context);
66:         }
67:
68:         /**
69:          * Returns the shared instance.
70:          *
71:          * @return the shared instance
72:          */
73:         public static Activator getDefault() {
74:                 return plugin;
75:         }
76:
77:         /**
78:          * Returns an image descriptor for the image file at the given
79:          * plug-in relative path.
80:          *
81:          * @param path the path
82:          * @return the image descriptor
83:          */
84:         public static ImageDescriptor getImageDescriptor(String path) {
85:                 return imageDescriptorFromPlugin(PLUGIN_ID, path);
86:         }
87:
88:         /**
89:          * Returns the {@link ReportService}.
90:          *
91:          * @return the {@link ReportService}
92:          */
93:         public ReportService getReportService() {
94:•                if (reportServiceReference == null) {
95:                         reportServiceReference = plugin.getBundle().getBundleContext()
96:                                 .getServiceReference(ReportService.class);
97:                 }
98:                 return plugin.getBundle().getBundleContext().getService(reportServiceReference);
99:         }
100: }