blob: ce5ebff94ff6c6daec304471d2fac3eb4d4eb5cb [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2008-2011 Chair for Applied Software Engineering,
* Technische Universitaet Muenchen.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Edgar Mueller - initial API and implementation
******************************************************************************/
package org.eclipse.emf.ecp.ui.internal.e4;
import org.eclipse.emfforms.spi.common.report.ReportService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
/**
* The activator class controls the plug-in life cycle.
*/
public class Activator implements BundleActivator {
private static ServiceReference<ReportService> reportServiceReference;
private static BundleContext context;
/**
* Returns the {@link BundleContext}.
*
* @return the {@link BundleContext}.
*/
public static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
@Override
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
@Override
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
/**
* Returns the {@link ReportService}.
*
* @return the {@link ReportService}
*/
public static ReportService getReportService() {
if (reportServiceReference == null) {
reportServiceReference = context.getServiceReference(ReportService.class);
}
return context.getService(reportServiceReference);
}
}