blob: 7dead24d566f2efb1835cb8db0216be0ba368d94 [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
@SuppressWarnings("restriction")
class JvmInferrerDelegate implements IInferrerDelegate {
@Inject JvmAnnotationReferenceBuilder.Factory annotationRefBuilderFactory;
@Inject JvmTypeReferenceBuilder.Factory typeRefBuilderFactory;
@Extension protected JvmAnnotationReferenceBuilder _annotationTypesBuilder;
@Extension protected JvmTypeReferenceBuilder _typeReferenceBuilder;
override void inferTypesOnly(EObject semanticElement, IJvmDeclaredTypeAcceptor acceptor, boolean preIndexingPhase) {
}
override void inferFullState(JvmDeclaredType jvmType, EObject semanticElement, IJvmDeclaredTypeAcceptor acceptor,
boolean preIndexingPhase, String selector) {
if (_annotationTypesBuilder===null){
_annotationTypesBuilder = annotationRefBuilderFactory.create(semanticElement.eResource.getResourceSet());
}
if (_typeReferenceBuilder===null){
_typeReferenceBuilder = typeRefBuilderFactory.create(semanticElement.eResource.getResourceSet());
}
}
}