use of org.eclipse.xtend.core.macro.declaration.AbstractElementImpl in project xtext-xtend by eclipse.
the class ProblemSupportImpl method getResourceAndEObject.
private Pair<Resource, EObject> getResourceAndEObject(final Element element) {
this.checkCanceled();
boolean _matched = false;
if (element instanceof CompilationUnitImpl) {
boolean _equals = Objects.equal(element, this.compilationUnit);
if (_equals) {
_matched = true;
Resource _eResource = this.compilationUnit.getXtendFile().eResource();
XtendFile _xtendFile = this.compilationUnit.getXtendFile();
return Pair.<Resource, EObject>of(_eResource, _xtendFile);
}
}
if (!_matched) {
if (element instanceof AbstractElementImpl) {
_matched = true;
final Resource resource = ((AbstractElementImpl<? extends EObject>) element).getDelegate().eResource();
Resource _eResource = this.compilationUnit.getXtendFile().eResource();
boolean _equals = Objects.equal(resource, _eResource);
if (_equals) {
final EObject eobject = this.compilationUnit.getJvmModelAssociations().getPrimarySourceElement(((AbstractElementImpl<? extends EObject>) element).getDelegate());
if ((eobject == null)) {
EObject _delegate = ((AbstractElementImpl<? extends EObject>) element).getDelegate();
return Pair.<Resource, EObject>of(resource, _delegate);
}
return Pair.<Resource, EObject>of(resource, eobject);
}
}
}
throw new IllegalArgumentException("You can only add issues on locally declared elements.");
}
use of org.eclipse.xtend.core.macro.declaration.AbstractElementImpl 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());
}
Aggregations