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: 2 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%
log(Exception)
M: 14 C: 0
0%
M: 0 C: 0
100%
M: 1 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: * EclipseSource Muenchen - initial API and implementation
13: *
14: *******************************************************************************/
15: package org.eclipse.emf.ecp.view.internal.ui;
16:
17: import org.eclipse.core.runtime.IStatus;
18: import org.eclipse.core.runtime.Plugin;
19: import org.eclipse.core.runtime.Status;
20: import org.eclipse.emfforms.spi.common.report.ReportService;
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 Plugin {
28:
29:         /** The plug-in ID. **/
30:         public static final String PLUGIN_ID = "org.eclipse.emf.ecp.ui.view"; //$NON-NLS-1$
31:
32:         // The shared instance
33:         private static Activator plugin;
34:
35:         private ServiceReference<ReportService> reportServiceReference;
36:
37:         /**
38:          * The constructor.
39:          */
40:         public Activator() {
41:         }
42:
43:         /*
44:          * (non-Javadoc)
45:          * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
46:          */
47:         @Override
48:         public void start(BundleContext context) throws Exception {
49:                 super.start(context);
50:                 // this.context = context;
51:                 plugin = this;
52:         }
53:
54:         /*
55:          * (non-Javadoc)
56:          * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
57:          */
58:         @Override
59:         public void stop(BundleContext context) throws Exception {
60:                 plugin = null;
61:                 super.stop(context);
62:         }
63:
64:         /**
65:          * Returns the shared instance.
66:          *
67:          * @return the shared instance
68:          */
69:         public static Activator getDefault() {
70:                 return plugin;
71:         }
72:
73:         /**
74:          * Logs exception.
75:          *
76:          * @param e
77:          * the {@link Exception} to log
78:          */
79:         public static void log(Exception e) {
80:                 getDefault().getLog().log(
81:                         new Status(IStatus.ERROR, Activator.getDefault().getBundle().getSymbolicName(), e
82:                                 .getMessage(), e));
83:         }
84:
85:         /**
86:          * Returns the {@link ReportService}.
87:          *
88:          * @return the {@link ReportService}
89:          */
90:         public ReportService getReportService() {
91:•                if (reportServiceReference == null) {
92:                         reportServiceReference = plugin.getBundle().getBundleContext()
93:                                 .getServiceReference(ReportService.class);
94:                 }
95:                 return plugin.getBundle().getBundleContext().getService(reportServiceReference);
96:         }
97:
98: }