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: 0 C: 20
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
log(int, String)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
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.ide.internal;
16:
17: import org.eclipse.core.runtime.Plugin;
18: import org.eclipse.emfforms.spi.common.report.AbstractReport;
19: import org.eclipse.emfforms.spi.common.report.ReportService;
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 Plugin {
27:
28:         /** The plug-in ID. */
29:         public static final String PLUGIN_ID = "org.eclipse.emf.ecp.ide.util"; //$NON-NLS-1$
30:
31:         // The shared instance
32:         private static Activator plugin;
33:
34:         private ReportService reportService;
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:          * Logs a message.
73:          *
74:          * @param severity the severity of the Message
75:          * @param message The warning to log
76:          */
77:         public static void log(int severity, String message) {
78:                 plugin.getReportService().report(new AbstractReport(message, severity));
79:         }
80:
81:         /**
82:          * Return the {@link ReportService}.
83:          *
84:          * @return The {@link ReportService}
85:          */
86:         public ReportService getReportService() {
87:•                if (reportService == null) {
88:                         final ServiceReference<ReportService> serviceReference = getBundle().getBundleContext()
89:                                 .getServiceReference(ReportService.class);
90:                         reportService = getBundle().getBundleContext().getService(serviceReference);
91:                 }
92:                 return reportService;
93:         }
94: }