org.eclipse.xtend.lib.macro.declaration.MutableElement Java Examples
The following examples show how to use
org.eclipse.xtend.lib.macro.declaration.MutableElement.
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: AssociatorImpl.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@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 #2
Source File: TransformationContextImpl.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
public void setPrimarySourceElement(final MutableElement javaElement, final Element sourceElement) { this.getAssociator().setPrimarySourceElement(javaElement, sourceElement); }
Example #3
Source File: JsonRpcDataTransformationContext.java From lsp4j with Eclipse Public License 2.0 | 4 votes |
public void setPrimarySourceElement(final MutableElement arg0, final Element arg1) { this.delegate.setPrimarySourceElement(arg0, arg1); }
Example #4
Source File: Associator.java From xtext-lib with Eclipse Public License 2.0 | 2 votes |
/** * Associates the generate element with the Xtend source code. Every generated element should have * a source element. This information is used by features like "Go to Declaration" and the outline view. * A typical use case (generating a getter for a field) would look like this: * * <pre> * myClass.declaredFields.forEach[field| * myClass.addMethod("get" + field.simpleName.toFirstUpper) [ * primarySourceElement = field * // return type, body etc... * ] * ] * </pre> * * This way, the getter generated in the active annotation above would be associated with the field in the Xtend source code. * Notice that we passed the field from the Java AST as a source element. This is a shortcut for * * <pre> * primarySourceElement = field.primarySourceElement * </pre> * * @param sourceElement the source element that the secondaryElement was derived from * @param javaElement the generated Java element */ void setPrimarySourceElement(MutableElement javaElement, Element sourceElement);