Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Referencing elements of a DSL from another DSL using XText 1.0.1
Referencing elements of a DSL from another DSL using XText 1.0.1 [message #918987] Fri, 21 September 2012 11:13 Go to next message
Süleyman Issiz is currently offline Süleyman Issiz
Messages: 5
Registered: September 2012
Junior Member
Hi,

I am trying to reference elements of a DSL from another DSL using Xtext 1.0.1 with MWE 1.0.2. I have achieved to access the elements of the other DSL and created a model. But when I try to generate code from the model, I get the following error:

ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Problems instantiating module Generator: Cannot resolve proxy: file:/C:/ModellbasierteEntwicklung/Issiz/CleanStart/logDevTest/x.y.z.logdevgen.generator/bin/workflow/DSLGenerator.mwe2#xtextLink_::0.3.4.0.1.4.1.1::0::/1
java.lang.RuntimeException: Problems instantiating module Generator: Cannot resolve proxy: file:/C:/ModellbasierteEntwicklung/Issiz/CleanStart/logDevTest/x.y.z.logdevgen.generator/bin/workflow/DSLGenerator.mwe2#xtextLink_::0.3.4.0.1.4.1.1::0::/1


I have registered StandAloneSetup classes of both of the DSLs in the workflow as:
register = x.y.z.logdevgen.base.BaseDSLStandaloneSetup {}
register = x.y.z.logdevgen.DSLStandaloneSetup {}



What can be the problem in this case?

Thanks!
Re: Referencing elements of a DSL from another DSL using XText 1.0.1 [message #919020 is a reply to message #918987] Fri, 21 September 2012 11:55 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2498
Registered: July 2009
Senior Member
On 2012-21-09 17:13, Süleyman Issiz wrote:
> Hi,
>
> I am trying to reference elements of a DSL from another DSL using Xtext
> 1.0.1 with MWE 1.0.2.

Any particular reason why you are using these old versions?
Xtext is up to 2.3 now.

Regards
- henrik
Re: Referencing elements of a DSL from another DSL using XText 1.0.1 [message #919027 is a reply to message #918987] Fri, 21 September 2012 12:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6144
Registered: July 2009
Senior Member
Hi,

i cannot reproduce this using Xtext 1.0.2
there must be something else wrong in you case
(e.g. scoping ...)

Regards Christian
Re: Referencing elements of a DSL from another DSL using XText 1.0.1 [message #919031 is a reply to message #919027] Fri, 21 September 2012 12:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6144
Registered: July 2009
Senior Member
p.s: sure the classpath of your mwe file is sufficient?
Re: Referencing elements of a DSL from another DSL using XText 1.0.1 [message #919058 is a reply to message #919031] Fri, 21 September 2012 12:39 Go to previous messageGo to next message
Süleyman Issiz is currently offline Süleyman Issiz
Messages: 5
Registered: September 2012
Junior Member
Dear Christian,

The classpath of the mwe file is sufficient.

What can be the problem with scoping? Here is the workflow file.
Workflow {
    bean = StandaloneSetup {
		platformUri = "${runtimeProject}/.."
	}

	component = DirectoryCleaner {
		directory = "${runtimeProject}/src-gen"
	}

	component = DirectoryCleaner {
		directory = "${runtimeProject}.ui/src-gen"
	}

	component = Generator {
		pathRtProject = runtimeProject
		pathUiProject = "${runtimeProject}.ui"
		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 {
			 //GenModel of the Grammar that is referenced
			 referencedGenModels = logdev_grammar
			}

			// the serialization component
			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"
				// registerForImportedPackages = true
			}

			// scoping and exporting API
			 fragment = scoping.ImportURIScopingFragment {}
			// fragment = exporting.SimpleNamesFragment {}
			fragment = exporting.QualifiedNamesFragment {}

			// scoping and exporting API 
			fragment = scoping.ImportNamespacesScopingFragment {}		
			fragment = builder.BuilderIntegrationFragment {}

			// formatter API 
			fragment = formatting.FormatterFragment {}

			// labeling API 
			fragment = labeling.LabelProviderFragment {}

			// outline API 
			fragment = outline.TransformerFragment {}
			fragment = outline.OutlineNodeAdapterFactoryFragment {}
			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 {}

			// project wizard (optional) 
			 fragment = projectWizard.SimpleProjectWizardFragment {
			 		generatorProjectName = "${projectName}.generator" 
					modelFileExtension = file.extensions
			 }
		}
	}
}

Re: Referencing elements of a DSL from another DSL using XText 1.0.1 [message #919061 is a reply to message #919058] Fri, 21 September 2012 12:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6144
Registered: July 2009
Senior Member
Hi,

you have import uri and import namespace scoping on this looks strange.
does it work in the editor?
how do the files look like?

Re: Referencing elements of a DSL from another DSL using XText 1.0.1 [message #919069 is a reply to message #919061] Fri, 21 September 2012 12:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6144
Registered: July 2009
Senior Member
Hi,

btw the log error message still looks like it cannot find everything in the mwe2 file (and not the model files)
then the message would be

1 error:
Example.mydslb - C:\development\Xtext102\workspaceaaaaua5\org.xtext.example.mydslb.generator\src\model\Example.mydslb
1: Couldn't resolve reference to ElementA 'Xx'.
at org.eclipse.xtext.mwe.Validator.validate(Validator.java:88)
at org.eclipse.xtext.mwe.Reader.invokeInternal(Reader.java:165)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:31)
at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:80)
... 3 more


and: how do you call the mwe2 file?
Re: Referencing elements of a DSL from another DSL using XText 1.0.1 [message #921483 is a reply to message #919069] Mon, 24 September 2012 02:44 Go to previous messageGo to next message
Süleyman Issiz is currently offline Süleyman Issiz
Messages: 5
Registered: September 2012
Junior Member
Hi,

Yes it works in the editor. The model to be referenced looks like:
MyDevice X{
	
	events{
		Command->CommandNameA;
                Command->CommandNameB;		
		
	}
	actions{
		ActionNameA->stateAction;
		
		
	}
	states{
		firstState{
			
			on CommandNameA {
				
				do ActionNameA;
				
			}
		}
	}
}


And I reference to the model above within the following model:
SecondModel X{
		Cases {
			Case 1{
				PreCondition{
					input X.CommandNameA 
					{
						output X.ActionNameA ;
					}
				}
				
			}
		}
	}
	



And I am calling the model in the runtime application as:

module Generator

var targetDir = "src-gen"
var modelPath = "src/model"

Workflow {
	component = @workflow.DSLGenerator auto-inject {}
}
Re: Referencing elements of a DSL from another DSL using XText 1.0.1 [message #921514 is a reply to message #921483] Mon, 24 September 2012 03:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6144
Registered: July 2009
Senior Member
And you are sure you have all deps explicitly in that runtime (model)
project

--
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: Referencing elements of a DSL from another DSL using XText 1.0.1 [message #921560 is a reply to message #921514] Mon, 24 September 2012 04:18 Go to previous message
Süleyman Issiz is currently offline Süleyman Issiz
Messages: 5
Registered: September 2012
Junior Member
Hi Christian,

you are right the problem was with the dependencies. I had to re-export the plug-in of the DSL that I am referencing to as it was not done automatically.

Thanks!
Previous Topic:How to emit error message if line length exceeds some threshold
Next Topic:PartialParsingHelper.reparse removes Container ?!
Goto Forum:
  


Current Time: Thu Jul 31 20:01:36 EDT 2014

Powered by FUDForum. Page generated in 0.04630 seconds