| Summary: | Import of existing EPackages in grammars that inherit from Xbase | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Natalia Ossipova <mail> | ||||||
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> | ||||||
| Status: | CLOSED WORKSFORME | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | Holger.Schill, sebastian.zarnekow | ||||||
| Version: | 2.0.1 | Flags: | sebastian.zarnekow:
indigo+
|
||||||
| Target Milestone: | SR2 | ||||||||
| Hardware: | Macintosh | ||||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Natalia Ossipova
Which Xtext build do you use? How do you configure your workflow? Please attach a reproducable example project if possible. (In reply to comment #1) > Which Xtext build do you use? I've tried two different build versions in my target platform: the 2.0.1 release and a nightly N201110060342. Same result. (In reply to comment #2) > How do you configure your workflow? Please attach a reproducable example > project if possible. Ok, I'll try to reproduce the issue with some dummy projects. Created attachment 204912 [details]
Example projects illustrating the issue
Steps to reproduce the issue:
1. Extract the projects into your Eclipse workspace.
2. Open the grammar Function.xtext.
3. Try to import the Pattern EPackage either by using a platform URI or a namespace URI (uncomment one of the import statements).
Note: These projects were created using Xtext release build 2.0.1.
Thanks for the reproducable example. Natalia, I could not reproduce the issue with the latest nightly of Xtext. Both with Xtext plugins in my workspace as with a fresh and shiny empty workspace the languages validated fine in the editor. The workflows missed some information, though. I had to add the following information to the standalone setup: scanClassPath = true registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage" In addition, the functions test lang required the PatternPackage to be registered: registerGeneratedEPackage = "org.xtext.example.dsl.pattern.pattern.PatternPackage" I even made the languages more complex. That is, I referenced other rules and types and the generator worked flawlessly. Please reopen, if I missed something. Just as a sidenote: The eclipse build server is currently not responding / working. You may not be able to access the "latest" nightlies. However, there were no changes in the underlying implementation for a couple of weeks so I expect the thing to be fixed short after 2.0.1 was out (at least we worked on this one in those weeks). I this scanClassPath = true is the key. That is what I also observed in my current project. Sebastian, I upgraded my Xtext build to the nightly N201110100446 and added the missing informations to all workflows. The workflows run smooth now. But the Function grammar still has an error at the Pattern import line: "Couldn't resolve reference to EPackage 'http://www.xtext.org/example/dsl/Pattern'." By the way, if I let the Function language inherit from the Pattern language instead of Types (see below) the error disappears. grammar org.xtext.example.dsl.function.Function with org.xtext.example.dsl.pattern.Pattern generate function "http://www.xtext.org/example/dsl/Function" import "http://www.xtext.org/example/dsl/Types" as types import "http://www.xtext.org/example/dsl/Pattern" as pattern (In reply to comment #8) > Sebastian, > > I upgraded my Xtext build to the nightly N201110100446 and added the missing > informations to all workflows. The workflows run smooth now. But the Function > grammar still has an error at the Pattern import line: "Couldn't resolve > reference to EPackage 'http://www.xtext.org/example/dsl/Pattern'." Looks like the ecore file with the Pattern package was not properly indexed. Can you find the package via ctrl+shift+f3 / cmd+shift+f3? You have to make sure that the Pattern language was properly generated prior to being able to reference the package, but since you mentioned that all workflows run smoothly, I assume that you already did this. Created attachment 204979 [details]
Screenshot Open Model Element dialog
Yes, I can find the package via cmd+shift+f3. Look at the screenshot please.
It works now. The strange behavior of the Xtext grammar editor was caused by the mix of different versions of Xtext plugins installed in Eclipse and in the target platform (Grrrr!). |