Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to generate annotations like @Domain(name="Hello")
How to generate annotations like @Domain(name="Hello") [message #1699076] Sat, 20 June 2015 12:14 Go to next message
Marko Markovic is currently offline Marko MarkovicFriend
Messages: 35
Registered: August 2014
Member
I tried this:

val a = annotationRef("alas.annotation.Domain")
//or val a = toAnnotation("alas.annotation.Domain")

val v = TypesFactory::eINSTANCE.createJvmStringAnnotationValue()
val op = a.annotation.members.filter(typeof(JvmOperation)).filter(o|o.simpleName == "name").head
v.operation = op
v.values += agentdefinition.name
a.values += v
annotations += a

but it doesn't work. In console I have next text:

2 [Worker-0] ERROR org.eclipse.xtext.xbase.jvmmodel.JvmModelAssociator - Error calling inferrer
java.lang.UnsupportedOperationException
at org.eclipse.emf.common.util.ECollections$UnmodifiableEList.add(ECollections.java:354)
at org.eclipse.xtext.xbase.jvmmodel.JvmTypesBuilder.operator_add(JvmTypesBuilder.java:121)
at uns.ac.rs.alas.jvmmodel.AlasJvmModelInferrer$1.apply(AlasJvmModelInferrer.java:161)
at uns.ac.rs.alas.jvmmodel.AlasJvmModelInferrer$1.apply(AlasJvmModelInferrer.java:1)
at org.eclipse.xtext.xbase.jvmmodel.JvmModelAssociator$1.run(JvmModelAssociator.java:397)
at org.eclipse.xtext.xbase.jvmmodel.JvmModelAssociator.installDerivedState(JvmModelAssociator.java:407)
at org.eclipse.xtext.resource.DerivedStateAwareResource.installDerivedState(DerivedStateAwareResource.java:240)
at org.eclipse.xtext.xbase.resource.BatchLinkableResource.getContents(BatchLinkableResource.java:148)
at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingReconciler.beforeRefresh(HighlightingReconciler.java:344)
at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingReconciler$2$1.exec(HighlightingReconciler.java:324)
at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingReconciler$2$1.exec(HighlightingReconciler.java:1)
at org.eclipse.xtext.util.concurrent.CancelableUnitOfWork.exec(CancelableUnitOfWork.java:26)
at org.eclipse.xtext.resource.OutdatedStateManager.exec(OutdatedStateManager.java:121)
at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.internalReadOnly(XtextDocument.java:520)
at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.readOnly(XtextDocument.java:492)
at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:133)
at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingReconciler$2.run(HighlightingReconciler.java:320)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Best regards,
Marko
Re: How to generate annotations like @Domain(name="Hello") [message #1699080 is a reply to message #1699076] Sat, 20 June 2015 13:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
it is expliciteValues and not values

https://www.eclipse.org/forums/index.php?t=msg&th=1067387&goto=1698455&#msg_1698455


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to generate annotations like @Domain(name="Hello") [message #1699132 is a reply to message #1699080] Sun, 21 June 2015 21:58 Go to previous message
Marko Markovic is currently offline Marko MarkovicFriend
Messages: 35
Registered: August 2014
Member
It works!

Thanks a lot Christian!

Best regards,
Marko
Previous Topic:xText - how to define an include statement
Next Topic:Is there is a way to parse certain file after the generating from outside the editor
Goto Forum:
  


Current Time: Tue Mar 19 09:33:08 GMT 2024

Powered by FUDForum. Page generated in 0.05342 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top