| /** |
| * |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * 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: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| */ |
| package org.eclipse.osbp.ide.core.ui.softwarefactory; |
| |
| import com.google.inject.Binder; |
| import com.google.inject.Module; |
| |
| import org.eclipse.osbp.ide.core.ui.softwarefactory.extender.Access; |
| import org.eclipse.osbp.ide.core.ui.softwarefactory.extender.IModelExtenderProvider; |
| import org.eclipse.osbp.ide.core.ui.softwarefactory.extender.ModelExtenderEventSource; |
| |
| /** |
| * The {@link IModelExtenderProvider.Event.Source} implemented by {@link ModelExtenderEventSource} works as communication |
| * link between an Xtext builder and a model extender. After each piece of work of the extender, the builder must force |
| * a rebuild to update the Xtext index. After this, the extender workflow must be notified to continue its work with the next |
| * model to be extended. Modifies ResourceDescription deltas along with other dsl package properties are shared between the two |
| * parties. |
| * This class contributes bindings to the Xtext framework. This module is registered by |
| * plugin.xml. Xtext will use the bindings to create a child injector. <br> |
| * <br> |
| * Modules that want to use the singleton {@link IModelExtenderProvider.Event.Source} needs to add |
| * {@link Access#getIModelExtenderProvider()} in their module description. It will create |
| * a provider, that delegates to the extension cache. Then the |
| * {@link IModelExtenderProvider.Event.Source} will automatically become injected.<br> |
| * <br> |
| * If {@link IModelExtenderProvider.Event.Source} is requested, the injector will take a look into the |
| * extension registry. See |
| * {@link org.eclipse.xtext.ui.shared.Access#contributedProvider(Class)}. So |
| * only one instance is available at a time. |
| */ |
| |
| public class SharedStateContribution implements Module { |
| |
| @Override |
| public void configure(Binder binder) { |
| binder.bind(IModelExtenderProvider.Event.Source.class).to( |
| ModelExtenderEventSource.class); |
| } |
| |
| } |