| /******************************************************************************* |
| * 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 v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| ******************************************************************************/ |
| package org.eclipse.emf.ecp.xmiworkspace; |
| |
| import org.eclipse.emf.ecp.common.util.AbstractECPPlugin; |
| import org.osgi.framework.BundleActivator; |
| import org.osgi.framework.BundleContext; |
| |
| /** |
| * Activator that activated the plugin. |
| * @author matti, markus |
| * |
| */ |
| public class Activator extends AbstractECPPlugin implements BundleActivator { |
| |
| private static BundleContext context; |
| |
| /** |
| * Returns the context in which the plugin is run. |
| * @return The context for this plugin. |
| */ |
| static BundleContext getContext() { |
| return context; |
| } |
| |
| private static Activator plugin; |
| |
| /* |
| * (non-Javadoc) |
| * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) |
| */ |
| /** |
| * {@inheritDoc} |
| */ |
| // BEGIN SUPRESS CATCH EXCEPTION |
| public void start(BundleContext bundleContext) throws Exception { |
| Activator.context = bundleContext; |
| plugin = this; |
| } |
| |
| /* |
| * (non-Javadoc) |
| * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) |
| */ |
| /** |
| * {@inheritDoc} |
| */ |
| public void stop(BundleContext bundleContext) throws Exception { |
| Activator.context = null; |
| plugin = null; |
| } |
| // END SUPRESS CATCH EXCEPTION |
| |
| /** |
| * . Returns the shared instance |
| * |
| * @return the shared instance |
| */ |
| public static Activator getDefault() { |
| return plugin; |
| } |
| |
| } |