Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Edit code when using Generics(Generated code of ItemProvider.collectNewChildDescriptors() contains all available classes)
Edit code when using Generics [message #1747004] Tue, 08 November 2016 14:15 Go to next message
Harald Mackamul is currently offline Harald MackamulFriend
Messages: 9
Registered: November 2016
Junior Member
Hello,

we are using generics in our EMF model. In the generated EMF editor, all objects of our model can be added as child elements even if the definition of the generic inheritance would restrict it to a small number of elements.

I found a similar entry in the forum (see topic) but could not find the mentioned bugzilla entry.
Is there already a solution ?

How to reproduce (Xcore):
package genericsdemo

abstract class A1 {}
class A1C1 extends A1 {}
class A1C2 extends A1 {}

abstract class A2 {}
class A2C1 extends A2 {}
class A2C2 extends A2 {}

class Model {
	contains MyCollection<A1> a1
	contains MyCollection<A2> a2
}

class MyCollection<T> {
	contains MyEntry<T>[] entries
}

class MyEntry<T> {
	String name
	contains T[] items
}


index.php/fa/27531/0/
Re: Edit code when using Generics [message #1747061 is a reply to message #1747004] Wed, 09 November 2016 07:49 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31909
Registered: July 2009
Senior Member
No, there is no generic solution. A MyEntry instance could be contained anywhere and in arbitrary context "items" it can contain any arbitrary instances. The new child descriptors logic in the generate item providers are not designed to "context sensitive".

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] postgresql Junit Tests
Next Topic:Setting Single Containment Reference of A Model Element's using EMF Reflective API
Goto Forum:
  


Current Time: Sat Jun 19 15:31:33 GMT 2021

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

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

Back to the top