Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355896 - Enum property editor does not respond to changes in DefaultValueService
Summary: Enum property editor does not respond to changes in DefaultValueService
Status: RESOLVED INVALID
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-25 17:31 EDT by Ling Hao CLA
Modified: 2021-11-19 09:22 EST (History)
1 user (show)

See Also:


Attachments
Apply the patch to org.eclipse.sapphire.samples.gallery project (7.06 KB, patch)
2011-08-25 17:32 EDT, Ling Hao CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ling Hao CLA 2011-08-25 17:31:27 EDT

    
Comment 1 Ling Hao CLA 2011-08-25 17:32:39 EDT
Created attachment 202181 [details]
Apply the patch to org.eclipse.sapphire.samples.gallery project
Comment 2 Konstantin Komissarchik CLA 2011-08-25 17:33:29 EDT
This bug is missing problem description...
Comment 3 Ling Hao CLA 2011-08-25 17:39:14 EDT
- Apply the attached patch
- sapphire-gallery.xml -> List Properties -> Hoterogeneous
- create a child element with integer
- String value: root
  Integer value: 1
  Enum value: yes
- create another child element with integer
- String value: child
  Reference: root
  Integer value: 2
  Enum value: maybe
- Go back to root node, and change the integer and enum values
- Go to child node, and notice the default value for integer has been updated,
but not enum. 

I was able to trace the difference to the TextFieldBinding's
DelayedTasksExecutor, but there nothing equivalent in AbstractEnumBinding.

BTW, sorry about the multiple updates.
Comment 4 Konstantin Komissarchik CLA 2011-08-25 17:52:37 EDT
You are still missing the problem statement. Is the issue that if default value is not static (custom DefaultValueService) that enum property editor does not react to changes?
Comment 5 Ling Hao CLA 2011-08-25 17:55:42 EDT
That's right, the enum property does not respond to changes in the DefautValueService.
Comment 6 Konstantin Komissarchik CLA 2011-09-09 13:31:02 EDT
The issue here is that the system needs to know when to re-calculate the default value. The fact that this works with integers is accidental. The repro shouldn't work as written for either one.

What's necessary are @DependsOn declarations on IntegerValue and EnumValue properties:

@DependsOn( { "Reference", "StringValue", "#/IntegerValue" } )
ValueProperty PROP_INTEGER_VALUE = new ValueProperty( TYPE, "IntegerValue" );

@DependsOn( { "Reference", "StringValue", "#/EnumValue" } )
ValueProperty PROP_ENUM_VALUE = new ValueProperty( TYPE, "EnumValue" );

Once I add these annotations, the repro scenario works as intended.

Note that there is weird bug with @DependsOn annotation that I fixed that is related to this. Make sure that you have the fix for Bug 357161 before you try the above resolution.