Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Setting elements as transient
Setting elements as transient [message #1075436] Mon, 29 July 2013 12:31 Go to next message
Bastian Wagenfeld is currently offline Bastian Wagenfeld
Messages: 162
Registered: January 2013
Senior Member
Hi,

In my app there are some elements (Parts and MenuElements) that are created dynamically. When I restart my RCP the last state is restored, but the dynamically created elements should not show up. Is there a way to mark them as transient or something like that, so they are not restored?

Best regards
Bastian
Re: Setting elements as transient [message #1075445 is a reply to message #1075436] Mon, 29 July 2013 12:47 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5400
Registered: July 2009
Senior Member
No. You need to clean them up in a lifecycle handler.

Tom

On 29.07.13 14:31, Bastian Wagenfeld wrote:
> Hi,
>
> In my app there are some elements (Parts and MenuElements) that are
> created dynamically. When I restart my RCP the last state is restored,
> but the dynamically created elements should not show up. Is there a way
> to mark them as transient or something like that, so they are not restored?
>
> Best regards
> Bastian
Re: Setting elements as transient [message #1075450 is a reply to message #1075445] Mon, 29 July 2013 12:55 Go to previous messageGo to next message
Bastian Wagenfeld is currently offline Bastian Wagenfeld
Messages: 162
Registered: January 2013
Senior Member
Hi Tom,

thanks for your answer. Seems I was asking a little hastily... did exactly that a moment after I wrote this Smile
So sorry for this needless post!

Bastian
Re: Setting elements as transient [message #1075853 is a reply to message #1075450] Tue, 30 July 2013 07:47 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot Cela
Messages: 597
Registered: December 2010
Senior Member

It would be trivial to supply an addon which tags the elements to be transient and have them cleaned up automatically.
Re: Setting elements as transient [message #1075855 is a reply to message #1075853] Tue, 30 July 2013 07:52 Go to previous messageGo to next message
Bastian Wagenfeld is currently offline Bastian Wagenfeld
Messages: 162
Registered: January 2013
Senior Member
Yes, it was trivial Smile
This is what I'm doing now. Adding a tag "transient" when such elements are created and cleaning them up before the workbench.xmi is created.

Bastian
Re: Setting elements as transient [message #1075859 is a reply to message #1075855] Tue, 30 July 2013 08:00 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5400
Registered: July 2009
Senior Member
You need to make sure that you clean all references as well e.g. a part
could be set the selected in its parent and persisting the XMI would
fail then!

Tom

On 30.07.13 09:52, Bastian Wagenfeld wrote:
> Yes, it was trivial :) This is what I'm doing now. Adding a tag
> "transient" when such elements are created and cleaning them up before
> the workbench.xmi is created.
>
> Bastian
Re: Setting elements as transient [message #1075865 is a reply to message #1075859] Tue, 30 July 2013 08:14 Go to previous message
Bastian Wagenfeld is currently offline Bastian Wagenfeld
Messages: 162
Registered: January 2013
Senior Member
Thank you for this hint. But this case seems to work, anyway. For a part I do the following: get the PartStack and remove the part from the stack's children. So another (non-transient) part is set as the selected one and persisted.

Bastian
Previous Topic:Eclipse Kepler Dependency Injection in 3.x & Views
Next Topic:Open dynamically a part
Goto Forum:
  


Current Time: Tue Oct 21 15:22:46 GMT 2014

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

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