| /******************************************************************************* |
| * Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency |
| * 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: |
| * Pierre Allard, |
| * Regent L'Archeveque, |
| * Olivier L. Larouche - initial API and implementation |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| * |
| *******************************************************************************/ |
| package org.eclipse.apogy.common.emf; |
| |
| import javax.measure.unit.NonSI; |
| import javax.measure.unit.SI; |
| import javax.measure.unit.UnitFormat; |
| |
| import org.osgi.framework.BundleActivator; |
| import org.osgi.framework.BundleContext; |
| import org.slf4j.Logger; |
| import org.slf4j.LoggerFactory; |
| |
| public class Activator implements BundleActivator { |
| public static final String ID = "org.eclipse.apogy.common.emf"; |
| |
| private static final Logger Logger = LoggerFactory.getLogger(Activator.class); |
| |
| |
| // FIXME Move code into a registry... |
| /* |
| * Refers to the default Editing Domain. |
| */ |
| public static final String APOGY_DEFAULT_EDITING_DOMAIN_ID = ID + ".editingDomain"; |
| |
| // Adds some aliases to units. |
| static { |
| UnitFormat.getInstance().alias(SI.VOLT, "volt"); |
| |
| UnitFormat.getInstance().alias(NonSI.DEGREE_ANGLE, "deg"); |
| UnitFormat.getInstance().alias(NonSI.DEGREE_ANGLE, "degree"); |
| |
| UnitFormat.getInstance().alias(NonSI.FOOT, "foot"); |
| UnitFormat.getInstance().alias(NonSI.FOOT, "feet"); |
| } |
| |
| private static BundleContext context; |
| |
| static BundleContext getContext() { |
| return context; |
| } |
| |
| @Override |
| public void start(BundleContext context) throws Exception { |
| Activator.context = context; |
| |
| try { |
| Logger.info("EMF Class Definitions loaded"); |
| } catch (Throwable e) { |
| Logger.error("Unable to load EMF Class Definitions", e); |
| } |
| } |
| |
| @Override |
| public void stop(BundleContext context) throws Exception { |
| Activator.context = null; |
| } |
| } |