Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xcore - Using annotations in IDE
Xcore - Using annotations in IDE [message #1221899] Wed, 18 December 2013 16:44 Go to next message
Florian Pirchner is currently offline Florian PirchnerFriend
Messages: 94
Registered: July 2009
Member

Hi,

i got the following issue:

If i am using Xcore to define a model and i would like to use the annotations defined in org.eclipse.emf.ecore.xcore.lib, i have to import the project into workspace. Otherwise i am getting following error message in the editor:
"Couldn't resolve reference to XAnnotationDirective 'GenModel'."

Is there a way to avoid importing the lib bundle into workspace?

Thanks, Florian
Re: Xcore - Using annotations in IDE [message #1221938 is a reply to message #1221899] Wed, 18 December 2013 18:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14664
Registered: July 2009
Senior Member
simply use a plugin project with a dependency doesnt work?
it works for the one created with the xcore wizard

@GenModel(copyrightText="Test")
package test

annotation "http://www.eclipse.org/emf/2002/GenModel" as genmodel

class Entity {
	
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xcore - Using annotations in IDE [message #1221940 is a reply to message #1221938] Wed, 18 December 2013 18:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14664
Registered: July 2009
Senior Member
alternatively the following works as well

@GenModel(copyrightText="Test")
package test

import GenModel

class Entity {
	
}


@GenModel(copyrightText="Test2")
package test

class Entity {
	
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xcore - Using annotations in IDE [message #1221941 is a reply to message #1221940] Wed, 18 December 2013 18:49 Go to previous messageGo to next message
Florian Pirchner is currently offline Florian PirchnerFriend
Messages: 94
Registered: July 2009
Member

Thanks, "import GenModel". That was the clou...

Thanks Florian
Re: Xcore - Using annotations in IDE [message #1221943 is a reply to message #1221941] Wed, 18 December 2013 18:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14664
Registered: July 2009
Senior Member
P.S:

seems you need at least a import yes.
the other one did not survive a clean build


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xcore - Using annotations in IDE [message #1222153 is a reply to message #1221943] Thu, 19 December 2013 19:43 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
It should be sufficient for the project to have a dependency on
org.eclipse.emf.ecore.xcore.lib and for that bundle to be in your target
platform.

On 18/12/2013 7:52 PM, Christian Dietrich wrote:
> P.S:
>
> seems you need at least a import yes.
> the other one did not survive a clean build


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Xcore - Using annotations in IDE [message #1222378 is a reply to message #1222153] Fri, 20 December 2013 09:17 Go to previous messageGo to next message
Florian Pirchner is currently offline Florian PirchnerFriend
Messages: 94
Registered: July 2009
Member

Hi Ed,

a simple dependency does not work. Without an import statement i have to import the xcore.lib bundle into the workspace.

Best, Florian
Re: Xcore - Using annotations in IDE [message #1222424 is a reply to message #1222378] Fri, 20 December 2013 11:25 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Florian,

I just tested this

@GenModel(prefix="Tester")
@Ecore(nsURI="http://www.example.org/test")
package org.example.test

class Test
{
}

and it works fine without imports and without xcore.lib in the workspace
(including the Ecore annotation). In general, I expect the things
declared in XcoreLang.xcore to be visible everywhere without imports.

package xcore.lang

annotation "http://www.eclipse.org/emf/2002/Ecore" as Ecore
annotation "http:///org/eclipse/emf/ecore/util/ExtendedMetaData" as
ExtendedMetaData
annotation "http://www.eclipse.org/emf/2002/GenModel" as GenModel

Via the properties view you can set GenModel properties and they're
converted to annotations with this basic assumption.

Which version of Xcore are you using?


On 20/12/2013 10:17 AM, Florian Pirchner wrote:
> Hi Ed,
>
> a simple dependency does not work. Without an import statement i have
> to import the xcore.lib bundle into the workspace.
>
> Best, Florian


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Xcore - Using annotations in IDE [message #1227385 is a reply to message #1222424] Sat, 04 January 2014 10:33 Go to previous message
Florian Pirchner is currently offline Florian PirchnerFriend
Messages: 94
Registered: July 2009
Member

Hi Ed,

interesting. I will do another try in the evening.

I am using the version shipped with Xtext 2.5.1.

Best Florian
Previous Topic:Xtext OutputConfigurationProvider
Next Topic:Content-assist grammar has warnings while the main one has no
Goto Forum:
  


Current Time: Tue Apr 16 12:45:26 GMT 2024

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

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

Back to the top