blob: e1cb9166274793ecbb64701e079f3d5ef0c56cab [file] [log] [blame]
/**
* 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
*
*
* This copyright notice shows up in the generated Java code
*/
package org.eclipse.osbp.xtext.i18n;
import com.google.common.base.Objects;
import com.google.inject.Inject;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.osbp.dsl.semantic.common.types.LTypedPackage;
import org.eclipse.osbp.xtext.oxtype.hooks.IInferrerDelegate;
import org.eclipse.xtext.common.types.JvmDeclaredType;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.xbase.jvmmodel.IJvmDeclaredTypeAcceptor;
import org.eclipse.xtext.xbase.jvmmodel.JvmAnnotationReferenceBuilder;
import org.eclipse.xtext.xbase.jvmmodel.JvmTypeReferenceBuilder;
import org.eclipse.xtext.xbase.lib.Extension;
@SuppressWarnings("restriction")
public class JvmInferrerDelegate implements IInferrerDelegate {
@Inject
@Extension
private IQualifiedNameProvider _iQualifiedNameProvider;
@Inject
private JvmAnnotationReferenceBuilder.Factory annotationRefBuilderFactory;
@Inject
private JvmTypeReferenceBuilder.Factory typeRefBuilderFactory;
@Extension
protected JvmAnnotationReferenceBuilder _annotationTypesBuilder;
@Extension
protected JvmTypeReferenceBuilder _typeReferenceBuilder;
@Override
public void inferTypesOnly(final EObject semanticElement, final IJvmDeclaredTypeAcceptor acceptor, final boolean preIndexingPhase) {
if ((semanticElement instanceof LTypedPackage)) {
final LTypedPackage lPkg = ((LTypedPackage) semanticElement);
}
}
@Override
public void inferFullState(final JvmDeclaredType jvmType, final EObject semanticElement, final IJvmDeclaredTypeAcceptor acceptor, final boolean preIndexingPhase, final String selector) {
boolean _equals = Objects.equal(this._annotationTypesBuilder, null);
if (_equals) {
this._annotationTypesBuilder = this.annotationRefBuilderFactory.create(semanticElement.eResource().getResourceSet());
}
boolean _equals_1 = Objects.equal(this._typeReferenceBuilder, null);
if (_equals_1) {
this._typeReferenceBuilder = this.typeRefBuilderFactory.create(semanticElement.eResource().getResourceSet());
}
if (((!Objects.equal(selector, null)) && selector.equals("osbp.translator"))) {
final LTypedPackage lPkg = ((LTypedPackage) semanticElement);
}
}
}