| /******************************************************************************* |
| * Copyright (c) 2011, 2020 Willink Transformations and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v20.html |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * E.D.Willink - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.ocl.examples.xtext.idioms; |
| |
| import org.eclipse.emf.ecore.EPackage; |
| |
| import com.google.inject.Injector; |
| |
| /** |
| * Initialization support for running Xtext languages without Equinox extension registry. |
| */ |
| public class IdiomsStandaloneSetup extends IdiomsStandaloneSetupGenerated |
| { |
| private static Injector injector = null; |
| |
| public static void doSetup() { |
| if (injector == null) { |
| new IdiomsStandaloneSetup().createInjectorAndDoEMFRegistration(); |
| } |
| } |
| |
| public static void doTearDown() { |
| injector = null; |
| } |
| |
| public static void init() { |
| EPackage.Registry.INSTANCE.put(IdiomsPackage.eNS_URI, IdiomsPackage.eINSTANCE); |
| } |
| |
| /** |
| * Return the Injector for this plugin. |
| */ |
| public static final Injector getInjector() { |
| return injector; |
| } |
| |
| @Override |
| public Injector createInjector() { |
| init(); |
| injector = super.createInjector(); |
| return injector; |
| } |
| } |