Persistence of part state [message #1444008] |
Mon, 13 October 2014 14:29 |
Thomas Elskens 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 |
Thomas Schindl 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 |
Thomas Schindl 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 #1444074 is a reply to message #1444064] |
Mon, 13 October 2014 15:44 |
Thomas Schindl 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
>>
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03846 seconds