Search in sources :

Example 1 with MutableElement

use of org.eclipse.xtend.lib.macro.declaration.MutableElement in project xtext-xtend by eclipse.

the class AssociatorImpl method setPrimarySourceElement.

@Override
public void setPrimarySourceElement(final MutableElement javaElement, final Element sourceElement) {
    final Element primarySourceElement = this.unit.getTracability().getPrimarySourceElement(sourceElement);
    EObject _switchResult = null;
    boolean _matched = false;
    if (primarySourceElement instanceof TypeReferenceImpl) {
        _matched = true;
        _switchResult = ((TypeReferenceImpl) primarySourceElement).getSource();
    }
    if (!_matched) {
        if (primarySourceElement instanceof AbstractElementImpl) {
            _matched = true;
            _switchResult = ((AbstractElementImpl<?>) primarySourceElement).getDelegate();
        }
    }
    final EObject delegate = _switchResult;
    this.unit.getJvmModelAssociator().associate(delegate, ((AbstractElementImpl<?>) javaElement).getDelegate());
}
Also used : AbstractElementImpl(org.eclipse.xtend.core.macro.declaration.AbstractElementImpl) TypeReferenceImpl(org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl) MutableElement(org.eclipse.xtend.lib.macro.declaration.MutableElement) Element(org.eclipse.xtend.lib.macro.declaration.Element) EObject(org.eclipse.emf.ecore.EObject)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)1 AbstractElementImpl (org.eclipse.xtend.core.macro.declaration.AbstractElementImpl)1 TypeReferenceImpl (org.eclipse.xtend.core.macro.declaration.TypeReferenceImpl)1 Element (org.eclipse.xtend.lib.macro.declaration.Element)1 MutableElement (org.eclipse.xtend.lib.macro.declaration.MutableElement)1