Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Yet Another Question about Cross Referencing Languages
Yet Another Question about Cross Referencing Languages [message #955581] Tue, 23 October 2012 22:40 Go to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

I followed this well written post http://christiandietrich.wordpress.com/2012/08/07/xtext-referencing-elements-of-one-dsl-from-another-dsl/ and it works until I try to run the workflow. I get this error:

Problem parsing 'classpath:...' ... 'Couldn't resolve reference to EPackage ..' Couldn't resolve reference to EClass...' ... etc. etc.

The used language plugin is in the main language's dependencies.

Any help is appreciated

Thanks!
Re: Yet Another Question about Cross Referencing Languages [message #955932 is a reply to message #955581] Wed, 24 October 2012 05:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Hi how does The workflow look like?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Yet Another Question about Cross Referencing Languages [message #956726 is a reply to message #955932] Wed, 24 October 2012 19:08 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

var grammarURI = "classpath:/sfg/lng/LNG.xtext"
var file.extensions = "lng"
var projectName = "sfg.lng.lng"
var runtimeProject = "../${projectName}"

Workflow {
    bean = StandaloneSetup {
            scanClassPath = true
            platformUri = "${runtimeProject}/.."
            // The following two lines can be removed, if Xbase is not used.
            registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
            registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
        	registerGenModelFile = "platform:/resource/sfg.lng.lng2/src-gen/sfg/lng/lng2.genmodel"
        }
    
        component = DirectoryCleaner {
            directory = "${runtimeProject}/src-gen"
        }
    
        component = DirectoryCleaner {
            directory = "${runtimeProject}.ui/src-gen"
        }
    
        component = Generator {
            pathRtProject = runtimeProject
            pathUiProject = "${runtimeProject}.ui"
            pathTestProject = "${runtimeProject}.tests"
            projectNameRt = projectName
            projectNameUi = "${projectName}.ui"
            language = {
                uri = grammarURI
                fileExtensions = file.extensions
    
                // Java API to access grammar elements (required by several other fragments)
                fragment = grammarAccess.GrammarAccessFragment {}
    
                // generates Java API for the generated EPackages
                fragment = ecore.EcoreGeneratorFragment {
                // referencedGenModels = "
                //  platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel,
                //  platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel
                // "
                }
    
                // Serializer 2.0
                fragment = serializer.SerializerFragment {
                	generateStub = false
                }
                
                // the serialization component (1.0)
                // fragment = parseTreeConstructor.ParseTreeConstructorFragment {}
    
                // a custom ResourceFactory for use with EMF
                fragment = resourceFactory.ResourceFactoryFragment {
                    fileExtensions = file.extensions
                }
    
                // The antlr parser generator fragment.
                fragment = parser.antlr.XtextAntlrGeneratorFragment {
                //  options = {
                //      backtrack = true
                //  }
                }
    
                // java-based API for validation
                fragment = validation.JavaValidatorFragment {
                //    composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
                //    composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
                }
    
                // scoping and exporting API
                fragment = scoping.ImportURIScopingFragment {}
                fragment = exporting.SimpleNamesFragment {}
    
                // scoping and exporting API
                fragment = scoping.ImportNamespacesScopingFragment {}
                fragment = exporting.QualifiedNamesFragment {}
                fragment = builder.BuilderIntegrationFragment {}
    
                // generator API
                fragment = generator.GeneratorFragment {
                    generateMwe = false
                    generateJavaMain = false
                }
    
                // formatter API
                fragment = formatting.FormatterFragment {}
    
                // labeling API
                fragment = labeling.LabelProviderFragment {}
    
                // outline API
                fragment = outline.OutlineTreeProviderFragment {}
                fragment = outline.QuickOutlineFragment {}
    
                // quickfix API
                fragment = quickfix.QuickfixProviderFragment {}
    
                // content assist API
                fragment = contentAssist.JavaBasedContentAssistFragment {}
    
                // generates a more lightweight Antlr parser and lexer tailored for content assist
                fragment = parser.antlr.XtextAntlrUiGeneratorFragment {}
    
                // generates junit test support classes into Generator#pathTestProject
                fragment = junit.Junit4Fragment {}
    
                // project wizard (optional)
                // fragment = projectWizard.SimpleProjectWizardFragment {
                //      generatorProjectName = "${projectName}"
                //      modelFileExtension = file.extensions
                // }
    
                // rename refactoring
                fragment = refactoring.RefactorElementNameFragment {}
    
                // provides the necessary bindings for java types integration
               // fragment = types.TypesGeneratorFragment {}
    
                // generates the required bindings only if the grammar inherits from Xbase
                fragment = xbase.XbaseGeneratorFragment {}
    
                // provides a preference page for template proposals
                fragment = templates.CodetemplatesGeneratorFragment {}
    
                // provides a compare view
                fragment = compare.CompareFragment {
                     fileExtensions = file.extensions
                }
    
            }
        }
}


Follow me on Twitter @andreasindico

[Updated on: Wed, 24 October 2012 19:11]

Report message to a moderator

Re: Yet Another Question about Cross Referencing Languages [message #956746 is a reply to message #956726] Wed, 24 October 2012 19:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Looks like you missed registerGeneratedEPackage = "org.xtext.example.definitions.definitions.DefinitionsPackage" from my blog example

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Yet Another Question about Cross Referencing Languages [message #956835 is a reply to message #956746] Wed, 24 October 2012 21:00 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

right! indeed I did not do that.
Now it says the error is
Caused by: org.eclipse.emf.mwe.core.ConfigurationException: Couldn't find an interface <registered package> at org.eclipse.emf.mwe.utils.StandaloneSetup.addRegisterGeneratedEPackage(StandaloneSetup.java:309)


Although there is the package dependency. Sorry I know this is going to be another silly issue Smile


Follow me on Twitter @andreasindico

Re: Yet Another Question about Cross Referencing Languages [message #956837 is a reply to message #956835] Wed, 24 October 2012 21:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Hi,

are you sure the class name is right? and the class is exported by the plugin you have a dependency to?

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Yet Another Question about Cross Referencing Languages [message #956911 is a reply to message #956837] Wed, 24 October 2012 22:23 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

I guess I am not sure of what should be the right class name.
What is the class I should refer to in the registerGeneratedEPackage?


Follow me on Twitter @andreasindico

[Updated on: Wed, 24 October 2012 22:31]

Report message to a moderator

Re: Yet Another Question about Cross Referencing Languages [message #957274 is a reply to message #956911] Thu, 25 October 2012 05:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Hi it is the name of the epackage generated for your first dsl

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Yet Another Question about Cross Referencing Languages [message #957333 is a reply to message #957274] Thu, 25 October 2012 06:38 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

you mean the EPackage of the related ecore meta-model?

Follow me on Twitter @andreasindico

Re: Yet Another Question about Cross Referencing Languages [message #957355 is a reply to message #957333] Thu, 25 October 2012 06:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Exactly for a new Xtext hello world example it is MydslPackage

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Yet Another Question about Cross Referencing Languages [message #957365 is a reply to message #957355] Thu, 25 October 2012 07:08 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

Sorry I am still missing something Sad


supposed my target language project is called sfg.lng.lng2
it contains a the path src-gen/sfg/lng/lng2/
which contains some files included the ecore
if I open the ecore its meta-model contains just one package called lNG2

what is the right name for the registerGeneratedEPackage



Follow me on Twitter @andreasindico

[Updated on: Thu, 25 October 2012 07:10]

Report message to a moderator

Re: Yet Another Question about Cross Referencing Languages [message #957443 is a reply to message #957365] Thu, 25 October 2012 08:19 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Hi you need to have a look at the java classes generated for the ecore

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Yet Another Question about Cross Referencing Languages [message #958233 is a reply to message #957443] Thu, 25 October 2012 21:36 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

suppose the target language is the Xtext domain model example language

org.eclipse.xtext.example.domainmodel

what should be the registerGeneratedEPackage?


Follow me on Twitter @andreasindico

[Updated on: Thu, 25 October 2012 22:22]

Report message to a moderator

Re: Yet Another Question about Cross Referencing Languages [message #958575 is a reply to message #958233] Fri, 26 October 2012 04:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Hi,

DomainModel example is not an good example to try this out since it uses xbase and you might want to
do the things a bit different (reference to java elements instead of domain model concepts

never the less:

org.eclipse.xtext.example.domainmodel.domainmodel.DomainmodelPackage

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Yet Another Question about Cross Referencing Languages [message #958656 is a reply to message #958575] Fri, 26 October 2012 05:42 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

OK ! I have finally got it and the workflow runs now thank you for your kind help.
Now the problem is that when I execute the generated editor for a client language model I can't impot (as importedURI in the client language grammar) a target language model. The import actually works if I try to import other models of the client language type.



Follow me on Twitter @andreasindico

Re: Yet Another Question about Cross Referencing Languages [message #958718 is a reply to message #958656] Fri, 26 October 2012 06:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Hi sorry can you some show share a complete example + a sample model
project? I have no idea what you are exactly doing. If you do import
URI based or namespace based scoping etc

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Yet Another Question about Cross Referencing Languages [message #958742 is a reply to message #958718] Fri, 26 October 2012 07:20 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Btw the workflow you posted says: you do not use import uris at all.

these dont work that together
// scoping and exporting API
                fragment = scoping.ImportURIScopingFragment {}
                fragment = exporting.SimpleNamesFragment {}
    
                // scoping and exporting API
                fragment = scoping.ImportNamespacesScopingFragment {}
                fragment = exporting.QualifiedNamesFragment {}
                fragment = builder.BuilderIntegrationFragment {}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 26 October 2012 07:21]

Report message to a moderator

Previous Topic:How to know in validation method how many segments has a qualified name link ?
Next Topic:One line = one attribute
Goto Forum:
  


Current Time: Tue Apr 20 20:47:05 GMT 2021

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

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

Back to the top