Skip to main content



      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 18:40 Go to next message
Eclipse UserFriend
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 01:31 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Yet Another Question about Cross Referencing Languages [message #956726 is a reply to message #955932] Wed, 24 October 2012 15:08 Go to previous messageGo to next message
Eclipse UserFriend
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
                }
    
            }
        }
}

[Updated on: Wed, 24 October 2012 15:11] by Moderator

Re: Yet Another Question about Cross Referencing Languages [message #956746 is a reply to message #956726] Wed, 24 October 2012 15:29 Go to previous messageGo to next message
Eclipse UserFriend
Looks like you missed registerGeneratedEPackage = "org.xtext.example.definitions.definitions.DefinitionsPackage" from my blog example
Re: Yet Another Question about Cross Referencing Languages [message #956835 is a reply to message #956746] Wed, 24 October 2012 17:00 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Yet Another Question about Cross Referencing Languages [message #956837 is a reply to message #956835] Wed, 24 October 2012 17:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

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

~Christian
Re: Yet Another Question about Cross Referencing Languages [message #956911 is a reply to message #956837] Wed, 24 October 2012 18:23 Go to previous messageGo to next message
Eclipse UserFriend
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?

[Updated on: Wed, 24 October 2012 18:31] by Moderator

Re: Yet Another Question about Cross Referencing Languages [message #957274 is a reply to message #956911] Thu, 25 October 2012 01:29 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Yet Another Question about Cross Referencing Languages [message #957333 is a reply to message #957274] Thu, 25 October 2012 02:38 Go to previous messageGo to next message
Eclipse UserFriend
you mean the EPackage of the related ecore meta-model?
Re: Yet Another Question about Cross Referencing Languages [message #957355 is a reply to message #957333] Thu, 25 October 2012 02:54 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Yet Another Question about Cross Referencing Languages [message #957365 is a reply to message #957355] Thu, 25 October 2012 03:08 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Thu, 25 October 2012 03:10] by Moderator

Re: Yet Another Question about Cross Referencing Languages [message #957443 is a reply to message #957365] Thu, 25 October 2012 04:19 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Yet Another Question about Cross Referencing Languages [message #958233 is a reply to message #957443] Thu, 25 October 2012 17:36 Go to previous messageGo to next message
Eclipse UserFriend
suppose the target language is the Xtext domain model example language

org.eclipse.xtext.example.domainmodel

what should be the registerGeneratedEPackage?

[Updated on: Thu, 25 October 2012 18:22] by Moderator

Re: Yet Another Question about Cross Referencing Languages [message #958575 is a reply to message #958233] Fri, 26 October 2012 00:06 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Yet Another Question about Cross Referencing Languages [message #958656 is a reply to message #958575] Fri, 26 October 2012 01:42 Go to previous messageGo to next message
Eclipse UserFriend
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.

Re: Yet Another Question about Cross Referencing Languages [message #958718 is a reply to message #958656] Fri, 26 October 2012 02:50 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Yet Another Question about Cross Referencing Languages [message #958742 is a reply to message #958718] Fri, 26 October 2012 03:20 Go to previous message
Eclipse UserFriend
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 {}

[Updated on: Fri, 26 October 2012 03:21] by 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: Sun Jul 13 20:43:16 EDT 2025

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

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

Back to the top