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