org.eclipse.xtend.lib.macro.declaration.Element Java Examples

The following examples show how to use org.eclipse.xtend.lib.macro.declaration.Element. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TracabilityImpl.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Element getPrimaryGeneratedJavaElement(final Element source) {
  boolean _isSource = this.isSource(source);
  if (_isSource) {
    final EObject derivedElement = IterableExtensions.<EObject>head(this.unit.getJvmModelAssociations().getJvmElements(((AbstractElementImpl<?>) source).getDelegate()));
    if ((derivedElement != null)) {
      return this.unit.toJvmElement(derivedElement);
    }
  } else {
    boolean _isGenerated = this.isGenerated(source);
    if (_isGenerated) {
      return source;
    }
  }
  return null;
}
 
Example #2
Source File: AssociatorImpl.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@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());
}
 
Example #3
Source File: CompilationUnitImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public Element toJvmElement(final EObject delegate) {
  final Function1<EObject, Element> _function = (EObject it) -> {
    Element _switchResult = null;
    boolean _matched = false;
    if (delegate instanceof JvmIdentifiableElement) {
      _matched=true;
      _switchResult = this.toNamedElement(((JvmIdentifiableElement)delegate));
    }
    if (!_matched) {
      if (delegate instanceof JvmTypeReference) {
        _matched=true;
        _switchResult = this.toTypeReference(((JvmTypeReference)delegate));
      }
    }
    if (!_matched) {
      if (delegate instanceof XExpression) {
        _matched=true;
        _switchResult = this.toExpression(((XExpression)delegate));
      }
    }
    if (!_matched) {
      if (delegate instanceof JvmAnnotationReference) {
        _matched=true;
        _switchResult = this.toAnnotationReference(((JvmAnnotationReference)delegate));
      }
    }
    if (!_matched) {
      throw new UnsupportedOperationException((("Couldn\'t translate \'" + delegate) + "\'"));
    }
    return _switchResult;
  };
  return this.<EObject, Element>getOrCreate(delegate, _function);
}
 
Example #4
Source File: TracabilityImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Element getPrimarySourceElement(final Element target) {
  boolean _isGenerated = this.isGenerated(target);
  if (_isGenerated) {
    final EObject sourceElement = IterableExtensions.<EObject>head(this.unit.getJvmModelAssociations().getSourceElements(((AbstractElementImpl<?>) target).getDelegate()));
    return this.unit.toXtendElement(sourceElement);
  } else {
    boolean _isSource = this.isSource(target);
    if (_isSource) {
      return target;
    }
  }
  return null;
}
 
Example #5
Source File: TracabilityImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean isSource(final Element element) {
  boolean _switchResult = false;
  boolean _matched = false;
  if (element instanceof XtendNamedElementImpl) {
    _matched=true;
    _switchResult = true;
  }
  if (!_matched) {
    if (element instanceof XtendAnnotationReferenceImpl) {
      _matched=true;
      _switchResult = true;
    }
  }
  if (!_matched) {
    if (element instanceof Expression) {
      _matched=true;
      _switchResult = true;
    }
  }
  if (!_matched) {
    if (element instanceof TypeReferenceImpl) {
      JvmTypeReference _source = ((TypeReferenceImpl)element).getSource();
      boolean _tripleNotEquals = (_source != null);
      if (_tripleNotEquals) {
        _matched=true;
        _switchResult = true;
      }
    }
  }
  if (!_matched) {
    _switchResult = false;
  }
  return _switchResult;
}
 
Example #6
Source File: TracabilityImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean isThePrimaryGeneratedJavaElement(final Element target) {
  boolean _xblockexpression = false;
  {
    final Element source = this.getPrimarySourceElement(target);
    if ((source == null)) {
      return false;
    }
    Element _primaryGeneratedJavaElement = this.getPrimaryGeneratedJavaElement(source);
    _xblockexpression = Objects.equal(_primaryGeneratedJavaElement, target);
  }
  return _xblockexpression;
}
 
Example #7
Source File: ProblemSupportImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void addError(final Element element, final String message) {
  this.checkCanceled();
  this.checkValidationAllowed();
  final Pair<Resource, EObject> resAndObj = this.getResourceAndEObject(element);
  EList<Resource.Diagnostic> _errors = resAndObj.getKey().getErrors();
  EObject _value = resAndObj.getValue();
  EStructuralFeature _significantFeature = this.getSignificantFeature(resAndObj.getValue());
  EObjectDiagnosticImpl _eObjectDiagnosticImpl = new EObjectDiagnosticImpl(Severity.ERROR, "user.issue", message, _value, _significantFeature, (-1), null);
  _errors.add(_eObjectDiagnosticImpl);
}
 
Example #8
Source File: ProblemSupportImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void addWarning(final Element element, final String message) {
  this.checkCanceled();
  this.checkValidationAllowed();
  final Pair<Resource, EObject> resAndObj = this.getResourceAndEObject(element);
  EList<Resource.Diagnostic> _warnings = resAndObj.getKey().getWarnings();
  EObject _value = resAndObj.getValue();
  EStructuralFeature _significantFeature = this.getSignificantFeature(resAndObj.getValue());
  EObjectDiagnosticImpl _eObjectDiagnosticImpl = new EObjectDiagnosticImpl(Severity.WARNING, "user.issue", message, _value, _significantFeature, (-1), null);
  _warnings.add(_eObjectDiagnosticImpl);
}
 
Example #9
Source File: TransformationContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public void setPrimarySourceElement(final MutableElement javaElement, final Element sourceElement) {
  this.getAssociator().setPrimarySourceElement(javaElement, sourceElement);
}
 
Example #10
Source File: TransformationContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public List<? extends Problem> getProblems(final Element element) {
  return this.getProblemSupport().getProblems(element);
}
 
Example #11
Source File: CompilationUnitImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public Element toXtendElement(final EObject delegate) {
  final Function1<EObject, Element> _function = (EObject it) -> {
    Element _switchResult = null;
    boolean _matched = false;
    if (delegate instanceof XtendMember) {
      _matched=true;
      _switchResult = this.toXtendMemberDeclaration(((XtendMember)delegate));
    }
    if (!_matched) {
      if (delegate instanceof XtendParameter) {
        _matched=true;
        _switchResult = this.toXtendParameterDeclaration(((XtendParameter)delegate));
      }
    }
    if (!_matched) {
      if (delegate instanceof JvmTypeParameter) {
        _matched=true;
        _switchResult = this.toXtendTypeParameterDeclaration(((JvmTypeParameter)delegate));
      }
    }
    if (!_matched) {
      if (delegate instanceof JvmTypeReference) {
        _matched=true;
        _switchResult = this.toTypeReference(((JvmTypeReference)delegate));
      }
    }
    if (!_matched) {
      if (delegate instanceof XAnnotation) {
        _matched=true;
        _switchResult = this.toAnnotationReference(((XAnnotation)delegate));
      }
    }
    if (!_matched) {
      if (delegate instanceof XExpression) {
        _matched=true;
        _switchResult = this.toExpression(((XExpression)delegate));
      }
    }
    if (!_matched) {
      throw new UnsupportedOperationException((("Couldn\'t translate \'" + delegate) + "\'"));
    }
    return _switchResult;
  };
  return this.<EObject, Element>getOrCreate(delegate, _function);
}
 
Example #12
Source File: TransformationContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public boolean isThePrimaryGeneratedJavaElement(final Element target) {
  return this.getTracability().isThePrimaryGeneratedJavaElement(target);
}
 
Example #13
Source File: TransformationContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public boolean isSource(final Element element) {
  return this.getTracability().isSource(element);
}
 
Example #14
Source File: TransformationContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public boolean isGenerated(final Element element) {
  return this.getTracability().isGenerated(element);
}
 
Example #15
Source File: TransformationContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public boolean isExternal(final Element element) {
  return this.getTracability().isExternal(element);
}
 
Example #16
Source File: TransformationContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public Element getPrimarySourceElement(final Element target) {
  return this.getTracability().getPrimarySourceElement(target);
}
 
Example #17
Source File: TransformationContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public Element getPrimaryGeneratedJavaElement(final Element source) {
  return this.getTracability().getPrimaryGeneratedJavaElement(source);
}
 
Example #18
Source File: TransformationContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public void addWarning(final Element element, final String message) {
  this.getProblemSupport().addWarning(element, message);
}
 
Example #19
Source File: TracabilityImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public boolean isExternal(final Element element) {
  return ((!this.isSource(element)) && (!this.isGenerated(element)));
}
 
Example #20
Source File: JsonRpcDataTransformationContext.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
public void addError(final Element arg0, final String arg1) {
  this.delegate.addError(arg0, arg1);
}
 
Example #21
Source File: JsonRpcDataTransformationContext.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
public void addWarning(final Element arg0, final String arg1) {
  this.delegate.addWarning(arg0, arg1);
}
 
Example #22
Source File: JsonRpcDataTransformationContext.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
public Element getPrimaryGeneratedJavaElement(final Element arg0) {
  return this.delegate.getPrimaryGeneratedJavaElement(arg0);
}
 
Example #23
Source File: JsonRpcDataTransformationContext.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
public Element getPrimarySourceElement(final Element arg0) {
  return this.delegate.getPrimarySourceElement(arg0);
}
 
Example #24
Source File: JsonRpcDataTransformationContext.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
public List<? extends Problem> getProblems(final Element arg0) {
  return this.delegate.getProblems(arg0);
}
 
Example #25
Source File: JsonRpcDataTransformationContext.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
public boolean isExternal(final Element arg0) {
  return this.delegate.isExternal(arg0);
}
 
Example #26
Source File: JsonRpcDataTransformationContext.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
public boolean isGenerated(final Element arg0) {
  return this.delegate.isGenerated(arg0);
}
 
Example #27
Source File: JsonRpcDataTransformationContext.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
public boolean isSource(final Element arg0) {
  return this.delegate.isSource(arg0);
}
 
Example #28
Source File: JsonRpcDataTransformationContext.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
public boolean isThePrimaryGeneratedJavaElement(final Element arg0) {
  return this.delegate.isThePrimaryGeneratedJavaElement(arg0);
}
 
Example #29
Source File: JsonRpcDataTransformationContext.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
public void setPrimarySourceElement(final MutableElement arg0, final Element arg1) {
  this.delegate.setPrimarySourceElement(arg0, arg1);
}
 
Example #30
Source File: TransformationContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public void addError(final Element element, final String message) {
  this.getProblemSupport().addError(element, message);
}