Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [TENEO] Discard changes on resource
[TENEO] Discard changes on resource [message #691763] Sat, 02 July 2011 05:15 Go to next message
Waldi  is currently offline Waldi
Messages: 60
Registered: July 2009
Member
Hi,

in my GUI I modify my objects. This objects are loaded thru a resource. Now if I click a chancel button all changes are made on the objects should be undo. But the resource track all the changes and i hadn't a chance to say: "Resource forgot all the thigs you track".

How can I do this?

Thanks Waldi
Re: [TENEO] Discard changes on resource [message #691837 is a reply to message #691763] Sat, 02 July 2011 10:10 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5301
Registered: July 2009
Senior Member
Hi Waldi,
I am not sure if the resource is the correct place to look for this. I think you need to work with commands/command
stacks. But I don't know anything about this subject, maybe others do... Or check the internet for databinding/command
stacks etc.

gr. Martin

On 07/02/2011 11:15 AM, forums-noreply@eclipse.org wrote:
> Hi,
>
> in my GUI I modify my objects. This objects are loaded thru a resource. Now if I click a chancel button all changes are
> made on the objects should be undo. But the resource track all the changes and i hadn't a chance to say: "Resource
> forgot all the thigs you track".
>
> How can I do this?
>
> Thanks Waldi


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [TENEO] Discard changes on resource [message #691885 is a reply to message #691837] Sat, 02 July 2011 13:47 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5014
Registered: July 2009
Senior Member
Hi,

Yes. The command stack is the way to go. You need to setup an
EditingDomain and make all changes through the commandstack instead of
directly.

Tom

Am 02.07.11 16:10, schrieb Martin Taal:
> Hi Waldi,
> I am not sure if the resource is the correct place to look for this. I
> think you need to work with commands/command stacks. But I don't know
> anything about this subject, maybe others do... Or check the internet
> for databinding/command stacks etc.
>
> gr. Martin
>
> On 07/02/2011 11:15 AM, forums-noreply@eclipse.org wrote:
>> Hi,
>>
>> in my GUI I modify my objects. This objects are loaded thru a
>> resource. Now if I click a chancel button all changes are
>> made on the objects should be undo. But the resource track all the
>> changes and i hadn't a chance to say: "Resource
>> forgot all the thigs you track".
>>
>> How can I do this?
>>
>> Thanks Waldi
>
>
Re: [TENEO] Discard changes on resource [message #691941 is a reply to message #691885] Sat, 02 July 2011 18:03 Go to previous messageGo to next message
Waldi  is currently offline Waldi
Messages: 60
Registered: July 2009
Member
Hi Martin,

nice to hear from you. My problem is: I don't run in a RCP context. My application is a swing application and I hadn't a EMF editing domain. Now I use the following:

sc.getSessionWrapper().refresh(eobject);


it reloads the object and the changes gone. It works fine for me.

I try to change my DAO in pure hibernate implementation but I run in several "Illegal attempt to associate a collection with two open sessions" problems. Now I think the "dirty" hack is better than a complete new reimplementation.

Do you think this can cause problems?

btw.: A short other question: Have you try teneo with HibernateEntityManager? (The Hibernate JPA implementation).
Re: [TENEO] Discard changes on resource [message #692083 is a reply to message #691941] Sun, 03 July 2011 08:06 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5014
Registered: July 2009
Senior Member
Am 03.07.11 00:03, schrieb forums-noreply@eclipse.org:
> Hi Martin,
>
> nice to hear from you. My problem is: I don't run in a RCP context. My
> application is a swing application and I hadn't a EMF editing domain.
> Now I use the following:

You don't need RCP to use an editing domain. You can use it in any
Application. The advantage is that you can undo/redo changes step by step.

See here for an Swing-Application that uses an EditingDomain.
-http://tomsondev.bestsolution.at/2011/06/21/eclipse-4-1-application-platform-a-platform-for-anyone/
-https://github.com/tomsontom/emfdatabinding-tutorial

>
> sc.getSessionWrapper().refresh(eobject);
>
> it reloads the object and the changes gone. It works fine for me.
>
> I try to change my DAO in pure hibernate implementation but I run in
> several "Illegal attempt to associate a collection with two open
> sessions" problems. Now I think the "dirty" hack is better than a
> complete new reimplementation.
>
> Do you think this can cause problems?
>
> btw.: A short other question: Have you try teneo with
> HibernateEntityManager? (The Hibernate JPA implementation).
Re: [TENEO] Discard changes on resource [message #692276 is a reply to message #691941] Mon, 04 July 2011 01:58 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5301
Registered: July 2009
Senior Member
Hi Waldi,
Next to refreshing the object, the resource can also contain new objects or keep track of deleted objects. So you would
also need to develop explicit undo functionality for that (ofcourse it depends on your usecase also). That's a fair
amount of work I guess.

In the next build of Teneo I will make a method available in the resource to clear internal change tracking lists. I
have problems with the build of Teneo (some infrastructure issue), so it may take another day or so before I have a new
build.

See also the reply given by Tom about using command stacks in non-rcp environments.

Teneo also works with the Hibernate Entity Manager:
http://wiki.eclipse.org/Teneo/Hibernate/Hibernate_Datastore#HbEntityDataStore.2C_support_for_Hibernate_EntityManager

Maybe I already pointed you to this project:
http://wiki.eclipse.org/Texo

It generates code from ecore (and also generates the orm.xml) which can be used in standard JPA environments (so no need
to use Teneo then).

gr. Martin

On 07/03/2011 12:03 AM, forums-noreply@eclipse.org wrote:
> Hi Martin,
>
> nice to hear from you. My problem is: I don't run in a RCP context. My application is a swing application and I hadn't a
> EMF editing domain. Now I use the following:
>
> sc.getSessionWrapper().refresh(eobject);
>
> it reloads the object and the changes gone. It works fine for me.
>
> I try to change my DAO in pure hibernate implementation but I run in several "Illegal attempt to associate a collection
> with two open sessions" problems. Now I think the "dirty" hack is better than a complete new reimplementation.
>
> Do you think this can cause problems?
>
> btw.: A short other question: Have you try teneo with HibernateEntityManager? (The Hibernate JPA implementation).


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [TENEO] Discard changes on resource [message #694718 is a reply to message #692276] Sat, 09 July 2011 08:56 Go to previous messageGo to next message
Waldi  is currently offline Waldi
Messages: 60
Registered: July 2009
Member
Hi Martin,

The thing is: I like to use Teneo becaus I like to use EMF generated classes. I think EMF classes are wounderfull, so I can't use Texo. I've implement some Swing renderer with EMF functionality and it doesn't make sense to discard all the work.

I'm realy happy about your feature to clear the tracklist of a resource. What do you think how long it will take approximately? One week, one month? one year?

Can I have a look on a changelist to see when the feature is implemented?

Thanks

Waldi
Re: [TENEO] Discard changes on resource [message #694761 is a reply to message #694718] Sat, 09 July 2011 11:48 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5301
Registered: July 2009
Senior Member
Hi Waldi,
It is available in the last build which has been available for a few days, but one thing, if you have objects added to
the resource and want to undo the insert then you have to manually remove them (that's why the editing commands make
sense, they help there). The same for delete, undoing a delete means adding them back to the resource/container.

gr. Martin

On 07/09/2011 02:56 PM, forums-noreply@eclipse.org wrote:
> Hi Martin,
>
> The thing is: I like to use Teneo becaus I like to use EMF generated classes. I think EMF classes are wounderfull, so I
> can't use Texo. I've implement some Swing renderer with EMF functionality and it doesn't make sense to discard all the
> work.
>
> I'm realy happy about your feature to clear the tracklist of a resource. What do you think how long it will take
> approximately? One week, one month? one year?
>
> Can I have a look on a changelist to see when the feature is implemented?
>
> Thanks
>
> Waldi


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [TENEO] Discard changes on resource [message #719679 is a reply to message #694761] Sun, 28 August 2011 07:29 Go to previous messageGo to next message
Waldi  is currently offline Waldi
Messages: 60
Registered: July 2009
Member
Hi Martin,

can you please help me shortly? Today I download the new Teneo Jars from http://download.eclipse.org/modeling/emf/teneo/updates/1.2.0/interim/ with the timestamp *.v201107080556. I can't find a method to clear the tracelist of a Resource or a implementation of it.
Re: [TENEO] Discard changes on resource [message #719700 is a reply to message #719679] Sun, 28 August 2011 09:18 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5301
Registered: July 2009
Senior Member
Hi Waldi,
Afaics it is there, it is implemented in the StoreResource, clearChangeTrackerArrays. The hibernate resource extends the
StoreResource.

gr. Martin

On 08/28/2011 01:29 PM, Waldi wrote:
> Hi Martin,
>
> can you please help me shortly? Today I download the new Teneo Jars from
> http://download.eclipse.org/modeling/emf/teneo/updates/1.2.0/interim/ with the timestamp *.v201107080556. I can't find a
> method to clear the tracelist of a Resource or a implementation of it.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [TENEO] Discard changes on resource [message #720564 is a reply to message #719700] Tue, 30 August 2011 16:12 Go to previous messageGo to next message
Waldi  is currently offline Waldi
Messages: 60
Registered: July 2009
Member
Hi Martin,

the method clearChangeTrackerArrays() is private in the HibernateResource I can't call it.
Re: [TENEO] Discard changes on resource [message #720594 is a reply to message #720564] Tue, 30 August 2011 17:54 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5301
Registered: July 2009
Senior Member
Hi Waldi,
This is the implementation of the clearChangeTrackerArrays in the StoreResource, the HibernateResource inherits from the
StoreResource. I can't find any other occurence of the clearChangeTrackerArrays in the source code.


/** Clears the change tracker arrays */
public void clearChangeTrackerArrays() {
removedEObjects.clear();
newEObjects.clear();
newEObjectSet.clear();
loadedEObjects.clear();
loadedEObjectSet.clear();
modifiedEObjects.clear();
}

gr. Martin

On 08/30/2011 10:12 PM, Waldi wrote:
> Hi Martin,
>
> the method clearChangeTrackerArrays() is private in the HibernateResource I can't call it.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:[TENEO] resource.save(null) -> Exception and then?
Next Topic:[TENEO] Detect failed login
Goto Forum:
  


Current Time: Mon Apr 21 05:56:50 EDT 2014

Powered by FUDForum. Page generated in 0.06363 seconds