Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Persistence of part state(@PersistState has no effect ?)
Persistence of part state [message #1444008] Mon, 13 October 2014 14:29 Go to next message
Thomas Elskens is currently offline Thomas ElskensFriend
Messages: 159
Registered: September 2014
Location: Brussels - Belgium
Senior Member
Hello,

I'm trying (all day already...) to get the ui-persistence of a part to work.

public class StructuresPart 
{
	private static final String KEY_TEXTFIELD = "input_text" ;
	private TextField field = new TextField();
	
	@PostConstruct
	public void postConstruct(MPart part, GridPane parent) 
	{
		//...
		Map<String, String> state = part.getPersistedState() ;
		field.setText(state.getOrDefault(KEY_TEXTFIELD, "Aucun texte sauvegardé"));

		parent.add(field, 1, 0);
	}
	
	@PersistState
	private void persistState(MPart part)
	{
		Map<String,String> state = part.getPersistedState() ;
		state.put(KEY_TEXTFIELD, "Petit test...") ;
	}
}


On restarting the application, the part state never contains any value for my key ?

I've not forgotten to :

  • remove the "-clearPersistentState" argument
  • make sure the clear checkbox in the launch configuration properties is unchecked.


Any other things to check ... ? Some special dependencies to add ... ?

Thomas
Re: Persistence of part state [message #1444054 is a reply to message #1444008] Mon, 13 October 2014 15:22 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Yep there's something odd going on - File a bug I've already started
investigating why this fails!

Tom

On 13.10.14 16:29, Thomas Elskens wrote:
> Hello,
>
> I'm trying (all day already...) to get the ui-persistence of a part to
> work.
>
> public class StructuresPart {
> private static final String KEY_TEXTFIELD = "input_text" ;
> private TextField field = new TextField();
>
> @PostConstruct
> public void postConstruct(MPart part, GridPane parent) {
> //...
> Map<String, String> state = part.getPersistedState() ;
> field.setText(state.getOrDefault(KEY_TEXTFIELD, "Aucun texte
> sauvegardé"));
>
> parent.add(field, 1, 0);
> }
>
> @PersistState
> private void persistState(MPart part)
> {
> Map<String,String> state = part.getPersistedState() ;
> state.put(KEY_TEXTFIELD, "Petit test...") ;
> }
> }
>
>
> On restarting the application, the part state never contains any value
> for my key ?
> I've not forgotten to :
>
> remove the "-clearPersistentState" argument
> make sure the clear checkbox in the launch configuration properties is
> unchecked.
>
> Any other things to check ... ? Some special dependencies to add ... ?
>
> Thomas
Re: Persistence of part state [message #1444064 is a reply to message #1444054] Mon, 13 October 2014 15:34 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Filed myself https://bugs.eclipse.org/bugs/show_bug.cgi?id=446933 - Fix
to follow in a few minutes!

Tom

On 13.10.14 17:22, Tom Schindl wrote:
> Yep there's something odd going on - File a bug I've already started
> investigating why this fails!
>
> Tom
>
> On 13.10.14 16:29, Thomas Elskens wrote:
>> Hello,
>>
>> I'm trying (all day already...) to get the ui-persistence of a part to
>> work.
>>
>> public class StructuresPart {
>> private static final String KEY_TEXTFIELD = "input_text" ;
>> private TextField field = new TextField();
>>
>> @PostConstruct
>> public void postConstruct(MPart part, GridPane parent) {
>> //...
>> Map<String, String> state = part.getPersistedState() ;
>> field.setText(state.getOrDefault(KEY_TEXTFIELD, "Aucun texte
>> sauvegardé"));
>>
>> parent.add(field, 1, 0);
>> }
>>
>> @PersistState
>> private void persistState(MPart part)
>> {
>> Map<String,String> state = part.getPersistedState() ;
>> state.put(KEY_TEXTFIELD, "Petit test...") ;
>> }
>> }
>>
>>
>> On restarting the application, the part state never contains any value
>> for my key ?
>> I've not forgotten to :
>>
>> remove the "-clearPersistentState" argument
>> make sure the clear checkbox in the launch configuration properties is
>> unchecked.
>>
>> Any other things to check ... ? Some special dependencies to add ... ?
>>
>> Thomas
>
Re: Persistence of part state [message #1444073 is a reply to message #1444054] Mon, 13 October 2014 15:44 Go to previous messageGo to next message
Thomas Elskens is currently offline Thomas ElskensFriend
Messages: 159
Registered: September 2014
Location: Brussels - Belgium
Senior Member
Done: https://bugs.eclipse.org/bugs/show_bug.cgi?id=446935
Re: Persistence of part state [message #1444074 is a reply to message #1444064] Mon, 13 October 2014 15:44 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Fixed and new build has been published - it now works in my test.e4 app.

Tom

On 13.10.14 17:34, Tom Schindl wrote:
> Filed myself https://bugs.eclipse.org/bugs/show_bug.cgi?id=446933 - Fix
> to follow in a few minutes!
>
> Tom
>
> On 13.10.14 17:22, Tom Schindl wrote:
>> Yep there's something odd going on - File a bug I've already started
>> investigating why this fails!
>>
>> Tom
>>
>> On 13.10.14 16:29, Thomas Elskens wrote:
>>> Hello,
>>>
>>> I'm trying (all day already...) to get the ui-persistence of a part to
>>> work.
>>>
>>> public class StructuresPart {
>>> private static final String KEY_TEXTFIELD = "input_text" ;
>>> private TextField field = new TextField();
>>>
>>> @PostConstruct
>>> public void postConstruct(MPart part, GridPane parent) {
>>> //...
>>> Map<String, String> state = part.getPersistedState() ;
>>> field.setText(state.getOrDefault(KEY_TEXTFIELD, "Aucun texte
>>> sauvegardé"));
>>>
>>> parent.add(field, 1, 0);
>>> }
>>>
>>> @PersistState
>>> private void persistState(MPart part)
>>> {
>>> Map<String,String> state = part.getPersistedState() ;
>>> state.put(KEY_TEXTFIELD, "Petit test...") ;
>>> }
>>> }
>>>
>>>
>>> On restarting the application, the part state never contains any value
>>> for my key ?
>>> I've not forgotten to :
>>>
>>> remove the "-clearPersistentState" argument
>>> make sure the clear checkbox in the launch configuration properties is
>>> unchecked.
>>>
>>> Any other things to check ... ? Some special dependencies to add ... ?
>>>
>>> Thomas
>>
>
Re: Persistence of part state [message #1444078 is a reply to message #1444073] Mon, 13 October 2014 15:49 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
The fix as so easy that I filed myself and fixed already. We saved the
file to disk before shuting down the workbench, I only had to flip 2
lines :-(

Tom

On 13.10.14 17:44, Thomas Elskens wrote:
> Done: https://bugs.eclipse.org/bugs/show_bug.cgi?id=446935
Re: Persistence of part state [message #1444787 is a reply to message #1444078] Tue, 14 October 2014 14:55 Go to previous message
Thomas Elskens is currently offline Thomas ElskensFriend
Messages: 159
Registered: September 2014
Location: Brussels - Belgium
Senior Member
Perfect it works nicely now.

Many thanks !

Thomas
Previous Topic:Fixed versions update site?
Next Topic:Drag and drop
Goto Forum:
  


Current Time: Fri Apr 19 13:07:31 GMT 2024

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

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

Back to the top