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

Bug 317590

Summary: Model Browser: invalid emf model element
Product: [Modeling] MoDisco Reporter: Gabriel BARBIER <barbier.gabriel>
Component: InfrastructureAssignee: Nicolas Bros <nicolas.bros>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: fabien.giquel, gdupe, hugo.bruneliere, modisco.web-inbox, nicolas.bros
Version: 0.9.0Flags: nicolas.bros: indigo+
Target Milestone: 0.9.0 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
the invalid model ... none

Description Gabriel BARBIER CLA 2010-06-22 10:42:24 EDT
Created attachment 172419 [details]
the invalid model ...

Hello,
When navigating a model that references non Emf objects (standard java objects), the following error occurs:
java.lang.Class cannot be cast to org.eclipse.emf.EObject

To reproduce the bug, use the provided model (be careful to open these model, you will have to install the b3 project from this repository = http://dev.eclipse.org/svnroot/modeling/org.eclipse.emft.b3).

Regards,
Gabriel
Comment 1 Gabriel BARBIER CLA 2010-06-22 10:43:28 EDT
I forgot to add that the same model had been correctly opened in the Ecore reflexive editor.
Comment 2 Nicolas Bros CLA 2010-07-07 05:46:38 EDT
I could not find an editor that opens files with this "b3" extension. From what I see in the sources, it looks like the corresponding genmodel has to be generated, but I didn't understand how.
Comment 3 Nicolas Bros CLA 2010-07-07 06:18:50 EDT
I found how to make it work: I had to install com.google.collect 0.8.0, which is not in Orbit, contrary to the 1.0.0 version, which is incompatible.
Comment 4 Nicolas Bros CLA 2010-07-07 06:56:46 EDT
Fixed in revision 2664, by working on Objects instead of EObjects (I previously assumed EObject#eGet returned EObjects or lists of EObjects).


I noticed another problem, though: the model browser keeps refreshing itself when showing a "BuildUnit", because org.eclipse.b3.build.impl.BuildUnitImpl.getBuilders() is implemented in a way that modifies the model each time it is called. And since the model browser refreshes itself each time the model changes, it keeps refreshing (using 100% of one CPU core).

In ModelQuerySetImpl, I fixed the same problem a while ago by doing this:

public EList<ModelQuery> getQueries() {
	if (queries == null) {
		queries = new EObjectContainmentWithInverseEList<ModelQuery>(ModelQuery.class, this, QueryPackage.MODEL_QUERY_SET__QUERIES, QueryPackage.MODEL_QUERY__MODEL_QUERY_SET);
	}
	return queries;
}
Comment 5 Hugo Bruneliere CLA 2010-10-04 13:46:44 EDT
Bug fixed.