| /****************************************************************************** |
| * * |
| * 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 v1.0 * |
| * which accompanies this distribution, and is available at * |
| * http://www.eclipse.org/legal/epl-v10.html * |
| * * |
| *============================================================================* |
| * Initial contribution: * |
| * Loetz GmbH & Co. KG * |
| * * |
| * generated by xtext * |
| ******************************************************************************/ |
| package org.eclipse.osbp.xtext.dialogdsl.jvmmodel |
| |
| import javax.inject.Inject |
| import org.eclipse.osbp.ecview.semantic.uimodel.UiIDEView |
| import org.eclipse.osbp.ecview.semantic.uimodel.UiMobileView |
| import org.eclipse.osbp.xtext.dialogdsl.Dialog |
| import org.eclipse.osbp.xtext.dialogdsl.DialogPackage |
| import org.eclipse.osbp.xtext.dialogdsl.mapper.AutowireUiFactory |
| import org.eclipse.xtext.xbase.jvmmodel.AbstractModelInferrer |
| import org.eclipse.xtext.xbase.jvmmodel.IJvmDeclaredTypeAcceptor |
| |
| /** |
| * Infers a JVM model from the source model. |
| * |
| * The JVM model should contain all elements that would appear in the Java code |
| * which is generated from the source model. Other models link against the JVM model rather than the source model. |
| */ |
| class DialogDslJvmModelInferrer extends AbstractModelInferrer { |
| |
| /** |
| * convenience API to build and initialize JVM types and their members. |
| */ |
| @Inject extension DialogDslVaaclipseViewCreator |
| @Inject extension DialogDslMobileViewCreator |
| |
| @Inject AutowireUiFactory autowireFactory |
| |
| def dispatch void infer(DialogPackage pckg, IJvmDeclaredTypeAcceptor acceptor, boolean isPreIndexingPhase) { |
| println('''isPreIndexingPhase: «isPreIndexingPhase»''') |
| if (!isPreIndexingPhase) { |
| for (Dialog dialog : pckg.dialogs) { |
| |
| if (dialog.autowire) { |
| pckg.createVaaclipseUI(dialog, acceptor, _annotationTypesBuilder, _typeReferenceBuilder) |
| } else { |
| var uiview = dialog.uiView |
| var isIDEView = uiview instanceof UiIDEView |
| var isMobileView = uiview instanceof UiMobileView |
| if (isIDEView) { |
| pckg.createVaaclipseUI(dialog, acceptor, _annotationTypesBuilder, _typeReferenceBuilder) |
| } |
| if (isMobileView) { |
| pckg.createMobileUI(dialog, acceptor, _annotationTypesBuilder, _typeReferenceBuilder) |
| } |
| } |
| } |
| } |
| } |
| } |