blob: ee9b2118be77d3c77a355652982e4fa26558cb8f [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.inject.Inject;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.osbp.xtext.oxtype.hooks.IInferrerDelegate;
import org.eclipse.xtext.common.types.JvmDeclaredType;
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
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) {
}
@Override
public void inferFullState(final JvmDeclaredType jvmType, final EObject semanticElement, final IJvmDeclaredTypeAcceptor acceptor, final boolean preIndexingPhase, final String selector) {
if ((this._annotationTypesBuilder == null)) {
this._annotationTypesBuilder = this.annotationRefBuilderFactory.create(semanticElement.eResource().getResourceSet());
}
if ((this._typeReferenceBuilder == null)) {
this._typeReferenceBuilder = this.typeRefBuilderFactory.create(semanticElement.eResource().getResourceSet());
}
}
}