Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Dynamic EMF with EditingDomain
Dynamic EMF with EditingDomain [message #1233767] Mon, 20 January 2014 12:31 Go to next message
Paweł Doleciński is currently offline Paweł DolecińskiFriend
Messages: 44
Registered: January 2014
Member
Hi,

I couldn't find any proper solution and do not if there is any.

I've got created dynamically EClasses and DynamicEObjects for these classes.
What I would like to do is to somehow create dynamic editing domain for my EObjects.

This is an example:
EClass eClass = ...;
DynamicEObjectImpl domainObject = new DynamicEObjectImpl( eClass );
ReflectiveItemProviderAdapterFactory reflectiveItemProviderAdapterFactory =
            new ReflectiveItemProviderAdapterFactory();

ComposedAdapterFactory copm =
            new ComposedAdapterFactory( ComposedAdapterFactory.Descriptor.Registry.INSTANCE );
copm.addAdapterFactory( reflectiveItemProviderAdapterFactory );

AdapterFactoryEditingDomain editingDomain =
   new AdapterFactoryEditingDomain( copm, new BasicCommandStack() );

domainObject .eAdapters().add( new AdapterFactoryEditingDomain.EditingDomainProvider( editingDomain ) );


I don't have any resource for where object could be contained.
Even if I created one, still doesn't work.

My main idea to is to be able to open EMF Client Platform editor using dynamic EMF.

Any ideas what I am doing wrong?

Cheers,
Paweł.
Re: Dynamic EMF with EditingDomain [message #1233802 is a reply to message #1233767] Mon, 20 January 2014 14:17 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 295
Registered: March 2012
Senior Member
On 20/01/2014 13:31, Paweł Doleciński wrote:
> EClass eClass = ...;
> DynamicEObjectImpl domainObject = new DynamicEObjectImpl( eClass );

This looks weird, as opposed to EcoreUtil.create(), or
ePackage.getEFactoryInstance().create(...)

> domainObject .eAdapters().add( new
> AdapterFactoryEditingDomain.EditingDomainProvider( editingDomain ) );

If you look at AdapterFactoryEditingDomain.getEditingDomainFor(EObject),
you see that the editing domain provider is only searched on the
object's Resource, not the object itself. What doesn't work exactly,
even if you add the object to a resource?
Re: Dynamic EMF with EditingDomain [message #1233879 is a reply to message #1233802] Mon, 20 January 2014 18:25 Go to previous messageGo to next message
Paweł Doleciński is currently offline Paweł DolecińskiFriend
Messages: 44
Registered: January 2014
Member
EcoreUtil.create() in the end does the same for me as new DynamicEObject(eClass).

It is hard to say what doesn't work exactly. I know that resource is needed so I did eventually. I've been trying to open ECP editor which occurred to be empty. When I had EMF.edit plugin provided then everything worked fine of course.
I guess something is missing still. Maybe I need to register editing domain somehow somewhere. Looks like either reflectiveItemProviderAdapterFactory is not enough or resource.eAdapters().add() is not enough.
To be clear, to have a resource I did only new ResourceImpl() and added my object there. Maybe this is wrong. I did not provided any resource set.
Re: Dynamic EMF with EditingDomain [message #1233898 is a reply to message #1233879] Mon, 20 January 2014 19:42 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 295
Registered: March 2012
Senior Member
> EcoreUtil.create() in the end does the same for me as new
> DynamicEObject(eClass).
Still it looks weird :p

> It is hard to say what doesn't work exactly. I know that resource is
> needed so I did eventually. I've been trying to open ECP editor which
> occurred to be empty. When I had EMF.edit plugin provided then
> everything worked fine of course.

I have no idea what ECP is. Did you try to open your model with the
reflective emf model editor? If that works, it's an ECP thing..

IIRC, the reflective model editor (actually, all EMF generated editors)
requires an URIEditorInput and manages the resource loading itself, you
cannot pass it an already loaded resource without customisation. Maybe
the same thing happens for ECP.. Did you try to save your resource and
then pass it to the editor?
Previous Topic:create Proxy objects
Next Topic:CDO as running a server from a java class
Goto Forum:
  


Current Time: Fri Apr 26 22:44:23 GMT 2024

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

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

Back to the top