Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Removing EObject from EMF Resource with RemoveCommand
Removing EObject from EMF Resource with RemoveCommand [message #763242] Fri, 09 December 2011 07:14 Go to next message
Ricky de Klerck is currently offline Ricky de Klerck
Messages: 295
Registered: January 2011
Senior Member
Hi,

We're building an example application which is build with EMF/Teneo/Hibernate. We only have one object in our EMF model named "Person". We load our objects by making an EMF Resource. I know we can observe this Resource and use it as input for our TableViewer like this:

tableViewer.setInput(EMFProperties.resource().observe(personResource));


This works great, but we when we want to delete a Person from this Resource we're facing a problem. We want to do this through an editingdomain so we should use a Command. Before we always created a RemoveCommand, but now we don't have any StructuralFeature because we only have one Object.

How can we achieve that a Person is removed from a Resource with a Command/EditingDomain. Or is it necessary to have a top element which holds (containment) all the persons? This way we obviously can call a StructuralFeature.. But we don't want this if it isn't necessary.

Thanks in advance.

Regards,
Ricky de Klerck
Re: Removing EObject from EMF Resource with RemoveCommand [message #763258 is a reply to message #763242] Fri, 09 December 2011 07:48 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5294
Registered: July 2009
Senior Member
Please ask emf questions in the future on the EMF-Newsgroup. Instead of
using the static helpers on RemoveCommand you can construct an instance
of RemoveCommand your own.

On the other hand if you'd created an IEMFEditObservableList as input
you can use it's remove method because internally those changes get
replaceted as commands on the original EMF-List.

Tom

Am 09.12.11 13:14, schrieb Ricky de Klerck:
> Hi,
>
> We're building an example application which is build with
> EMF/Teneo/Hibernate. We only have one object in our EMF model named
> "Person". We load our objects by making an EMF Resource. I know we can
> observe this Resource and use it as input for our TableViewer like this:
> tableViewer.setInput();
>
> This works great, but we when we want to delete a Person from this
> Resource we're facing a problem. We want to do this through an
> editingdomain so we should use a Command. Before we always created a
> RemoveCommand, but now we don't have any StructuralFeature because we
> only have one Object.
>
> How can we achieve that a Person is removed from a Resource with a
> Command/EditingDomain. Or is it necessary to have a top element which
> holds (containment) all the persons? This way we obviously can call a
> StructuralFeature.. But we don't want this if it isn't necessary.
>
> Thanks in advance.
>
> Regards,
> Ricky de Klerck
Re: Removing EObject from EMF Resource with RemoveCommand [message #763403 is a reply to message #763258] Fri, 09 December 2011 12:44 Go to previous message
Ricky de Klerck is currently offline Ricky de Klerck
Messages: 295
Registered: January 2011
Senior Member
Okay, I will do that next time.

Using something as IEMFEditObservableList would be very handy, but I can't find something about it on the internet. How should I create such a list? I only have a resource and an editingdomain..

EDIT:

Did you mean an EditingDomainEObjectObservableList? Then I should indeed have a feature..
.

[Updated on: Fri, 09 December 2011 12:49]

Report message to a moderator

Previous Topic:Proper way to programmatically copy files inside of eclipse
Next Topic:Strikeout text in Mac OSX
Goto Forum:
  


Current Time: Thu Aug 28 23:25:59 EDT 2014

Powered by FUDForum. Page generated in 0.01555 seconds