Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 443967

Summary: With XCore models, datatypes (e.g. EInt) are displayed as "EJavaObject" and create errors
Product: [Modeling] Ecoretools Reporter: Erwan Bousse <erwan.bousse>
Component: GeneralAssignee: Project Inbox <ecore-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cedric.brun
Version: 2.0   
Target Milestone: 3.0.0M6   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 458841    
Bug Blocks:    
Attachments:
Description Flags
A screenshot with the error in the class diagram
none
The Eclipse project with the Xcore file and the class diagram
none
Details about the used eclipse installation none

Description Erwan Bousse CLA 2014-09-12 11:21:03 EDT
Created attachment 247014 [details]
A screenshot with the error in the class diagram

I have the following Ecore model written using XCore:

------------------
package root

class A {
	refers B c
}

class B {
	
}

class C {
	int x
}
------------------

1) I right-click the .xcore file and choose "Initialise Ecore Diagram ...", which creates a .aird file.

2) I choose to represent a class diagram for the package "root", and I choose "Add related elements" to put A, B and C in the diagram.

3) A and B are displayed very nicely, including the reference. But C appears in red, with the attribute "x" being shown as typed by "EJavaObject" instead of "EInt".

I've attached a screenshot, and in a second attachment i'll put the whole project.
Comment 1 Erwan Bousse CLA 2014-09-12 11:21:35 EDT
Created attachment 247015 [details]
The Eclipse project with the Xcore file and the class diagram
Comment 2 Cedric Brun CLA 2014-09-12 11:24:36 EDT
Hi, and thanks for taking the time to report this. It is actually a problem in EcoreTools and not in Sirius, I will move the bugzilla there.
Comment 3 Erwan Bousse CLA 2014-09-12 11:35:49 EDT
Created attachment 247017 [details]
Details about the used eclipse installation

Thanks!

I'm also adding details about my eclipse installation (from "Help" -> "Installation details").
Comment 4 Cedric Brun CLA 2014-09-12 11:38:41 EDT
I could reproduce the problem thanks to your project, thanks for that.

For "some reasons" the Ecore model which is getting computed by Xcore does not resolve to proper Ecore datatypes when loaded with Sirius (with or without the XTextResourceSet)

In the same environment when I load the .xcore model in the reflective editor, the eType references are correctly resolved.
Comment 5 Cedric Brun CLA 2014-11-07 03:52:47 EST
After analysis, the Ecore reflective editor is able to resolve those links by using the XMLResource.OPTION_MISSING_PACKAGE_HANDLER. I could reuse the same support in EcoreTools. The only concern I have right now is that this API got introduced in EMF 2.9 and EcoreTools 2.0.x supports Eclipse 3.8 (and hence EMF 2.8)

I need either to introduce a specific plugin or use Java reflexion to setup this when the option is present in EMF.
Comment 6 Cedric Brun CLA 2014-11-07 09:32:06 EST
commits moving forward by setting up the MISSING_PACKAGE_HANDLER:

 http://git.eclipse.org/c/ecoretools/org.eclipse.ecoretools.git/commit/?id=5915f7382de5237db84701c20dae9d79cb623115 (master) 
and http://git.eclipse.org/c/ecoretools/org.eclipse.ecoretools.git/commit/?h=2.0&id=59640e5973fb7b2d3b101b69bbffa5395b32a3bc (2.0)

That being said, this scenario is not going to work until either Bug 450535 or Bug 443967 gets fixed in Sirius.
Comment 7 Cedric Brun CLA 2015-01-30 11:24:24 EST
Update : Bug 458621 made me go back to a long debugging session and have a better understanding of what's happening.

Sirius is actually "resetting" all the URI mappings which got computed and registered by EcoreTools using the public static java.util.Map<URI,URI> computePlatformURIMap(boolean targetPlatform)
This is not on purpose and was a side effect of instrumenting the URIConverters to get a proper progress-monitor feedback while loading.

Just tracked Bug 458841 to keep track of this fix for Sirius
Comment 8 Cedric Brun CLA 2015-03-04 10:38:41 EST
This has been fixed in both EcoreTools 2.0.x maintenance stream and Sirius 2.0.x maintenance stream.

http://download.eclipse.org/ecoretools/updates/nightly/2.0.x/luna
http://download.eclipse.org/sirius/updates/nightly/2.0.x/luna

Feel free to reopen if you experience this issue again.

Thanks !